diff --git a/src/xrGame/Entity.cpp b/src/xrGame/Entity.cpp index 7398a988283..fc6c17c0fa4 100644 --- a/src/xrGame/Entity.cpp +++ b/src/xrGame/Entity.cpp @@ -254,20 +254,19 @@ void CEntity::net_Destroy() void CEntity::KillEntity(u16 whoID, bool bypass_actor_check) { + if (GameID() == eGameIDSingle && this->ID() == Actor()->ID()) + { //AVO: allow scripts to process actor condition and prevent actor's death or kill him if desired. //IMPORTANT: if you wish to kill actor you need to call db.actor:kill(level:object_by_id(whoID), true) in actor_before_death callback, to ensure all objects are properly destroyed // this will bypass below if block and go to normal KillEntity routine. #ifdef ACTOR_BEFORE_DEATH_CALLBACK - if (IsGameTypeSingle() && this->ID() == Actor()->ID() && bypass_actor_check != true) - { - Actor()->callback(GameObject::eActorBeforeDeath)(whoID); - return; - } + if (bypass_actor_check == false) + { + Actor()->callback(GameObject::eActorBeforeDeath)(whoID); + return; + } #endif //-AVO - - if (GameID() == eGameIDSingle && this->ID() == Actor()->ID()) - { Actor()->detach_Vehicle(); Actor()->use_MountedWeapon(nullptr); }