From a1f8ab763d5f8bbfdef692c4979067c8b6f942c9 Mon Sep 17 00:00:00 2001 From: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> Date: Sat, 25 Nov 2023 20:50:28 -0800 Subject: [PATCH] Entity: Fix death behavior of 0 (#1319) --- dGame/Entity.cpp | 4 ++-- dGame/Entity.h | 2 +- dGame/dComponents/DestroyableComponent.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dGame/Entity.cpp b/dGame/Entity.cpp index 23bf0577..4d4f5c10 100644 --- a/dGame/Entity.cpp +++ b/dGame/Entity.cpp @@ -1509,7 +1509,7 @@ void Entity::Smash(const LWOOBJID source, const eKillType killType, const std::u destroyableComponent->Smash(source, killType, deathType); } -void Entity::Kill(Entity* murderer) { +void Entity::Kill(Entity* murderer, const eKillType killType) { if (!m_PlayerIsReadyForUpdates) return; for (const auto& cb : m_DieCallbacks) { @@ -1533,7 +1533,7 @@ void Entity::Kill(Entity* murderer) { bool waitForDeathAnimation = false; if (destroyableComponent) { - waitForDeathAnimation = destroyableComponent->GetDeathBehavior() == 0; + waitForDeathAnimation = destroyableComponent->GetDeathBehavior() == 0 && killType != eKillType::SILENT; } // Live waited a hard coded 12 seconds for death animations of type 0 before networking destruction! diff --git a/dGame/Entity.h b/dGame/Entity.h index a5588c3e..cdc26838 100644 --- a/dGame/Entity.h +++ b/dGame/Entity.h @@ -210,7 +210,7 @@ public: void RequestActivityExit(Entity* sender, LWOOBJID player, bool canceled); void Smash(const LWOOBJID source = LWOOBJID_EMPTY, const eKillType killType = eKillType::VIOLENT, const std::u16string& deathType = u""); - void Kill(Entity* murderer = nullptr); + void Kill(Entity* murderer = nullptr, const eKillType killType = eKillType::SILENT); void AddRebuildCompleteCallback(const std::function& callback) const; void AddCollisionPhantomCallback(const std::function& callback); void AddDieCallback(const std::function& callback); diff --git a/dGame/dComponents/DestroyableComponent.cpp b/dGame/dComponents/DestroyableComponent.cpp index e98bc33b..ce3743e8 100644 --- a/dGame/dComponents/DestroyableComponent.cpp +++ b/dGame/dComponents/DestroyableComponent.cpp @@ -796,7 +796,7 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType } } - m_Parent->Kill(owner); + m_Parent->Kill(owner, killType); } void DestroyableComponent::SetFaction(int32_t factionID, bool ignoreChecks) {