mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-14 15:57:13 +00:00
fix(destroyable): resurrect only a dead player that isn't already resurrecting
RequestResurrect resurrected whoever sent it, so a living player could reset their health and imagination, and repeated requests stacked respawns. The client's destroyable resurrects only when smashed and not resurrecting (LWODestroyableComponent::SendMessage 0x00d29e40); live, all 17 requests in the captures came after the player's Die and before its Resurrect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1391,10 +1391,12 @@ void DestroyableComponent::Resurrect(Entity& entityRef) {
|
||||
// Add a half second in case someone decides to cheat and move during the death animation
|
||||
// and just make sure the client has time to be ready.
|
||||
constexpr float respawnTime = 3.66700005531311f + 0.5f;
|
||||
if (auto* const destroyable = entity->GetComponent<DestroyableComponent>()) destroyable->m_IsResurrecting = true;
|
||||
entity->AddCallbackTimer(respawnTime, [=]() {
|
||||
GameMessages::PlayerResurrectionFinished msg;
|
||||
entity->NotifyPlayerResurrectionFinished(msg);
|
||||
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||
if (destroyableComponent) destroyableComponent->m_IsResurrecting = false;
|
||||
|
||||
if (destroyableComponent != nullptr && entity->GetLOT() == 1) {
|
||||
destroyableComponent->SetIsDead(false);
|
||||
|
||||
Reference in New Issue
Block a user