diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-09-19 23:00:54 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-09-19 23:00:54 +0200 |
commit | 718eb227abe3b9a0e5277d663e32c6e10d51ab52 (patch) | |
tree | 5be83249ccd5b1ab4d2b87a4fa1597424d4e19b2 /src/BlockEntities/MobSpawnerEntity.h | |
parent | Merge branch 'master' into MobSpawner (diff) | |
download | cuberite-718eb227abe3b9a0e5277d663e32c6e10d51ab52.tar cuberite-718eb227abe3b9a0e5277d663e32c6e10d51ab52.tar.gz cuberite-718eb227abe3b9a0e5277d663e32c6e10d51ab52.tar.bz2 cuberite-718eb227abe3b9a0e5277d663e32c6e10d51ab52.tar.lz cuberite-718eb227abe3b9a0e5277d663e32c6e10d51ab52.tar.xz cuberite-718eb227abe3b9a0e5277d663e32c6e10d51ab52.tar.zst cuberite-718eb227abe3b9a0e5277d663e32c6e10d51ab52.zip |
Diffstat (limited to '')
-rw-r--r-- | src/BlockEntities/MobSpawnerEntity.h | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/src/BlockEntities/MobSpawnerEntity.h b/src/BlockEntities/MobSpawnerEntity.h index b173214a5..b12a97d65 100644 --- a/src/BlockEntities/MobSpawnerEntity.h +++ b/src/BlockEntities/MobSpawnerEntity.h @@ -28,41 +28,51 @@ public: // tolua_end cMobSpawnerEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World); - virtual ~cMobSpawnerEntity(); - - bool LoadFromJson(const Json::Value & a_Value); - virtual void SaveToJson(Json::Value & a_Value) override; + virtual void SendTo(cClientHandle & a_Client) override; + virtual void UsedBy(cPlayer * a_Player) override; virtual bool Tick(float a_Dt, cChunk & a_Chunk) override; // tolua_begin - /** Returns the entity who will be spawn by this mob spawner. */ - const AString & GetEntityName(void) const { return m_EntityName; } + /** Upate the active flag from the mob spawner. This function will called every 5 seconds from the Tick() function. */ + void UpdateActiveState(void); + + /** Sets the spawn delay to a new random value. */ + void ResetTimer(void); + + /** Spawns the entity. This function automaticly change the spawn delay! */ + void SpawnEntity(void); + + /** Returns the entity type who will be spawn by this mob spawner. */ + cMonster::eType GetEntity(void) const { return m_Entity; } + + /** Sets the entity type who will be spawn by this mob spawner. */ + void SetEntity(cMonster::eType a_EntityType) { m_Entity = a_EntityType; } + + /** Returns the entity name. (Required by the protocol) */ + AString GetEntityName(void) const; + + /** Returns the spawn delay. */ + int GetSpawnDelay(void) const { return m_SpawnDelay; } + + int GetNearbyPlayersNum(void); + int GetNearbyEntityNum(cMonster::eType a_EntityType); // tolua_end + bool LoadFromJson(const Json::Value & a_Value); + virtual void SaveToJson(Json::Value & a_Value) override; + static const char * GetClassStatic(void) { return "cMobSpawnerEntity"; } - - virtual void UsedBy(cPlayer * a_Player) override; - virtual void SendTo(cClientHandle &) override {} private: /** The entity to spawn. */ - AString m_EntityName; + cMonster::eType m_Entity; int m_SpawnDelay; - int m_MinSpawnDelay; - int m_MaxSpawnDelay; - - /** The mob spawner spawns only mobs when the count of nearby entities (without players) is lesser than this number. */ - short m_MaxNearbyEntities; - - /** The mob spawner spawns only mobs when a player is in the range of the mob spawner. */ - short m_ActivatingRange; - /** The range coefficient for spawning entities around. */ - short m_SpawnRange; + bool m_IsActive; } ; // tolua_end |