Clean up unconscious and revive states

This commit is contained in:
Glowbal 2016-07-07 12:57:21 +02:00
parent 2daee60d0c
commit 7157fcf420
3 changed files with 7 additions and 15 deletions

View File

@ -1,8 +1,6 @@
class ACE_Medical_StateMachine {
class Default {
onState = QUOTE(DFUNC(handleStateDefault));
onStateEntered = "";
onStateLeaving = "";
class Injury {
targetState = "Injured";
events[] = {"TakenInjury"};
@ -18,9 +16,6 @@ class ACE_Medical_StateMachine {
};
class Injured {
onState = QUOTE(DFUNC(handleStateInjured));
onStateEntered = "";
onStateLeaving = "";
class FullHeal {
targetState = "Default";
events[] = {"FullHeal"};
@ -40,8 +35,8 @@ class ACE_Medical_StateMachine {
};
class Unconscious {
onState = QUOTE(DFUNC(handleStateUnconscious));
onStateEntered = QUOTE(DFUNC(enteredUnconscious)); // set unconscious animation & state
onStateLeaving = QUOTE(DFUNC(leavingUnconscious)); // leave unconscious animation & state
onStateEntered = QUOTE(DFUNC(enteredUnconsciousState));
onStateLeaving = "_unit setVariable ['ACE_isUnconscious', false, true];";
class WakeUpFromKnockDown {
targetState = "Injured";
condition = QUOTE(_unit call FUNC(hasStableVitals));
@ -67,18 +62,14 @@ class ACE_Medical_StateMachine {
class FullHeal {
targetState = "Default";
events[] = {"fullyHealed"};
onTransition = "";
};
class Revived {
targetState = "Injured";
events[] = {"Revived"};
onTransition = "";
};
class TimerRanOut {
targetState = "Dead";
condition = "";
events[] = {"ReviveTimer"};
onTransition = "";
events[] = {"ReviveTimer", "NoLives"};
};
class FatalTransitions {
targetState = "Dead";

View File

@ -7,7 +7,7 @@ params ["_unit", "_stateName", "_lastTime"];
if (!alive _unit) exitWith {};
// If locality changed, broadcast the last medical state and finish the local loop
if (!local _unit) eexitWith{
if (!local _unit) exitWith {
if (GVAR(level) >= 2) then {
_unit setVariable [QGVAR(heartRate), _unit getVariable [QGVAR(heartRate), 80], true];
_unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true];

View File

@ -36,7 +36,7 @@ if (!alive _unit) exitWith {
[_unit, "setCaptive", "ace_unconscious", false] call EFUNC(common,statusEffect_set);
[_unit, false] call EFUNC(common,disableAI);
//_unit setUnitPos _originalPos;
_unit setUnconscious false;
//_unit setUnconscious false;
[_unit, "isUnconscious"] call EFUNC(common,unmuteUnit);
["ace_unconscious", [_unit, false]] call CBA_fnc_globalEvent;
@ -139,6 +139,7 @@ if (!local _unit) exitWith {
if ((CBA_missionTime - _startingTime) >= _minWaitingTime) exitWith {
TRACE_2("ACE_DEBUG_Unconscious_Temp knock outs",_unit, [_unit] call FUNC(getUnconsciousCondition));
if (!([_unit] call FUNC(getUnconsciousCondition))) then {
_unit setVariable ["ACE_isUnconscious", false, true];
//_unit setVariable ["ACE_isUnconscious", false, true];
[_unit, "MinUnconsciousTimer", []] call FUNC(stateEvent);
};
};