From d2eb58f27780a3c65fedd0d21d152ee8866ebb86 Mon Sep 17 00:00:00 2001 From: mgueydan Date: Sat, 7 Sep 2013 22:19:56 +0200 Subject: Adding mob census (sorry this is a big commit as work was done before git integration i couldn't split it more) --- source/Chunk.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/Chunk.h') diff --git a/source/Chunk.h b/source/Chunk.h index c979b7928..5f2bba3d8 100644 --- a/source/Chunk.h +++ b/source/Chunk.h @@ -49,6 +49,7 @@ class cPickup; class cChunkDataSerializer; class cBlockArea; class cFluidSimulatorData; +class cMobCensus; typedef std::list cClientHandleList; typedef cItemCallback cEntityCallback; @@ -124,6 +125,9 @@ public: /// Sets or resets the internal flag that prevents chunk from being unloaded void Stay(bool a_Stay = true); + /// Recence all mobs proximities to players in order to know what to do with them + void CollectMobCensus(cMobCensus& toFill); + void Tick(float a_Dt); int GetPosX(void) const { return m_PosX; } -- cgit v1.2.3 From bf1fb0aa3dbd5b6b793d920c4e301e4782fe0f0f Mon Sep 17 00:00:00 2001 From: mgueydan Date: Sun, 8 Sep 2013 00:11:38 +0200 Subject: Adding an Empty shell that would launch mob spawner - not called yet --- source/Chunk.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/Chunk.h') diff --git a/source/Chunk.h b/source/Chunk.h index 5f2bba3d8..69ecbfec4 100644 --- a/source/Chunk.h +++ b/source/Chunk.h @@ -50,6 +50,7 @@ class cChunkDataSerializer; class cBlockArea; class cFluidSimulatorData; class cMobCensus; +class cMobSpawner; typedef std::list cClientHandleList; typedef cItemCallback cEntityCallback; @@ -128,6 +129,9 @@ public: /// Recence all mobs proximities to players in order to know what to do with them void CollectMobCensus(cMobCensus& toFill); + /// Try to Spawn Monsters inside chunk + void SpawnMobs(cMobSpawner& a_MobSpawner); + void Tick(float a_Dt); int GetPosX(void) const { return m_PosX; } @@ -389,6 +393,10 @@ private: cSandSimulatorChunkData m_SandSimulatorData; + // pick up a random block of this chunk + void getRandomBlock(int& a_X, int& a_Y, int& a_Z); + void getThreeRandomNumber(int& a_X, int& a_Y, int& a_Z,int a_MaxX, int a_MaxY, int a_MaxZ); + void RemoveBlockEntity(cBlockEntity * a_BlockEntity); void AddBlockEntity (cBlockEntity * a_BlockEntity); -- cgit v1.2.3 From 668b6edaa7390f87b0b7e7e28ddb49c9d3f66d2a Mon Sep 17 00:00:00 2001 From: mgueydan Date: Sun, 8 Sep 2013 11:48:48 +0200 Subject: renaming the cChunk::getRandomBlock method + removing a buggy working log --- source/Chunk.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/Chunk.h') diff --git a/source/Chunk.h b/source/Chunk.h index 69ecbfec4..aca180d16 100644 --- a/source/Chunk.h +++ b/source/Chunk.h @@ -394,7 +394,7 @@ private: // pick up a random block of this chunk - void getRandomBlock(int& a_X, int& a_Y, int& a_Z); + void getRandomBlockCoords(int& a_X, int& a_Y, int& a_Z); void getThreeRandomNumber(int& a_X, int& a_Y, int& a_Z,int a_MaxX, int a_MaxY, int a_MaxZ); void RemoveBlockEntity(cBlockEntity * a_BlockEntity); -- cgit v1.2.3