From cbdd5d9bc68a76f583184634aa1bf010113a78e1 Mon Sep 17 00:00:00 2001 From: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> Date: Thu, 9 Oct 2025 23:15:21 -0700 Subject: [PATCH] fix: dying while dead (#1905) --- dGame/dComponents/DestroyableComponent.cpp | 3 +++ dGame/dComponents/DestroyableComponent.h | 2 ++ dGame/dGameMessages/GameMessages.cpp | 1 + 3 files changed, 6 insertions(+) diff --git a/dGame/dComponents/DestroyableComponent.cpp b/dGame/dComponents/DestroyableComponent.cpp index e03efd43..49b88cf4 100644 --- a/dGame/dComponents/DestroyableComponent.cpp +++ b/dGame/dComponents/DestroyableComponent.cpp @@ -694,6 +694,8 @@ void DestroyableComponent::NotifySubscribers(Entity* attacker, uint32_t damage) } void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType, const std::u16string& deathType, uint32_t skillID) { + if (m_IsDead) return; + //check if hardcore mode is enabled if (Game::entityManager->GetHardcoreMode()) { DoHardcoreModeDrops(source); @@ -706,6 +708,7 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType Game::entityManager->SerializeEntity(m_Parent); } + m_IsDead = true; m_KillerID = source; auto* owner = Game::entityManager->GetEntity(source); diff --git a/dGame/dComponents/DestroyableComponent.h b/dGame/dComponents/DestroyableComponent.h index 2984147a..c6bb0a98 100644 --- a/dGame/dComponents/DestroyableComponent.h +++ b/dGame/dComponents/DestroyableComponent.h @@ -471,6 +471,8 @@ public: bool OnGetObjectReportInfo(GameMessages::GameMsg& msg); bool OnSetFaction(GameMessages::GameMsg& msg); + void SetIsDead(const bool value) { m_IsDead = value; } + static Implementation IsEnemyImplentation; static Implementation IsFriendImplentation; diff --git a/dGame/dGameMessages/GameMessages.cpp b/dGame/dGameMessages/GameMessages.cpp index 08261a23..fffa52b9 100644 --- a/dGame/dGameMessages/GameMessages.cpp +++ b/dGame/dGameMessages/GameMessages.cpp @@ -978,6 +978,7 @@ void GameMessages::SendResurrect(Entity* entity) { auto* destroyableComponent = entity->GetComponent(); if (destroyableComponent != nullptr && entity->GetLOT() == 1) { + destroyableComponent->SetIsDead(false); auto* levelComponent = entity->GetComponent(); if (levelComponent) { int32_t healthToRestore = levelComponent->GetLevel() >= 45 ? 8 : 4;