2012-06-14 09:06:06 -04:00
|
|
|
|
|
|
|
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
|
|
|
|
2012-09-23 16:53:08 -04:00
|
|
|
#include "PassiveMonster.h"
|
2013-08-16 04:48:19 -04:00
|
|
|
#include "../World.h"
|
2014-01-29 13:15:26 -05:00
|
|
|
#include "../Entities/Player.h"
|
2018-08-28 20:51:25 -04:00
|
|
|
#include "../BoundingBox.h"
|
2017-07-01 08:36:43 -04:00
|
|
|
#include "../Items/ItemSpawnEgg.h"
|
2012-06-14 09:06:06 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-03-22 11:50:34 -04:00
|
|
|
cPassiveMonster::cPassiveMonster(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-10-09 16:49:25 -04:00
|
|
|
Super(a_ConfigName, a_MobType, a_SoundHurt, a_SoundDeath, a_SoundAmbient, a_Width, a_Height)
|
2012-06-14 09:06:06 -04:00
|
|
|
{
|
|
|
|
m_EMPersonality = PASSIVE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-12-21 06:04:08 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
2014-04-25 18:32:30 -04:00
|
|
|
bool cPassiveMonster::DoTakeDamage(TakeDamageInfo & a_TDI)
|
2012-06-14 09:06:06 -04:00
|
|
|
{
|
2020-04-13 12:38:06 -04:00
|
|
|
if (!Super::DoTakeDamage(a_TDI))
|
2014-04-25 18:32:30 -04:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2014-10-20 16:55:07 -04:00
|
|
|
if ((a_TDI.Attacker != this) && (a_TDI.Attacker != nullptr))
|
2012-12-21 06:04:08 -05:00
|
|
|
{
|
2012-06-14 09:06:06 -04:00
|
|
|
m_EMState = ESCAPING;
|
2012-12-21 06:04:08 -05:00
|
|
|
}
|
2014-04-25 18:32:30 -04:00
|
|
|
return true;
|
2012-06-14 09:06:06 -04:00
|
|
|
}
|
|
|
|
|
2012-12-21 06:04:08 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-01-11 16:12:26 -05:00
|
|
|
void cPassiveMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
2012-06-14 09:06:06 -04:00
|
|
|
{
|
2020-04-13 12:38:06 -04:00
|
|
|
Super::Tick(a_Dt, a_Chunk);
|
2016-09-03 07:31:27 -04:00
|
|
|
if (!IsTicking())
|
|
|
|
{
|
|
|
|
// The base class tick destroyed us
|
|
|
|
return;
|
|
|
|
}
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2014-01-24 14:57:32 -05:00
|
|
|
if (m_EMState == ESCAPING)
|
2012-06-14 09:06:06 -04:00
|
|
|
{
|
2020-12-18 15:48:32 -05:00
|
|
|
CheckEventLostPlayer(a_Dt);
|
2012-06-14 09:06:06 -04:00
|
|
|
}
|
2015-11-30 04:07:55 -05:00
|
|
|
|
2020-10-09 16:49:25 -04:00
|
|
|
cMonster::LoveTick();
|
2012-12-21 06:04:08 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-09-07 14:02:50 -04:00
|
|
|
|
2012-12-21 06:04:08 -05:00
|
|
|
|
2015-11-29 13:13:31 -05:00
|
|
|
void cPassiveMonster::OnRightClicked(cPlayer & a_Player)
|
|
|
|
{
|
2020-04-13 12:38:06 -04:00
|
|
|
Super::OnRightClicked(a_Player);
|
2020-10-09 16:49:25 -04:00
|
|
|
Super::RightClickFeed(a_Player);
|
2015-11-29 13:13:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|