summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authormgueydan <gueydan.mathieuÃ@gmail.com>2013-09-08 01:43:55 +0200
committermgueydan <gueydan.mathieuÃ@gmail.com>2013-09-08 01:43:55 +0200
commit04151677d57905e35993eac4899e6bd72831ec6f (patch)
tree3f14d82f1f568975ef73aec58b4b27c45ef58361 /source
parentImplementing the MobSpawner (not used yet) that contains spawning rules (diff)
downloadcuberite-04151677d57905e35993eac4899e6bd72831ec6f.tar
cuberite-04151677d57905e35993eac4899e6bd72831ec6f.tar.gz
cuberite-04151677d57905e35993eac4899e6bd72831ec6f.tar.bz2
cuberite-04151677d57905e35993eac4899e6bd72831ec6f.tar.lz
cuberite-04151677d57905e35993eac4899e6bd72831ec6f.tar.xz
cuberite-04151677d57905e35993eac4899e6bd72831ec6f.tar.zst
cuberite-04151677d57905e35993eac4899e6bd72831ec6f.zip
Diffstat (limited to '')
-rw-r--r--source/Chunk.cpp8
-rw-r--r--source/World.cpp9
-rw-r--r--source/World.h4
3 files changed, 13 insertions, 8 deletions
diff --git a/source/Chunk.cpp b/source/Chunk.cpp
index 35e44363e..1d649f3f6 100644
--- a/source/Chunk.cpp
+++ b/source/Chunk.cpp
@@ -533,10 +533,14 @@ void cChunk::Tick(float a_Dt)
m_IsDirty = (*itr)->Tick(a_Dt, *this) | m_IsDirty;
}
- // Tick all entities in this chunk:
+ // Tick all entities in this chunk (except mobs):
for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr)
{
- (*itr)->Tick(a_Dt, *this);
+ // Mobs are tickes inside MobTick (as we don't have to tick them if they are far away from players)
+ if (!((*itr)->IsMob()))
+ {
+ (*itr)->Tick(a_Dt, *this);
+ }
} // for itr - m_Entitites[]
// Remove all entities that were scheduled for removal:
diff --git a/source/World.cpp b/source/World.cpp
index 4bde20ede..17c5ccb3e 100644
--- a/source/World.cpp
+++ b/source/World.cpp
@@ -622,7 +622,7 @@ void cWorld::Tick(float a_Dt)
UnloadUnusedChunks();
}
- TickSpawnMobs(a_Dt);
+ TickMobs(a_Dt);
std::vector<int> m_RSList_copy(m_RSList);
@@ -707,13 +707,13 @@ void cWorld::TickWeather(float a_Dt)
-void cWorld::TickSpawnMobs(float a_Dt)
+void cWorld::TickMobs(float a_Dt)
{
- if (!m_bAnimals || (m_WorldAge - m_LastSpawnMonster <= m_SpawnMonsterRate))
+ if (!m_bAnimals)
{
return;
}
-
+/*
cMobCensus MobCensus;
m_ChunkMap->CollectMobCensus(MobCensus);
MobCensus.logd();
@@ -810,6 +810,7 @@ void cWorld::TickSpawnMobs(float a_Dt)
// A proper mob type was selected, now spawn the mob:
SpawnMob(SpawnPos.x, SpawnPos.y, SpawnPos.z, (cMonster::eType)MobType);
}
+*/
}
diff --git a/source/World.h b/source/World.h
index 6fb5c619b..eb19dce40 100644
--- a/source/World.h
+++ b/source/World.h
@@ -711,8 +711,8 @@ private:
/// Handles the weather in each tick
void TickWeather(float a_Dt);
- /// Handles the mob spawning each tick
- void TickSpawnMobs(float a_Dt);
+ /// Handles the mob spawning/moving/destroying each tick
+ void TickMobs(float a_Dt);
/// Executes all tasks queued onto the tick thread
void TickQueuedTasks(void);