Skip to content

Commit

Permalink
Optimize Entity.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Dec 13, 2017
1 parent 885ac4e commit 952d287
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/xrGame/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 952d287

Please sign in to comment.