1
0

Added SetWalkSpeed() to cMonster.

This commit is contained in:
Howaner 2014-08-30 12:44:54 +02:00
parent 80bd0a5457
commit d7ee2245e8
2 changed files with 9 additions and 0 deletions

View File

@ -89,6 +89,7 @@ cMonster::cMonster(const AString & a_ConfigName, eType a_MobType, const AString
, m_DropChanceBoots(0.085f)
, m_CanPickUpLoot(true)
, m_BurnsInDaylight(false)
, m_WalkSpeed(1.0)
{
if (!a_ConfigName.empty())
{
@ -302,6 +303,9 @@ void cMonster::Tick(float a_Dt, cChunk & a_Chunk)
Distance *= 0.25f;
}
// Apply walk speed:
Distance *= m_WalkSpeed;
AddSpeedX(Distance.x);
AddSpeedZ(Distance.z);

View File

@ -138,6 +138,9 @@ public:
/// Sets whether the mob burns in daylight. Only evaluated at next burn-decision tick
void SetBurnsInDaylight(bool a_BurnsInDaylight) { m_BurnsInDaylight = a_BurnsInDaylight; }
double GetWalkSpeed(void) const { return m_WalkSpeed; } // tolua_export
void SetWalkSpeed(double a_WalkSpeed) { m_WalkSpeed = a_WalkSpeed; } // tolua_export
// Overridables to handle ageable mobs
virtual bool IsBaby (void) const { return false; }
virtual bool IsTame (void) const { return false; }
@ -248,6 +251,8 @@ protected:
void HandleDaylightBurning(cChunk & a_Chunk);
bool m_BurnsInDaylight;
double m_WalkSpeed;
/** Adds a random number of a_Item between a_Min and a_Max to itemdrops a_Drops*/
void AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth = 0);