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