diff options
author | LogicParrot <LogicParrot@users.noreply.github.com> | 2017-08-24 22:21:25 +0200 |
---|---|---|
committer | LogicParrot <LogicParrot@users.noreply.github.com> | 2017-08-24 22:21:25 +0200 |
commit | 810230b5466f1363d69763670fc9b85fa385c99a (patch) | |
tree | a9d4dcfd43ac28ef2fb9e61e73a34f7246a695bb /src/Mobs | |
parent | Merge branch 'master' into mobs2 (diff) | |
download | cuberite-810230b5466f1363d69763670fc9b85fa385c99a.tar cuberite-810230b5466f1363d69763670fc9b85fa385c99a.tar.gz cuberite-810230b5466f1363d69763670fc9b85fa385c99a.tar.bz2 cuberite-810230b5466f1363d69763670fc9b85fa385c99a.tar.lz cuberite-810230b5466f1363d69763670fc9b85fa385c99a.tar.xz cuberite-810230b5466f1363d69763670fc9b85fa385c99a.tar.zst cuberite-810230b5466f1363d69763670fc9b85fa385c99a.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Mobs/Behaviors/Behavior.h | 2 | ||||
-rw-r--r-- | src/Mobs/Behaviors/BehaviorAggressive.h | 2 | ||||
-rw-r--r-- | src/Mobs/Behaviors/BehaviorBreeder.cpp | 4 | ||||
-rw-r--r-- | src/Mobs/Behaviors/BehaviorBreeder.h | 2 | ||||
-rw-r--r-- | src/Mobs/Behaviors/BehaviorChaser.cpp | 5 | ||||
-rw-r--r-- | src/Mobs/Behaviors/BehaviorChaser.h | 3 | ||||
-rw-r--r-- | src/Mobs/Behaviors/BehaviorCoward.cpp | 5 | ||||
-rw-r--r-- | src/Mobs/Behaviors/BehaviorCoward.h | 2 | ||||
-rw-r--r-- | src/Mobs/Behaviors/BehaviorDayLightBurner.h | 2 | ||||
-rw-r--r-- | src/Mobs/Behaviors/BehaviorItemFollower.cpp | 2 | ||||
-rw-r--r-- | src/Mobs/Behaviors/BehaviorItemFollower.h | 2 | ||||
-rw-r--r-- | src/Mobs/Behaviors/BehaviorWanderer.cpp | 2 | ||||
-rw-r--r-- | src/Mobs/Behaviors/BehaviorWanderer.h | 2 | ||||
-rw-r--r-- | src/Mobs/Cow.cpp | 66 | ||||
-rw-r--r-- | src/Mobs/Cow.h | 29 | ||||
-rw-r--r-- | src/Mobs/Monster.cpp | 48 | ||||
-rw-r--r-- | src/Mobs/Monster.h | 5 | ||||
-rw-r--r-- | src/Mobs/PassiveMonster.cpp | 17 | ||||
-rw-r--r-- | src/Mobs/PassiveMonster.h | 31 |
19 files changed, 119 insertions, 112 deletions
diff --git a/src/Mobs/Behaviors/Behavior.h b/src/Mobs/Behaviors/Behavior.h index 0b554ec62..1bfefbf8d 100644 --- a/src/Mobs/Behaviors/Behavior.h +++ b/src/Mobs/Behaviors/Behavior.h @@ -9,8 +9,6 @@ class cMonster; class cBehavior { public: - virtual void AttachToMonster(cMonster & a_Parent) = 0; - // Tick-related virtual bool IsControlDesired(std::chrono::milliseconds a_Dt, cChunk & a_Chunk); virtual bool ControlStarting(std::chrono::milliseconds a_Dt, cChunk & a_Chunk); diff --git a/src/Mobs/Behaviors/BehaviorAggressive.h b/src/Mobs/Behaviors/BehaviorAggressive.h index 7dc7060c7..8905b7341 100644 --- a/src/Mobs/Behaviors/BehaviorAggressive.h +++ b/src/Mobs/Behaviors/BehaviorAggressive.h @@ -19,7 +19,7 @@ class cBehaviorAggressive : public cBehavior { public: - void AttachToMonster(cMonster & a_Parent) override; + void AttachToMonster(cMonster & a_Parent); // cBehaviorAggressive(cMonster * a_Parent, bool a_HatesPlayer); // TODO agression toward specific players, and specific mobtypes, etc diff --git a/src/Mobs/Behaviors/BehaviorBreeder.cpp b/src/Mobs/Behaviors/BehaviorBreeder.cpp index b32fafc8c..bc0c8d3ea 100644 --- a/src/Mobs/Behaviors/BehaviorBreeder.cpp +++ b/src/Mobs/Behaviors/BehaviorBreeder.cpp @@ -23,6 +23,7 @@ cBehaviorBreeder::cBehaviorBreeder() : void cBehaviorBreeder::AttachToMonster(cMonster & a_Parent) { + LOGD("mobDebug - Behavior Breeder: Attach"); m_Parent = &a_Parent; m_Parent->AttachTickBehavior(this); m_Parent->AttachPostTickBehavior(this); @@ -36,6 +37,7 @@ void cBehaviorBreeder::AttachToMonster(cMonster & a_Parent) void cBehaviorBreeder::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { + LOGD("mobDebug - Behavior Breeder: Tick"); UNUSED(a_Dt); UNUSED(a_Chunk); cWorld * World = m_Parent->GetWorld(); @@ -88,6 +90,7 @@ void cBehaviorBreeder::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) void cBehaviorBreeder::PostTick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { + LOGD("mobDebug - Behavior Breeder: PostTick"); UNUSED(a_Dt); UNUSED(a_Chunk); if (m_MatingTimer > 0) @@ -179,6 +182,7 @@ bool cBehaviorBreeder::IsControlDesired(std::chrono::milliseconds a_Dt, cChunk & void cBehaviorBreeder::Destroyed() { + LOGD("mobDebug - Behavior Breeder: Destroyed"); if (m_LovePartner != nullptr) { m_LovePartner->GetBehaviorBreeder()->ResetLoveMode(); diff --git a/src/Mobs/Behaviors/BehaviorBreeder.h b/src/Mobs/Behaviors/BehaviorBreeder.h index 576234066..94830c42b 100644 --- a/src/Mobs/Behaviors/BehaviorBreeder.h +++ b/src/Mobs/Behaviors/BehaviorBreeder.h @@ -19,7 +19,7 @@ class cBehaviorBreeder : public cBehavior public: cBehaviorBreeder(); - void AttachToMonster(cMonster & a_Parent) override; + void AttachToMonster(cMonster & a_Parent); // Functions our host Monster should invoke: bool IsControlDesired(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; diff --git a/src/Mobs/Behaviors/BehaviorChaser.cpp b/src/Mobs/Behaviors/BehaviorChaser.cpp index 8e2a70bd4..dd9f193d6 100644 --- a/src/Mobs/Behaviors/BehaviorChaser.cpp +++ b/src/Mobs/Behaviors/BehaviorChaser.cpp @@ -23,9 +23,10 @@ cBehaviorChaser::cBehaviorChaser() : -void cBehaviorChaser::AttachToMonster(cMonster & a_Parent) +void cBehaviorChaser::AttachToMonster(cMonster & a_Parent, cBehaviorStriker & a_ParentStriker) { m_Parent = &a_Parent; + m_ParentStriker = &a_ParentStriker; m_Parent->AttachTickBehavior(this); m_Parent->AttachDestroyBehavior(this); m_Parent->AttachPostTickBehavior(this); @@ -245,7 +246,7 @@ void cBehaviorChaser::StrikeTarget() { if (m_AttackCoolDownTicksLeft != 0) { - cBehaviorStriker * Striker = m_Parent->GetBehaviorStriker(); + cBehaviorStriker * Striker = m_ParentStriker; if (Striker != nullptr) { // Striker->Strike(m_Target); //mobTodo diff --git a/src/Mobs/Behaviors/BehaviorChaser.h b/src/Mobs/Behaviors/BehaviorChaser.h index a40be6aba..1c64c7b07 100644 --- a/src/Mobs/Behaviors/BehaviorChaser.h +++ b/src/Mobs/Behaviors/BehaviorChaser.h @@ -18,7 +18,7 @@ class cBehaviorChaser : public cBehavior public: cBehaviorChaser(); - void AttachToMonster(cMonster & a_Parent) override; + void AttachToMonster(cMonster & a_Parent, cBehaviorStriker & a_ParentStriker); // Functions our host Monster should invoke: bool IsControlDesired(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; @@ -44,6 +44,7 @@ private: /** Our parent */ cMonster * m_Parent; + cBehaviorStriker * m_ParentStriker; // The mob we want to attack cPawn * m_Target; diff --git a/src/Mobs/Behaviors/BehaviorCoward.cpp b/src/Mobs/Behaviors/BehaviorCoward.cpp index d23da5ac6..94997f065 100644 --- a/src/Mobs/Behaviors/BehaviorCoward.cpp +++ b/src/Mobs/Behaviors/BehaviorCoward.cpp @@ -16,10 +16,9 @@ cBehaviorCoward::cBehaviorCoward() : void cBehaviorCoward::AttachToMonster(cMonster & a_Parent) { + LOGD("mobDebug - Behavior Coward: Attach"); m_Parent = &a_Parent; m_Parent->AttachTickBehavior(this); - m_Parent->AttachDestroyBehavior(this); - m_Parent->AttachPostTickBehavior(this); m_Parent->AttachDoTakeDamageBehavior(this); } @@ -40,6 +39,7 @@ bool cBehaviorCoward::IsControlDesired(std::chrono::milliseconds a_Dt, cChunk & void cBehaviorCoward::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { + LOGD("mobDebug - Behavior Coward: Tick"); UNUSED(a_Dt); UNUSED(a_Chunk); if (m_Attacker == nullptr) @@ -66,6 +66,7 @@ void cBehaviorCoward::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) void cBehaviorCoward::DoTakeDamage(TakeDamageInfo & a_TDI) { + LOGD("mobDebug - Behavior Coward: DoTakeDamage"); if ((a_TDI.Attacker != m_Parent) && (a_TDI.Attacker != nullptr)) { m_Attacker = a_TDI.Attacker; diff --git a/src/Mobs/Behaviors/BehaviorCoward.h b/src/Mobs/Behaviors/BehaviorCoward.h index b72dbaf41..f33ab38c8 100644 --- a/src/Mobs/Behaviors/BehaviorCoward.h +++ b/src/Mobs/Behaviors/BehaviorCoward.h @@ -14,7 +14,7 @@ class cBehaviorCoward : cBehavior { public: cBehaviorCoward(); - void AttachToMonster(cMonster & a_Parent) override; + void AttachToMonster(cMonster & a_Parent); // Functions our host Monster should invoke: bool IsControlDesired(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; diff --git a/src/Mobs/Behaviors/BehaviorDayLightBurner.h b/src/Mobs/Behaviors/BehaviorDayLightBurner.h index 0acdeea40..d1299c0c6 100644 --- a/src/Mobs/Behaviors/BehaviorDayLightBurner.h +++ b/src/Mobs/Behaviors/BehaviorDayLightBurner.h @@ -12,7 +12,7 @@ class cChunk; class cBehaviorDayLightBurner : cBehavior { public: - void AttachToMonster(cMonster & a_Parent) override; + void AttachToMonster(cMonster & a_Parent); void PostTick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; bool WouldBurnAt(Vector3d a_Location, cChunk & a_Chunk); diff --git a/src/Mobs/Behaviors/BehaviorItemFollower.cpp b/src/Mobs/Behaviors/BehaviorItemFollower.cpp index d10b46776..421334455 100644 --- a/src/Mobs/Behaviors/BehaviorItemFollower.cpp +++ b/src/Mobs/Behaviors/BehaviorItemFollower.cpp @@ -8,6 +8,7 @@ void cBehaviorItemFollower::AttachToMonster(cMonster & a_Parent) { + LOGD("mobDebug - Behavior ItemFollower: Attach"); m_Parent = &a_Parent; m_Parent->AttachTickBehavior(this); } @@ -43,6 +44,7 @@ bool cBehaviorItemFollower::IsControlDesired(std::chrono::milliseconds a_Dt, cCh void cBehaviorItemFollower::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { + LOGD("mobDebug - Behavior ItemFollower: Tick"); UNUSED(a_Dt); UNUSED(a_Chunk); cItems FollowedItems; diff --git a/src/Mobs/Behaviors/BehaviorItemFollower.h b/src/Mobs/Behaviors/BehaviorItemFollower.h index 277323ab1..c84779a5e 100644 --- a/src/Mobs/Behaviors/BehaviorItemFollower.h +++ b/src/Mobs/Behaviors/BehaviorItemFollower.h @@ -12,7 +12,7 @@ class cItems; class cBehaviorItemFollower : public cBehavior { public: - void AttachToMonster(cMonster & a_Parent) override; + void AttachToMonster(cMonster & a_Parent); void GetBreedingItems(cItems & a_Items); diff --git a/src/Mobs/Behaviors/BehaviorWanderer.cpp b/src/Mobs/Behaviors/BehaviorWanderer.cpp index 44dda077b..39fde8373 100644 --- a/src/Mobs/Behaviors/BehaviorWanderer.cpp +++ b/src/Mobs/Behaviors/BehaviorWanderer.cpp @@ -15,6 +15,7 @@ cBehaviorWanderer::cBehaviorWanderer() : m_IdleInterval(0) void cBehaviorWanderer::AttachToMonster(cMonster & a_Parent) { + LOGD("mobDebug - Behavior Wanderer: Attach"); m_Parent = &a_Parent; m_Parent->AttachTickBehavior(this); } @@ -38,6 +39,7 @@ bool cBehaviorWanderer::IsControlDesired(std::chrono::milliseconds a_Dt, cChunk void cBehaviorWanderer::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { + LOGD("mobDebug - Behavior Wanderer: Tick"); if (m_Parent->IsPathFinderActivated()) { return; // Still getting there diff --git a/src/Mobs/Behaviors/BehaviorWanderer.h b/src/Mobs/Behaviors/BehaviorWanderer.h index 90dddcebc..577881c2f 100644 --- a/src/Mobs/Behaviors/BehaviorWanderer.h +++ b/src/Mobs/Behaviors/BehaviorWanderer.h @@ -13,7 +13,7 @@ class cBehaviorWanderer : cBehavior public: cBehaviorWanderer(); - void AttachToMonster(cMonster & a_Parent) override; + void AttachToMonster(cMonster & a_Parent); // Functions our host Monster should invoke: bool IsControlDesired(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; diff --git a/src/Mobs/Cow.cpp b/src/Mobs/Cow.cpp index c92f2369f..d3208465a 100644 --- a/src/Mobs/Cow.cpp +++ b/src/Mobs/Cow.cpp @@ -6,9 +6,13 @@ -cCow::cCow(void) : - super("Cow", mtCow, "entity.cow.hurt", "entity.cow.death", 0.9, 1.3) +cCow::cCow(void) : super("Cow", mtCow, "entity.cow.hurt", "entity.cow.death", 0.9, 1.3) { + m_BehaviorBreeder.AttachToMonster(*this); + m_BehaviorCoward.AttachToMonster(*this); + m_BehaviorItemFollower.AttachToMonster(*this); + m_BehaviorWanderer.AttachToMonster(*this); + // mobTodo Behavior itemReplacer for the bucket } @@ -17,30 +21,50 @@ cCow::cCow(void) : void cCow::GetDrops(cItems & a_Drops, cEntity * a_Killer) { - unsigned int LootingLevel = 0; - if (a_Killer != nullptr) - { - LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting); - } - AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_LEATHER); - AddRandomDropItem(a_Drops, 1, 3 + LootingLevel, IsOnFire() ? E_ITEM_STEAK : E_ITEM_RAW_BEEF); + unsigned int LootingLevel = 0; + if (a_Killer != nullptr) + { + LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting); + } + AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_LEATHER); + AddRandomDropItem(a_Drops, 1, 3 + LootingLevel, IsOnFire() ? E_ITEM_STEAK : E_ITEM_RAW_BEEF); } -void cCow::OnRightClicked(cPlayer & a_Player) +/* + * mobTodo behavior iTemReplacer + * void cCow::OnRightClicked(cPlayer & a_Player) { - super::OnRightClicked(a_Player); - - short HeldItem = a_Player.GetEquippedItem().m_ItemType; - if (HeldItem == E_ITEM_BUCKET) - { - if (!a_Player.IsGameModeCreative()) - { - a_Player.GetInventory().RemoveOneEquippedItem(); - a_Player.GetInventory().AddItem(E_ITEM_MILK); - } - } + super::OnRightClicked(a_Player); + + short HeldItem = a_Player.GetEquippedItem().m_ItemType; + if (HeldItem == E_ITEM_BUCKET) + { + if (!a_Player.IsGameModeCreative()) + { + a_Player.GetInventory().RemoveOneEquippedItem(); + a_Player.GetInventory().AddItem(E_ITEM_MILK); + } + } +}*/ + + + + + +cBehaviorBreeder * cCow::GetBehaviorBreeder() +{ + return &m_BehaviorBreeder; +} + + + + + +const cBehaviorBreeder * cCow::GetBehaviorBreeder() const +{ + return static_cast<const cBehaviorBreeder *>(&m_BehaviorBreeder); } diff --git a/src/Mobs/Cow.h b/src/Mobs/Cow.h index 7b3cdb56e..8f79e630f 100644 --- a/src/Mobs/Cow.h +++ b/src/Mobs/Cow.h @@ -7,23 +7,28 @@ -class cCow : - public cPassiveMonster +class cCow : public cMonster { - typedef cPassiveMonster super; - public: - cCow(); + cCow(); + + typedef cMonster super; + CLASS_PROTODEF(cCow) - CLASS_PROTODEF(cCow) + virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override; - virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override; - virtual void OnRightClicked(cPlayer & a_Player) override; + virtual void GetFollowedItems(cItems & a_Items) override + { + a_Items.Add(E_ITEM_WHEAT); + } - virtual void GetFollowedItems(cItems & a_Items) override - { - a_Items.Add(E_ITEM_WHEAT); - } + virtual cBehaviorBreeder * GetBehaviorBreeder() override; + virtual const cBehaviorBreeder * GetBehaviorBreeder() const override; +private: + cBehaviorBreeder m_BehaviorBreeder; + cBehaviorItemFollower m_BehaviorItemFollower; + cBehaviorCoward m_BehaviorCoward; + cBehaviorWanderer m_BehaviorWanderer; } ; diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index 9759bceb0..4ea80dee4 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -115,6 +115,7 @@ cMonster::cMonster(const AString & a_ConfigName, eMonsterType a_MobType, const A , m_Target(nullptr) , m_CurrentTickControllingBehavior(nullptr) , m_NewTickControllingBehavior(nullptr) + , m_TickControllingBehaviorState(Normal) { if (!a_ConfigName.empty()) { @@ -290,6 +291,7 @@ void cMonster::StopMovingToPosition() void cMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { + // LOGD("mobDebug - Monster tick begins"); m_NearestPlayerIsStale = true; super::Tick(a_Dt, a_Chunk); if (!IsTicking()) @@ -315,6 +317,8 @@ void cMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) // They MUST NOT control mob movement or interefere with the main Tick. for (cBehavior * Behavior : m_AttachedPreTickBehaviors) { + // LOGD("mobDebug - preTick"); + ASSERT(Behavior != nullptr); Behavior->PreTick(a_Dt, a_Chunk); } @@ -327,6 +331,7 @@ void cMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { // ask the behaviors sequentially if they are interested in controlling this mob // Stop at the first one that says yes. + m_NewTickControllingBehavior = nullptr; for (cBehavior * Behavior : m_AttachedTickBehaviors) { if (Behavior->IsControlDesired(a_Dt, a_Chunk)) @@ -340,8 +345,14 @@ void cMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { // The Behavior asking for control is the same as the behavior from last tick. // Nothing special, just tick it. + // LOGD("mobDebug - Tick"); m_CurrentTickControllingBehavior->Tick(a_Dt, a_Chunk); } + else if (m_CurrentTickControllingBehavior == nullptr) + { + // first behavior to ever control + m_TickControllingBehaviorState = NewControlStarting; + } else { // The behavior asking for control is not the same as the behavior from last tick. @@ -354,6 +365,7 @@ void cMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) // Make the current controlling behavior clean up if (m_TickControllingBehaviorState == OldControlEnding) { + ASSERT(m_CurrentTickControllingBehavior != nullptr); if (m_CurrentTickControllingBehavior->ControlEnding(a_Dt, a_Chunk)) { // The current behavior told us it is ready for letting go of control @@ -369,6 +381,7 @@ void cMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) // Make the new controlling behavior set up else if (m_TickControllingBehaviorState == NewControlStarting) { + ASSERT(m_NewTickControllingBehavior != nullptr); if (m_NewTickControllingBehavior->ControlStarting(a_Dt, a_Chunk)) { // The new behavior told us it is ready for taking control @@ -389,6 +402,7 @@ void cMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) // They MUST NOT control mob movement or interefere with the main Tick. for (cBehavior * Behavior : m_AttachedPostTickBehaviors) { + // LOGD("mobDebug - PostTick"); Behavior->PostTick(a_Dt, a_Chunk); } @@ -463,6 +477,7 @@ void cMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) m_World->BroadcastEntityMetadata(*this); } } + LOGD("mobDebug - Monster tick ends"); } @@ -608,7 +623,11 @@ bool cMonster::DoTakeDamage(TakeDamageInfo & a_TDI) m_World->BroadcastSoundEffect(m_SoundHurt, GetPosX(), GetPosY(), GetPosZ(), 1.0f, 0.8f); } - //mobTodo call all interested behaviors + for (cBehavior * Behavior : m_AttachedDoTakeDamageBehaviors) + { + ASSERT(Behavior != nullptr); + Behavior->DoTakeDamage(a_TDI); + } return true; } @@ -1015,15 +1034,6 @@ bool cMonster::IsPathFinderActivated() const -cBehaviorAggressive * cMonster::GetBehaviorAggressive() -{ - return nullptr; -} - - - - - cBehaviorBreeder * cMonster::GetBehaviorBreeder() { return nullptr; @@ -1051,24 +1061,6 @@ cBehaviorChaser * cMonster::GetBehaviorChaser() -cBehaviorStriker * cMonster::GetBehaviorStriker() -{ - return nullptr; -} - - - - - -cBehaviorWanderer * cMonster::GetBehaviorWanderer() -{ - return nullptr; -} - - - - - cBehaviorDayLightBurner * cMonster::GetBehaviorDayLightBurner() { return nullptr; diff --git a/src/Mobs/Monster.h b/src/Mobs/Monster.h index 44497723c..5db7ddee4 100644 --- a/src/Mobs/Monster.h +++ b/src/Mobs/Monster.h @@ -205,13 +205,10 @@ public: bool IsPathFinderActivated() const; // Behavior getters (most are probably not used. mobTodo - cleanup most of them) - virtual cBehaviorAggressive * GetBehaviorAggressive(); virtual cBehaviorBreeder * GetBehaviorBreeder(); virtual const cBehaviorBreeder * GetBehaviorBreeder() const; virtual cBehaviorChaser * GetBehaviorChaser(); - virtual cBehaviorStriker * GetBehaviorStriker(); - virtual cBehaviorWanderer * GetBehaviorWanderer(); - virtual cBehaviorDayLightBurner * GetBehaviorDayLightBurner(); + virtual cBehaviorDayLightBurner * GetBehaviorDayLightBurner(); // mobTodo this is probably temporary // Polymorphic behavior functions ("Skin-specific") virtual void InheritFromParents(cMonster * a_Parent1, cMonster * a_Parent2); diff --git a/src/Mobs/PassiveMonster.cpp b/src/Mobs/PassiveMonster.cpp index 8773e4f79..0b1349111 100644 --- a/src/Mobs/PassiveMonster.cpp +++ b/src/Mobs/PassiveMonster.cpp @@ -50,23 +50,6 @@ void cPassiveMonster::Destroyed() - - -cBehaviorBreeder * cPassiveMonster::GetBehaviorBreeder() -{ - return &m_BehaviorBreeder; -} - - - - - -const cBehaviorBreeder * cPassiveMonster::GetBehaviorBreeder() const -{ - return static_cast<const cBehaviorBreeder *>(&m_BehaviorBreeder); -} - - void cPassiveMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { super::Tick(a_Dt, a_Chunk); diff --git a/src/Mobs/PassiveMonster.h b/src/Mobs/PassiveMonster.h index 4a1d5513e..0c1d00a3e 100644 --- a/src/Mobs/PassiveMonster.h +++ b/src/Mobs/PassiveMonster.h @@ -11,26 +11,23 @@ typedef std::string AString; class cPassiveMonster : public cMonster { - typedef cMonster super; + typedef cMonster super; public: - cPassiveMonster(const AString & a_ConfigName, eMonsterType a_MobType, - const AString & a_SoundHurt, const AString & a_SoundDeath, - double a_Width, double a_Height); - virtual ~cPassiveMonster(); - virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; - virtual void OnRightClicked(cPlayer & a_Player) override; + cPassiveMonster(const AString & a_ConfigName, eMonsterType a_MobType, + const AString & a_SoundHurt, const AString & a_SoundDeath, + double a_Width, double a_Height); + virtual ~cPassiveMonster(); + virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; + virtual void OnRightClicked(cPlayer & a_Player) override; - /** When hit by someone, run away */ - virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override; + /** When hit by someone, run away */ + virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override; - virtual void Destroyed(void) override; - - virtual cBehaviorBreeder * GetBehaviorBreeder() override; - virtual const cBehaviorBreeder * GetBehaviorBreeder() const override; + virtual void Destroyed(void) override; private: - cBehaviorBreeder m_BehaviorBreeder; - cBehaviorItemFollower m_BehaviorItemFollower; - cBehaviorCoward m_BehaviorCoward; - cBehaviorWanderer m_BehaviorWanderer; + cBehaviorBreeder m_BehaviorBreeder; + cBehaviorItemFollower m_BehaviorItemFollower; + cBehaviorCoward m_BehaviorCoward; + cBehaviorWanderer m_BehaviorWanderer; }; |