Added execution system, improved instant death

This commit is contained in:
BaerMitUmlaut 2016-11-08 19:37:56 +01:00
parent 928ded0e66
commit 08a378bb2d
5 changed files with 54 additions and 1 deletions

View File

@ -68,6 +68,7 @@ class ACE_Medical_StateMachine {
events[] = {QGVAR(FatalInjuryInstantTransition)};
targetState = "CardiacArrest";
condition = QUOTE(!GVAR(enableInstantDeath));
onTransition = QUOTE(DFUNC(transitionInstantDeathPrevented));
};
class InstantDeath {
events[] = {QGVAR(FatalInjuryInstantTransition)};
@ -86,6 +87,11 @@ class ACE_Medical_StateMachine {
targetState = "Unconscious";
events[] = {QGVAR(CPRSucceeded)};
};
class Execution {
targetState = "Dead";
condition = QUOTE(DFUNC(conditionExecutionDeath));
events[] = {QGVAR(InjuryFatal)};
};
};
class Dead {
onStateEntered = "_this setDamage 1"; // killing a unit also exits the state machine for this unit

View File

@ -19,6 +19,9 @@ PREP(leavingStateCardiacArrest);
PREP(enteredStateFatalInjury);
PREP(conditionExecutionDeath);
PREP(transitionInstantDeathPrevented);
PREP(handleStateDefault);
PREP(handleStateInjured);
PREP(handleStateUnconscious);

View File

@ -46,10 +46,19 @@ GVAR(STATE_MACHINE) = (configFile >> "ACE_Medical_StateMachine") call CBA_statem
true
] call CBA_Settings_fnc_init;
[
QGVAR(enableExecutions),
"CHECKBOX",
["Enable Executions", "Enables killing units that are in cardiac arrest. Only matters when instant death is disabled."], //@todo
"ACE Medical", // @todo
true,
true
] call CBA_Settings_fnc_init;
[
QGVAR(maximumCardiacArrestTime),
"SLIDER",
["Maximum Cardiac Arrest Time", "Sets the maximum amount of time a unit can stay in cardiac arrest."], //@todo
["Maximum Cardiac Arrest Time", "Sets the maximum amount of time a unit can stay in cardiac arrest before dying."], //@todo
"ACE Medical", // @todo
[0, 30, 2, 0],
true

View File

@ -0,0 +1,16 @@
/*
* Author: BaerMitUmlaut
* Condition for an execution caused death.
*
* Arguments:
* 0: The Unit <OBJECT>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit"];
GVAR(enableInstantDeath) || {GVAR(enableExecutions) && {!(_unit getVariable [QGVAR(deathBlocked), false])}}

View File

@ -0,0 +1,19 @@
/*
* Author: BaerMitUmlaut
* Prevents instant death for 1 second.
*
* Arguments:
* 0: The Unit <OBJECT>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit"];
_unit setVariable [QGVAR(deathBlocked), true];
[{
_this setVariable [QGVAR(deathBlocked), false];
}, _unit, 1] call CBA_fnc_waitAndExecute;