summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-06-26 17:09:28 +0200
committerMattes D <github@xoft.cz>2014-06-26 17:09:28 +0200
commit7102e9edb0b3e0ff19785f447c7b7185762c2282 (patch)
tree7b0a76bb26bc37e26996d12973650b80c4162b2a
parentMerge pull request #1126 from mc-server/BlockInfoInit (diff)
parentAdded pig riding. (diff)
downloadcuberite-7102e9edb0b3e0ff19785f447c7b7185762c2282.tar
cuberite-7102e9edb0b3e0ff19785f447c7b7185762c2282.tar.gz
cuberite-7102e9edb0b3e0ff19785f447c7b7185762c2282.tar.bz2
cuberite-7102e9edb0b3e0ff19785f447c7b7185762c2282.tar.lz
cuberite-7102e9edb0b3e0ff19785f447c7b7185762c2282.tar.xz
cuberite-7102e9edb0b3e0ff19785f447c7b7185762c2282.tar.zst
cuberite-7102e9edb0b3e0ff19785f447c7b7185762c2282.zip
Diffstat (limited to '')
-rw-r--r--src/Mobs/Pig.cpp20
-rw-r--r--src/Mobs/Pig.h1
2 files changed, 21 insertions, 0 deletions
diff --git a/src/Mobs/Pig.cpp b/src/Mobs/Pig.cpp
index e862f5aaa..1f77cf613 100644
--- a/src/Mobs/Pig.cpp
+++ b/src/Mobs/Pig.cpp
@@ -78,3 +78,23 @@ void cPig::OnRightClicked(cPlayer & a_Player)
+
+
+void cPig::Tick(float a_Dt, cChunk & a_Chunk)
+{
+ super::Tick(a_Dt, a_Chunk);
+
+ // If the attachee player is holding a carrot-on-stick, let them drive this pig:
+ if (m_bIsSaddled && (m_Attachee != NULL))
+ {
+ if (m_Attachee->IsPlayer() && (m_Attachee->GetEquippedWeapon().m_ItemType == E_ITEM_CARROT_ON_STICK))
+ {
+ MoveToPosition((m_Attachee->GetPosition()) + (m_Attachee->GetLookVector()*10));
+ m_bMovingToDestination = true;
+ }
+ }
+}
+
+
+
+
diff --git a/src/Mobs/Pig.h b/src/Mobs/Pig.h
index d434324c1..313af2f44 100644
--- a/src/Mobs/Pig.h
+++ b/src/Mobs/Pig.h
@@ -19,6 +19,7 @@ public:
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
virtual void OnRightClicked(cPlayer & a_Player) override;
+ virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
virtual const cItem GetFollowedItem(void) const override { return cItem(E_ITEM_CARROT); }