summaryrefslogtreecommitdiffstats
path: root/src/BlockEntities/MobSpawnerEntity.h
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-09-17 17:45:13 +0200
committerHowaner <franzi.moos@googlemail.com>2014-09-17 17:45:13 +0200
commit3d94a7ea560f00585f454476928ba4ba3ec28ef7 (patch)
treef8744f8d8c3df1fef5a12d24ba085737022727ca /src/BlockEntities/MobSpawnerEntity.h
parentVoronoiMap: Added Jitter and OddRowOffset params. (diff)
downloadcuberite-3d94a7ea560f00585f454476928ba4ba3ec28ef7.tar
cuberite-3d94a7ea560f00585f454476928ba4ba3ec28ef7.tar.gz
cuberite-3d94a7ea560f00585f454476928ba4ba3ec28ef7.tar.bz2
cuberite-3d94a7ea560f00585f454476928ba4ba3ec28ef7.tar.lz
cuberite-3d94a7ea560f00585f454476928ba4ba3ec28ef7.tar.xz
cuberite-3d94a7ea560f00585f454476928ba4ba3ec28ef7.tar.zst
cuberite-3d94a7ea560f00585f454476928ba4ba3ec28ef7.zip
Diffstat (limited to 'src/BlockEntities/MobSpawnerEntity.h')
-rw-r--r--src/BlockEntities/MobSpawnerEntity.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/BlockEntities/MobSpawnerEntity.h b/src/BlockEntities/MobSpawnerEntity.h
new file mode 100644
index 000000000..b173214a5
--- /dev/null
+++ b/src/BlockEntities/MobSpawnerEntity.h
@@ -0,0 +1,70 @@
+
+#pragma once
+
+#include "BlockEntity.h"
+#include "../Entities/Player.h"
+
+
+
+
+
+namespace Json
+{
+ class Value;
+}
+
+
+
+
+
+// tolua_begin
+
+class cMobSpawnerEntity :
+ public cBlockEntity
+{
+ typedef cBlockEntity super;
+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 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; }
+
+ // tolua_end
+
+ 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;
+
+ 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;
+} ; // tolua_end
+
+
+
+