1
0
cuberite-2a/src/Mobs/PassiveAggressiveMonster.cpp

49 lines
1000 B
C++
Raw Normal View History

#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "PassiveAggressiveMonster.h"
#include "../Entities/Player.h"
2020-03-22 11:50:34 -04:00
cPassiveAggressiveMonster::cPassiveAggressiveMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, const AString & a_SoundAmbient, double a_Width, double a_Height) :
2020-04-13 12:38:06 -04:00
Super(a_ConfigName, a_MobType, a_SoundHurt, a_SoundDeath, a_SoundAmbient, a_Width, a_Height)
{
m_EMPersonality = PASSIVE;
}
2014-04-25 18:32:30 -04:00
bool cPassiveAggressiveMonster::DoTakeDamage(TakeDamageInfo & a_TDI)
{
2020-04-13 12:38:06 -04:00
if (!Super::DoTakeDamage(a_TDI))
2014-04-25 18:32:30 -04:00
{
return false;
}
if ((GetTarget() != nullptr) && (GetTarget()->IsPlayer()))
{
2016-10-12 08:38:45 -04:00
if (static_cast<cPlayer *>(GetTarget())->CanMobsTarget())
{
m_EMState = CHASING;
}
}
2014-04-25 18:32:30 -04:00
return true;
}
2016-10-12 08:38:45 -04:00
void cPassiveAggressiveMonster::EventSeePlayer(cPlayer *, cChunk & a_Chunk)
{
// don't do anything, neutral mobs don't react to just seeing the player
}