diff options
Diffstat (limited to '')
-rw-r--r-- | src/Mobs/Monster.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index dfcd0dd6a..09f937564 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -132,12 +132,12 @@ cMonster::~cMonster() -void cMonster::Destroy(bool a_ShouldBroadcast) +void cMonster::OnRemoveFromWorld(cWorld & a_World) { if (IsLeashed()) { cEntity * LeashedTo = GetLeashedTo(); - Unleash(false, a_ShouldBroadcast); + Unleash(false, true); // Remove leash knot if there are no more mobs leashed to if (!LeashedTo->HasAnyMobLeashed() && LeashedTo->IsLeashKnot()) @@ -146,7 +146,7 @@ void cMonster::Destroy(bool a_ShouldBroadcast) } } - super::Destroy(a_ShouldBroadcast); + super::OnRemoveFromWorld(a_World); } @@ -282,7 +282,7 @@ void cMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) m_DestroyTimer += a_Dt; if (m_DestroyTimer > std::chrono::seconds(1)) { - Destroy(true); + Destroy(); } return; } @@ -590,6 +590,20 @@ bool cMonster::DoTakeDamage(TakeDamageInfo & a_TDI) +void cMonster::DoMoveToWorld(const cEntity::sWorldChangeInfo & a_WorldChangeInfo) +{ + // Stop all mobs from targeting this entity + // Stop this entity from targeting other mobs + SetTarget(nullptr); + StopEveryoneFromTargetingMe(); + + super::DoMoveToWorld(a_WorldChangeInfo); +} + + + + + void cMonster::KilledBy(TakeDamageInfo & a_TDI) { super::KilledBy(a_TDI); |