diff options
author | Mat <mail@mathias.is> | 2020-03-05 11:52:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-05 11:52:34 +0100 |
commit | 7d4934534e9c58a111215859ba83c32a9bc0fa8a (patch) | |
tree | cb9af9fea3de762410cb49c62a030b96e01eec6c /src/Mobs/Monster.cpp | |
parent | Update LastSentPosition when entity has no speed (#4487) (diff) | |
download | cuberite-7d4934534e9c58a111215859ba83c32a9bc0fa8a.tar cuberite-7d4934534e9c58a111215859ba83c32a9bc0fa8a.tar.gz cuberite-7d4934534e9c58a111215859ba83c32a9bc0fa8a.tar.bz2 cuberite-7d4934534e9c58a111215859ba83c32a9bc0fa8a.tar.lz cuberite-7d4934534e9c58a111215859ba83c32a9bc0fa8a.tar.xz cuberite-7d4934534e9c58a111215859ba83c32a9bc0fa8a.tar.zst cuberite-7d4934534e9c58a111215859ba83c32a9bc0fa8a.zip |
Diffstat (limited to 'src/Mobs/Monster.cpp')
-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); |