1
0

Adding Family for monsters : Hostile/Passive/Water/Ambient

This commit is contained in:
mgueydan 2013-09-07 20:02:50 +02:00
parent 04aebd944b
commit 1e02e04d2c
9 changed files with 56 additions and 6 deletions

View File

@ -95,5 +95,12 @@ void cAggressiveMonster::Tick(float a_Dt, cChunk & a_Chunk)
}
cMonster::eFamily cAggressiveMonster::GetMobFamily() const
{
return mfHostile;
}

View File

@ -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;

19
source/Mobs/Bat.cpp Normal file
View File

@ -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;
}

View File

@ -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;
} ;

View File

@ -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);

View File

@ -55,4 +55,11 @@ void cPassiveMonster::Tick(float a_Dt, cChunk & a_Chunk)
cMonster::eFamily cPassiveMonster::GetMobFamily() const
{
return mfPassive;
}

View File

@ -19,6 +19,8 @@ public:
/// When hit by someone, run away
virtual void DoTakeDamage(TakeDamageInfo & a_TDI) override;
virtual eFamily GetMobFamily(void) const override;
} ;

View File

@ -54,4 +54,7 @@ void cSquid::Tick(float a_Dt, cChunk & a_Chunk)
cMonster::eFamily cSquid::GetMobFamily() const
{
return mfWater;
}

View File

@ -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;
} ;