oooooooooo

This commit is contained in:
MarcEricMartel
2023-12-18 14:24:43 -05:00
parent f1bb7447f9
commit 25b5c1e492
5 changed files with 23 additions and 18 deletions

View File

@@ -241,12 +241,12 @@ void Server::Run() {
int max = 0;
for (int64_t x = 0; x < m_boostcount; ++x) {
Vector3f pos = Vector3f(rand() % (WORLD_SIZE_X * CHUNK_SIZE_X) + .5f, rand() % CHUNK_SIZE_Y + .5f, rand() % (WORLD_SIZE_Y * CHUNK_SIZE_Z) + .5f);
if (m_world->BlockAt(pos) == BTYPE_AIR) {
if (m_world->BlockAt(pos) == BTYPE_AIR && m_world->BlockAt(Vector3f(pos.x, pos.y - 2, pos.z)) != BTYPE_AIR) {
Booster* boost = new Booster(pos, (BOOST_TYPE)(rand() % BTYPE_BOOST_LAST), getUniqueId());
m_boosters[boost->GetId()] = boost;
}
else --x;
if (++max > 1000)
if (++max > 100000)
break;
}
@@ -390,6 +390,7 @@ void Server::Run() {
}
}
int max = 0;
for (auto& [key, booster] : m_boosters) {
if (booster->modified) {
PickupMod pmod;
@@ -414,6 +415,9 @@ void Server::Run() {
booster->modified = false;
for (auto& [key, conn] : m_conns)
sendPackTo<PickupMod>(m_sock_udp, &pmod, &m_buf, conn->getAddr());
max++;
if (max > 5)
break;
}
}