summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Pig.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Mobs/Pig.cpp')
-rw-r--r--src/Mobs/Pig.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/Mobs/Pig.cpp b/src/Mobs/Pig.cpp
index 82901b061..6c3de4427 100644
--- a/src/Mobs/Pig.cpp
+++ b/src/Mobs/Pig.cpp
@@ -13,6 +13,11 @@ cPig::cPig(void) :
super("Pig", mtPig, "entity.pig.hurt", "entity.pig.death", 0.9, 0.9),
m_bIsSaddled(false)
{
+ m_EMPersonality = PASSIVE;
+ m_BehaviorBreeder.AttachToMonster(*this);
+ m_BehaviorCoward.AttachToMonster(*this);
+ m_BehaviorItemFollower.AttachToMonster(*this);
+ m_BehaviorWanderer.AttachToMonster(*this);
}
@@ -41,6 +46,9 @@ void cPig::OnRightClicked(cPlayer & a_Player)
{
super::OnRightClicked(a_Player);
+ // Behavior note: saddling is pig-specific. It is not transferrable to other mobs.
+ // Therefore saddling is not a standalone behavior and is hardcoded into the pig.
+
if (m_bIsSaddled)
{
if (m_Attachee != nullptr)
@@ -91,6 +99,9 @@ void cPig::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
return;
}
+ // Behavior note: saddling is pig-specific. It is not transferrable to other mobs.
+ // Therefore saddling is not a standalone behavior and is hardcoded into the pig.
+
// If the attachee player is holding a carrot-on-stick, let them drive this pig:
if (m_bIsSaddled && (m_Attachee != nullptr))
{
@@ -124,3 +135,20 @@ bool cPig::DoTakeDamage(TakeDamageInfo & a_TDI)
+
+cBehaviorBreeder * cPig::GetBehaviorBreeder()
+{
+ return &m_BehaviorBreeder;
+}
+
+
+
+
+
+const cBehaviorBreeder * cPig::GetBehaviorBreeder() const
+{
+ return static_cast<const cBehaviorBreeder *>(&m_BehaviorBreeder);
+}
+
+
+