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

View File

@ -7,7 +7,7 @@ params ["_unit", "_stateName", "_lastTime"];
if (!alive _unit) exitWith {}; if (!alive _unit) exitWith {};
// If locality changed, broadcast the last medical state and finish the local loop // 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 { if (GVAR(level) >= 2) then {
_unit setVariable [QGVAR(heartRate), _unit getVariable [QGVAR(heartRate), 80], true]; _unit setVariable [QGVAR(heartRate), _unit getVariable [QGVAR(heartRate), 80], true];
_unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], 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, "setCaptive", "ace_unconscious", false] call EFUNC(common,statusEffect_set);
[_unit, false] call EFUNC(common,disableAI); [_unit, false] call EFUNC(common,disableAI);
//_unit setUnitPos _originalPos; //_unit setUnitPos _originalPos;
_unit setUnconscious false; //_unit setUnconscious false;
[_unit, "isUnconscious"] call EFUNC(common,unmuteUnit); [_unit, "isUnconscious"] call EFUNC(common,unmuteUnit);
["ace_unconscious", [_unit, false]] call CBA_fnc_globalEvent; ["ace_unconscious", [_unit, false]] call CBA_fnc_globalEvent;
@ -139,6 +139,7 @@ if (!local _unit) exitWith {
if ((CBA_missionTime - _startingTime) >= _minWaitingTime) exitWith { if ((CBA_missionTime - _startingTime) >= _minWaitingTime) exitWith {
TRACE_2("ACE_DEBUG_Unconscious_Temp knock outs",_unit, [_unit] call FUNC(getUnconsciousCondition)); TRACE_2("ACE_DEBUG_Unconscious_Temp knock outs",_unit, [_unit] call FUNC(getUnconsciousCondition));
if (!([_unit] call FUNC(getUnconsciousCondition))) then { if (!([_unit] call FUNC(getUnconsciousCondition))) then {
_unit setVariable ["ACE_isUnconscious", false, true]; //_unit setVariable ["ACE_isUnconscious", false, true];
[_unit, "MinUnconsciousTimer", []] call FUNC(stateEvent);
}; };
}; };