Handle kileld and disconnect while sitting

This commit is contained in:
jonpas 2015-06-09 18:52:12 +02:00
parent 5bfa2425bb
commit 51e83ba0fa
4 changed files with 37 additions and 1 deletions

View File

@ -4,9 +4,16 @@ class Extended_PreInit_EventHandlers {
}; };
}; };
class Extended_PostInit_EventHandlers { class Extended_PostInit_EventHandlers {
class ADDON { class ADDON {
clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit)); clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit));
}; };
}; };
class Extended_Killed_EventHandlers {
class CAManBase {
class ADDON {
killed = QUOTE(_this call DFUNC(handleInterrupt));
};
};
};

View File

@ -1,3 +1,7 @@
#include "script_component.hpp" #include "script_component.hpp"
// Add interaction menu exception
["isNotSitting", {!((_this select 0) getVariable [QGVAR(isSitting), false])}] call EFUNC(common,addCanInteractWithCondition); ["isNotSitting", {!((_this select 0) getVariable [QGVAR(isSitting), false])}] call EFUNC(common,addCanInteractWithCondition);
// Handle falling unconscious
["medical_onUnconscious", {_this call DFUNC(handleInterrupt)}] call EFUNC(common,addEventhandler);

View File

@ -5,6 +5,7 @@ ADDON = false;
PREP(canSit); PREP(canSit);
PREP(canStand); PREP(canStand);
PREP(getRandomAnimation); PREP(getRandomAnimation);
PREP(handleInterrupt);
PREP(moduleInit); PREP(moduleInit);
PREP(sit); PREP(sit);
PREP(stand); PREP(stand);

View File

@ -0,0 +1,24 @@
/*
* Author: Jonpas
* Handles interruptions of sitting, like killed or unconsciousness.
*
* Arguments:
* 0: Player <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player] call ace_sitting_fnc_handleInterrupt;
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_1(_player);
if (_player getVariable [QGVAR(isSitting), false]) then {
_player setVariable [QGVAR(isSitting), nil];
GVAR(seat) setVariable [QGVAR(seatOccupied), nil, true];
QGVAR(seat) = nil;
};