mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-13 19:58:21 +00:00
Fix zombie bug (#1014)
This commit is contained in:
parent
ff0336793c
commit
a532bc15d8
@ -915,15 +915,23 @@ void GameMessages::SendSetJetPackMode(Entity* entity, bool use, bool bypassCheck
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GameMessages::SendResurrect(Entity* entity) {
|
void GameMessages::SendResurrect(Entity* entity) {
|
||||||
DestroyableComponent* dest = static_cast<DestroyableComponent*>(entity->GetComponent(eReplicaComponentType::DESTROYABLE));
|
// Restore the players health after the animation for respawning has finished.
|
||||||
|
// This is when the health appered back in live, not immediately upon requesting respawn
|
||||||
|
// 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;
|
||||||
|
entity->AddCallbackTimer(respawnTime, [=]() {
|
||||||
|
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||||
|
|
||||||
if (dest != nullptr && entity->GetLOT() == 1) {
|
if (destroyableComponent != nullptr && entity->GetLOT() == 1) {
|
||||||
auto* levelComponent = entity->GetComponent<LevelProgressionComponent>();
|
auto* levelComponent = entity->GetComponent<LevelProgressionComponent>();
|
||||||
if (levelComponent) {
|
if (levelComponent) {
|
||||||
dest->SetHealth(levelComponent->GetLevel() >= 45 ? 8 : 4);
|
destroyableComponent->SetHealth(levelComponent->GetLevel() >= 45 ? 8 : 4);
|
||||||
dest->SetImagination(levelComponent->GetLevel() >= 45 ? 20 : 6);
|
destroyableComponent->SetImagination(levelComponent->GetLevel() >= 45 ? 20 : 6);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
|
|
||||||
auto cont = static_cast<ControllablePhysicsComponent*>(entity->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS));
|
auto cont = static_cast<ControllablePhysicsComponent*>(entity->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS));
|
||||||
if (cont && entity->GetLOT() == 1) {
|
if (cont && entity->GetLOT() == 1) {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include "ActPlayerDeathTrigger.h"
|
#include "ActPlayerDeathTrigger.h"
|
||||||
|
|
||||||
|
#include "Entity.h"
|
||||||
|
|
||||||
void ActPlayerDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
|
void ActPlayerDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||||
if (!target->IsPlayer() || target->GetIsDead() || !target->GetPlayerReadyForUpdates()) return; //Don't kill already dead players or players not ready
|
if (!target->IsPlayer() || target->GetIsDead() || !target->GetPlayerReadyForUpdates()) return; //Don't kill already dead players or players not ready
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user