Skip to content

Commit

Permalink
Put Actor before death callback into ifdef block
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Dec 12, 2017
1 parent e6253a5 commit c99361a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Common/Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

// TWEAKS:
//#define FP_DEATH // first person death view
//#define ACTOR_BEFORE_DEATH_CALLBACK
#define DEAD_BODY_COLLISION // restore collision with dead bodies (thanks malandrinus)
#define NEW_ANIMS // use new animations. Please enclose any new animation addions with this define
#define NEW_SOUNDS // use new sounds. Please enclose any new sound addions with this define
Expand Down
2 changes: 2 additions & 0 deletions src/xrGame/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,13 @@ void CEntity::KillEntity(u16 whoID, bool bypass_actor_check)
//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;
}
#endif
//-AVO

if (this->ID() == Actor()->ID())
Expand Down
2 changes: 2 additions & 0 deletions src/xrGame/game_object_space.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ enum ECallbackType
eItemToSlot,
eItemToRuck,
// Actor
#ifdef ACTOR_BEFORE_DEATH_CALLBACK
eActorBeforeDeath,
#endif
//-AVO

eDummy = u32(-1),
Expand Down
2 changes: 2 additions & 0 deletions src/xrGame/script_game_object_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ SCRIPT_EXPORT(CScriptGameObject, (), {
value("item_to_slot", int(GameObject::eItemToSlot)),
value("item_to_ruck", int(GameObject::eItemToRuck)),
// Actor
#ifdef ACTOR_BEFORE_DEATH_CALLBACK
value("actor_before_death", int(GameObject::eActorBeforeDeath)),
#endif
//-AVO

value("map_location_added", int(GameObject::eMapLocationAdded))],
Expand Down

0 comments on commit c99361a

Please sign in to comment.