diff options
author | mgueydan <gueydan.mathieuÃ@gmail.com> | 2013-09-07 20:02:50 +0200 |
---|---|---|
committer | mgueydan <gueydan.mathieuÃ@gmail.com> | 2013-09-07 20:02:50 +0200 |
commit | 1e02e04d2ce528df037d1ca37314ea55e8806c52 (patch) | |
tree | 3013f20a7fe9a418802856a247616c4ab47609fa | |
parent | Adding Water and Lava as transparency blocks (diff) | |
download | cuberite-1e02e04d2ce528df037d1ca37314ea55e8806c52.tar cuberite-1e02e04d2ce528df037d1ca37314ea55e8806c52.tar.gz cuberite-1e02e04d2ce528df037d1ca37314ea55e8806c52.tar.bz2 cuberite-1e02e04d2ce528df037d1ca37314ea55e8806c52.tar.lz cuberite-1e02e04d2ce528df037d1ca37314ea55e8806c52.tar.xz cuberite-1e02e04d2ce528df037d1ca37314ea55e8806c52.tar.zst cuberite-1e02e04d2ce528df037d1ca37314ea55e8806c52.zip |
-rw-r--r-- | source/Mobs/AggressiveMonster.cpp | 7 | ||||
-rw-r--r-- | source/Mobs/AggressiveMonster.h | 2 | ||||
-rw-r--r-- | source/Mobs/Bat.cpp | 19 | ||||
-rw-r--r-- | source/Mobs/Bat.h | 8 | ||||
-rw-r--r-- | source/Mobs/Monster.h | 10 | ||||
-rw-r--r-- | source/Mobs/PassiveMonster.cpp | 7 | ||||
-rw-r--r-- | source/Mobs/PassiveMonster.h | 2 | ||||
-rw-r--r-- | source/Mobs/Squid.cpp | 5 | ||||
-rw-r--r-- | source/Mobs/Squid.h | 2 |
9 files changed, 56 insertions, 6 deletions
diff --git a/source/Mobs/AggressiveMonster.cpp b/source/Mobs/AggressiveMonster.cpp index 2eae772d7..d48523373 100644 --- a/source/Mobs/AggressiveMonster.cpp +++ b/source/Mobs/AggressiveMonster.cpp @@ -95,5 +95,12 @@ void cAggressiveMonster::Tick(float a_Dt, cChunk & a_Chunk) } +cMonster::eFamily cAggressiveMonster::GetMobFamily() const +{ + return mfHostile; +} + + + diff --git a/source/Mobs/AggressiveMonster.h b/source/Mobs/AggressiveMonster.h index 1eff1831e..c16419542 100644 --- a/source/Mobs/AggressiveMonster.h +++ b/source/Mobs/AggressiveMonster.h @@ -19,6 +19,8 @@ public: virtual void InStateChasing(float a_Dt) override; virtual void EventSeePlayer(cEntity *) override; + + virtual eFamily GetMobFamily(void) const override; protected: float m_ChaseTime; diff --git a/source/Mobs/Bat.cpp b/source/Mobs/Bat.cpp new file mode 100644 index 000000000..ec7ce7bc4 --- /dev/null +++ b/source/Mobs/Bat.cpp @@ -0,0 +1,19 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Bat.h" +#include "../Vector3d.h" +#include "../Chunk.h" + + +cBat::cBat(void) : + // TODO: The size is only a guesstimate, measure in vanilla and fix the size values here + super("Bat", 65, "mob.bat.hurt", "mob.bat.death", 0.7, 0.7) +{ +} + + +cMonster::eFamily cBat::GetMobFamily() const +{ + return mfWater; +} diff --git a/source/Mobs/Bat.h b/source/Mobs/Bat.h index 8e4cde29f..e0afb5744 100644 --- a/source/Mobs/Bat.h +++ b/source/Mobs/Bat.h @@ -13,13 +13,11 @@ class cBat : typedef cPassiveMonster super; public: - cBat(void) : - // TODO: The size is only a guesstimate, measure in vanilla and fix the size values here - super("Bat", 65, "mob.bat.hurt", "mob.bat.death", 0.7, 0.7) - { - } + cBat(void); CLASS_PROTODEF(cBat); + + virtual eFamily GetMobFamily(void) const override; } ; diff --git a/source/Mobs/Monster.h b/source/Mobs/Monster.h index 5f33d4450..357e540b3 100644 --- a/source/Mobs/Monster.h +++ b/source/Mobs/Monster.h @@ -55,6 +55,15 @@ public: mtIronGolem = E_META_SPAWN_EGG_IRON_GOLEM, mtVillager = E_META_SPAWN_EGG_VILLAGER, } ; + + enum eFamily + { + mfHostile = 0, // Spider, Zombies ... + mfPassive = 1, // Cows, Pigs + mfAmbient = 2, // Bats + mfWater = 3, // Squid + mfMaxplusone = 4, // Nothing + } ; // tolua_end @@ -81,6 +90,7 @@ public: virtual bool ReachedDestination(void); char GetMobType(void) const {return m_MobType; } + virtual eFamily GetMobFamily(void) const = 0; const char * GetState(); void SetState(const AString & str); diff --git a/source/Mobs/PassiveMonster.cpp b/source/Mobs/PassiveMonster.cpp index 7a6140c04..3d7b8c8aa 100644 --- a/source/Mobs/PassiveMonster.cpp +++ b/source/Mobs/PassiveMonster.cpp @@ -55,4 +55,11 @@ void cPassiveMonster::Tick(float a_Dt, cChunk & a_Chunk) +cMonster::eFamily cPassiveMonster::GetMobFamily() const +{ + return mfPassive; +} + + + diff --git a/source/Mobs/PassiveMonster.h b/source/Mobs/PassiveMonster.h index ae0bea3fb..9d3557727 100644 --- a/source/Mobs/PassiveMonster.h +++ b/source/Mobs/PassiveMonster.h @@ -19,6 +19,8 @@ public: /// When hit by someone, run away virtual void DoTakeDamage(TakeDamageInfo & a_TDI) override; + + virtual eFamily GetMobFamily(void) const override; } ; diff --git a/source/Mobs/Squid.cpp b/source/Mobs/Squid.cpp index cb796f5ec..50265aea4 100644 --- a/source/Mobs/Squid.cpp +++ b/source/Mobs/Squid.cpp @@ -54,4 +54,7 @@ void cSquid::Tick(float a_Dt, cChunk & a_Chunk) - +cMonster::eFamily cSquid::GetMobFamily() const +{ + return mfWater; +} diff --git a/source/Mobs/Squid.h b/source/Mobs/Squid.h index 35d7295b3..d5f3a74d7 100644 --- a/source/Mobs/Squid.h +++ b/source/Mobs/Squid.h @@ -20,6 +20,8 @@ public: CLASS_PROTODEF(cSquid); virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; + + virtual eFamily GetMobFamily(void) const override; } ; |