Skip to content

Commit 952d287

Browse files
committed
Optimize Entity.cpp
1 parent 885ac4e commit 952d287

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/xrGame/Entity.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -254,20 +254,19 @@ void CEntity::net_Destroy()
254254

255255
void CEntity::KillEntity(u16 whoID, bool bypass_actor_check)
256256
{
257+
if (GameID() == eGameIDSingle && this->ID() == Actor()->ID())
258+
{
257259
//AVO: allow scripts to process actor condition and prevent actor's death or kill him if desired.
258260
//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
259261
// this will bypass below if block and go to normal KillEntity routine.
260262
#ifdef ACTOR_BEFORE_DEATH_CALLBACK
261-
if (IsGameTypeSingle() && this->ID() == Actor()->ID() && bypass_actor_check != true)
262-
{
263-
Actor()->callback(GameObject::eActorBeforeDeath)(whoID);
264-
return;
265-
}
263+
if (bypass_actor_check == false)
264+
{
265+
Actor()->callback(GameObject::eActorBeforeDeath)(whoID);
266+
return;
267+
}
266268
#endif
267269
//-AVO
268-
269-
if (GameID() == eGameIDSingle && this->ID() == Actor()->ID())
270-
{
271270
Actor()->detach_Vehicle();
272271
Actor()->use_MountedWeapon(nullptr);
273272
}

0 commit comments

Comments
 (0)