mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added execution system, improved instant death
This commit is contained in:
parent
928ded0e66
commit
08a378bb2d
@ -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
|
||||
|
@ -19,6 +19,9 @@ PREP(leavingStateCardiacArrest);
|
||||
|
||||
PREP(enteredStateFatalInjury);
|
||||
|
||||
PREP(conditionExecutionDeath);
|
||||
PREP(transitionInstantDeathPrevented);
|
||||
|
||||
PREP(handleStateDefault);
|
||||
PREP(handleStateInjured);
|
||||
PREP(handleStateUnconscious);
|
||||
|
@ -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
|
||||
|
16
addons/medical/functions/fnc_conditionExecutionDeath.sqf
Normal file
16
addons/medical/functions/fnc_conditionExecutionDeath.sqf
Normal 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])}}
|
@ -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;
|
Loading…
Reference in New Issue
Block a user