1
0

pigs turn into pigmen on lightning

This commit is contained in:
p-mcgowan 2014-11-22 15:33:34 -08:00
parent 075daf9beb
commit d1b7a965d1
2 changed files with 19 additions and 0 deletions

View File

@ -98,3 +98,19 @@ void cPig::Tick(float a_Dt, cChunk & a_Chunk)
bool cPig::DoTakeDamage(TakeDamageInfo & a_TDI)
{
if (!super::DoTakeDamage(a_TDI))
{
return false;
}
if (a_TDI.DamageType == dtLightning)
{
Destroy();
m_World->SpawnMob(GetPosX(), GetPosY(), GetPosZ(), mtZombiePigman);
return true;
}
return true;
}

View File

@ -17,6 +17,9 @@ public:
CLASS_PROTODEF(cPig)
// cEntity overrides
virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override;
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override;
virtual void OnRightClicked(cPlayer & a_Player) override;
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;