From 952d28743b706ef131bc789f8923132ee7e88cdf Mon Sep 17 00:00:00 2001 From: Xottab-DUTY Date: Wed, 13 Dec 2017 15:14:26 +0500 Subject: [PATCH] Optimize Entity.cpp --- src/xrGame/Entity.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) 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); }