Adding Family for monsters : Hostile/Passive/Water/Ambient
This commit is contained in:
parent
04aebd944b
commit
1e02e04d2c
@ -95,5 +95,12 @@ void cAggressiveMonster::Tick(float a_Dt, cChunk & a_Chunk)
|
||||
}
|
||||
|
||||
|
||||
cMonster::eFamily cAggressiveMonster::GetMobFamily() const
|
||||
{
|
||||
return mfHostile;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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
19
source/Mobs/Bat.cpp
Normal 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;
|
||||
}
|
@ -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;
|
||||
} ;
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
@ -55,4 +55,11 @@ void cPassiveMonster::Tick(float a_Dt, cChunk & a_Chunk)
|
||||
|
||||
|
||||
|
||||
cMonster::eFamily cPassiveMonster::GetMobFamily() const
|
||||
{
|
||||
return mfPassive;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -19,6 +19,8 @@ public:
|
||||
|
||||
/// When hit by someone, run away
|
||||
virtual void DoTakeDamage(TakeDamageInfo & a_TDI) override;
|
||||
|
||||
virtual eFamily GetMobFamily(void) const override;
|
||||
} ;
|
||||
|
||||
|
||||
|
@ -54,4 +54,7 @@ void cSquid::Tick(float a_Dt, cChunk & a_Chunk)
|
||||
|
||||
|
||||
|
||||
|
||||
cMonster::eFamily cSquid::GetMobFamily() const
|
||||
{
|
||||
return mfWater;
|
||||
}
|
||||
|
@ -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;
|
||||
} ;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user