diff options
Diffstat (limited to 'src/Mobs/Behaviors')
-rw-r--r-- | src/Mobs/Behaviors/BehaviorAttacker.cpp | 2 | ||||
-rw-r--r-- | src/Mobs/Behaviors/BehaviorAttacker.h | 2 | ||||
-rw-r--r-- | src/Mobs/Behaviors/BehaviorAttackerSuicideBomber.cpp | 15 | ||||
-rw-r--r-- | src/Mobs/Behaviors/BehaviorAttackerSuicideBomber.h | 2 |
4 files changed, 15 insertions, 6 deletions
diff --git a/src/Mobs/Behaviors/BehaviorAttacker.cpp b/src/Mobs/Behaviors/BehaviorAttacker.cpp index 0b6ce16f3..50ce8f6ad 100644 --- a/src/Mobs/Behaviors/BehaviorAttacker.cpp +++ b/src/Mobs/Behaviors/BehaviorAttacker.cpp @@ -101,7 +101,6 @@ void cBehaviorAttacker::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { if (TargetIsInStrikeRadius() && TargetIsInLineOfSight()) { - m_Parent->StopMovingToPosition(); StrikeIfReady(); } else @@ -209,6 +208,7 @@ void cBehaviorAttacker::Strike() m_IsStriking = true; m_StrikeTickCnt = 0; m_Parent->PinBehavior(this); + m_Parent->StopMovingToPosition(); } diff --git a/src/Mobs/Behaviors/BehaviorAttacker.h b/src/Mobs/Behaviors/BehaviorAttacker.h index de375d60e..82a377112 100644 --- a/src/Mobs/Behaviors/BehaviorAttacker.h +++ b/src/Mobs/Behaviors/BehaviorAttacker.h @@ -14,7 +14,7 @@ class cBehaviorAttacker : public cBehavior public: cBehaviorAttacker(); - void AttachToMonster(cMonster & a_Parent); + virtual void AttachToMonster(cMonster & a_Parent); // Our host monster will call these once it loads its config file diff --git a/src/Mobs/Behaviors/BehaviorAttackerSuicideBomber.cpp b/src/Mobs/Behaviors/BehaviorAttackerSuicideBomber.cpp index a704e77da..bab9fd88f 100644 --- a/src/Mobs/Behaviors/BehaviorAttackerSuicideBomber.cpp +++ b/src/Mobs/Behaviors/BehaviorAttackerSuicideBomber.cpp @@ -21,15 +21,27 @@ cBehaviorAttackerSuicideBomber::cBehaviorAttackerSuicideBomber() : +void cBehaviorAttackerSuicideBomber::AttachToMonster(cMonster & a_Parent) +{ + cBehaviorAttacker::AttachToMonster(a_Parent); + m_Parent->AttachRightClickBehavior(this); +} + + + + + bool cBehaviorAttackerSuicideBomber::DoStrike(int a_StrikeTickCnt) { UNUSED(a_StrikeTickCnt); + LOGD("Suicide doStrike"); // phase 1: start blowing up if (a_StrikeTickCnt == 1) { + LOGD("Suicide START"); ASSERT(!m_bIsBlowing); m_Parent->GetWorld()->BroadcastSoundEffect("entity.creeper.primed", m_Parent->GetPosX(), m_Parent->GetPosY(), m_Parent->GetPosZ(), 1.f, (0.75f + (static_cast<float>((m_Parent->GetUniqueID() * 23) % 32)) / 64)); @@ -72,9 +84,6 @@ void cBehaviorAttackerSuicideBomber::OnRightClicked(cPlayer & a_Player) } if (!m_BurnedWithFlintAndSteel) { - m_Parent->GetWorld()->BroadcastSoundEffect("entity.creeper.primed", m_Parent->GetPosX(), m_Parent->GetPosY(), m_Parent->GetPosZ(), 1.f, (0.75f + (static_cast<float>((m_Parent->GetUniqueID() * 23) % 32)) / 64)); - m_bIsBlowing = true; - m_Parent->GetWorld()->BroadcastEntityMetadata(*m_Parent); m_BurnedWithFlintAndSteel = true; Strike(); } diff --git a/src/Mobs/Behaviors/BehaviorAttackerSuicideBomber.h b/src/Mobs/Behaviors/BehaviorAttackerSuicideBomber.h index d635446c3..b9cb155e8 100644 --- a/src/Mobs/Behaviors/BehaviorAttackerSuicideBomber.h +++ b/src/Mobs/Behaviors/BehaviorAttackerSuicideBomber.h @@ -8,7 +8,7 @@ class cBehaviorAttackerSuicideBomber : public cBehaviorAttacker { public: cBehaviorAttackerSuicideBomber(); - + void AttachToMonster(cMonster & a_Parent) override; // cBehaviorAttacker also implements those and we need to call super on them void DoTakeDamage(TakeDamageInfo & a_TDI) override; |