diff options
author | 12xx12 <44411062+12xx12@users.noreply.github.com> | 2020-10-10 21:31:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-10 21:31:44 +0200 |
commit | c0711407e96353e14bfa41f17db4e45c43f8ebb9 (patch) | |
tree | 06fc3be82f5478aa9c39c1ec5e665a8a05feb6c2 /src/BlockEntities/MobSpawnerEntity.h | |
parent | Anvil fixes (#4976) (diff) | |
download | cuberite-c0711407e96353e14bfa41f17db4e45c43f8ebb9.tar cuberite-c0711407e96353e14bfa41f17db4e45c43f8ebb9.tar.gz cuberite-c0711407e96353e14bfa41f17db4e45c43f8ebb9.tar.bz2 cuberite-c0711407e96353e14bfa41f17db4e45c43f8ebb9.tar.lz cuberite-c0711407e96353e14bfa41f17db4e45c43f8ebb9.tar.xz cuberite-c0711407e96353e14bfa41f17db4e45c43f8ebb9.tar.zst cuberite-c0711407e96353e14bfa41f17db4e45c43f8ebb9.zip |
Diffstat (limited to '')
-rw-r--r-- | src/BlockEntities/MobSpawnerEntity.h | 60 |
1 files changed, 41 insertions, 19 deletions
diff --git a/src/BlockEntities/MobSpawnerEntity.h b/src/BlockEntities/MobSpawnerEntity.h index 0d1991e87..a037343f4 100644 --- a/src/BlockEntities/MobSpawnerEntity.h +++ b/src/BlockEntities/MobSpawnerEntity.h @@ -33,46 +33,68 @@ public: // tolua_export virtual bool UsedBy(cPlayer * a_Player) override; virtual bool Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; + static const char * GetClassStatic(void) { return "cMobSpawnerEntity"; } // tolua_begin - /** Upate the active flag from the mob spawner. This function will called every 5 seconds from the Tick() function. */ + /** Update 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! */ + /** Spawns the entity. This function automatically change the spawn delay! */ void SpawnEntity(void); - /** Returns the entity type that will be spawn by this mob spawner. */ - eMonsterType GetEntity(void) const { return m_Entity; } - - /** Sets the entity type who will be spawn by this mob spawner. */ - void SetEntity(eMonsterType a_EntityType) { m_Entity = a_EntityType; } - - /** Returns the spawn delay. This is the tick delay that is needed to spawn new monsters. */ - short GetSpawnDelay(void) const { return m_SpawnDelay; } - - /** Sets the spawn delay. */ - void SetSpawnDelay(short a_Delay) { m_SpawnDelay = a_Delay; } - - /** Returns the amount of the nearby players in a 16-block radius. */ + // Getters + int GetNearbyMonsterNum(eMonsterType a_EntityType); int GetNearbyPlayersNum(void); - /** Returns the amount of this monster type in a 8-block radius (Y: 4-block radius). */ - int GetNearbyMonsterNum(eMonsterType a_EntityType); + eMonsterType GetEntity(void) const { return m_Entity; } + short GetSpawnCount(void) const { return m_SpawnCount; } + short GetSpawnRange(void) const { return m_SpawnRange; } + short GetSpawnDelay(void) const { return m_SpawnDelay; } + short GetMinSpawnDelay(void) const { return m_MinSpawnDelay; } + short GetMaxSpawnDelay(void) const { return m_MaxSpawnDelay; } + short GetMaxNearbyEntities(void) const { return m_MaxNearbyEntities; } + short GetRequiredPlayerRange(void) const { return m_RequiredPlayerRange; } + + // Setters + void SetEntity(eMonsterType a_EntityType) { m_Entity = a_EntityType; } + void SetSpawnDelay(short a_Delay) { m_SpawnDelay = a_Delay; } + void SetSpawnCount(short a_SpawnCount) { m_SpawnCount = a_SpawnCount; } + void SetSpawnRange(short a_SpawnRange) { m_SpawnRange = a_SpawnRange; } + void SetMinSpawnDelay(short a_Min) { m_MinSpawnDelay = a_Min; } + void SetMaxSpawnDelay(short a_Max) { m_MaxSpawnDelay = a_Max; } + void SetMaxNearbyEntities(short a_MaxNearbyEntities) { m_MaxNearbyEntities = a_MaxNearbyEntities; } + void SetRequiredPlayerRange(short a_RequiredPlayerRange) { m_RequiredPlayerRange = a_RequiredPlayerRange; } // tolua_end - static const char * GetClassStatic(void) { return "cMobSpawnerEntity"; } - private: /** The entity to spawn. */ eMonsterType m_Entity; + /** Time in ticks until the next entity spawns */ short m_SpawnDelay; bool m_IsActive; + + /** Number of entities the spawner tries to spawn each activation. */ + short m_SpawnCount = 4; + + /** Diameter of the square the new monsters are spawned in */ + short m_SpawnRange = 8; + + short m_MinSpawnDelay = 200; + + short m_MaxSpawnDelay = 800; + + /** Maximum amount of the same entity type in proximity. */ + short m_MaxNearbyEntities = 6; + + /** Maximum distance to player for activation */ + short m_RequiredPlayerRange = 16; + } ; // tolua_end |