summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorp-mcgowan <mickeymcgowan@shaw.ca>2014-11-23 00:33:34 +0100
committerp-mcgowan <mickeymcgowan@shaw.ca>2014-11-23 00:33:34 +0100
commitd1b7a965d10c66a27e1c4593ce3637a2537309d9 (patch)
tree388cb4e7fbd89e8223af686d6139d2df21b9c623
parentMerge pull request #1610 from p-mcgowan/villagersIntoWitchOnLightning (diff)
downloadcuberite-d1b7a965d10c66a27e1c4593ce3637a2537309d9.tar
cuberite-d1b7a965d10c66a27e1c4593ce3637a2537309d9.tar.gz
cuberite-d1b7a965d10c66a27e1c4593ce3637a2537309d9.tar.bz2
cuberite-d1b7a965d10c66a27e1c4593ce3637a2537309d9.tar.lz
cuberite-d1b7a965d10c66a27e1c4593ce3637a2537309d9.tar.xz
cuberite-d1b7a965d10c66a27e1c4593ce3637a2537309d9.tar.zst
cuberite-d1b7a965d10c66a27e1c4593ce3637a2537309d9.zip
-rw-r--r--src/Mobs/Pig.cpp16
-rw-r--r--src/Mobs/Pig.h3
2 files changed, 19 insertions, 0 deletions
diff --git a/src/Mobs/Pig.cpp b/src/Mobs/Pig.cpp
index 55a4412ca..ce53d04fb 100644
--- a/src/Mobs/Pig.cpp
+++ b/src/Mobs/Pig.cpp
@@ -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;
+} \ No newline at end of file
diff --git a/src/Mobs/Pig.h b/src/Mobs/Pig.h
index 953850b3a..0e026933a 100644
--- a/src/Mobs/Pig.h
+++ b/src/Mobs/Pig.h
@@ -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;