diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index c716620c9c..4d677746f8 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -51,11 +51,11 @@ if (!hasInterface) exitWith {}; uiNamespace setVariable [QGVAR(debugControl), _ctrl]; [{ - private _playerState = [ACE_player, GVAR(STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState; + private _playerState = [ACE_player, EGVAR(medical,STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState; (uiNamespace getVariable [QGVAR(debugControl), controlNull]) ctrlSetText format ["Player state: %1", _playerState]; if (!isNull cursorTarget && {cursorTarget isKindOf "CAManBase"}) then { - private _targetState = [cursorTarget, GVAR(STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState; + private _targetState = [cursorTarget, EGVAR(medical,STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState; drawIcon3D ["", [0.6, 0, 0, 1], cursorTarget modelToWorldVisual (cursorTarget selectionPosition "pelvis"), 0, 0, 0, format ["State: %1", _targetState], 2, 40 * pixelH, "RobotoCondensed"]; }; }, 0 ,[]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/medical/XEH_preInit.sqf b/addons/medical/XEH_preInit.sqf index 82f8321552..271a21a797 100644 --- a/addons/medical/XEH_preInit.sqf +++ b/addons/medical/XEH_preInit.sqf @@ -9,8 +9,6 @@ PREP_RECOMPILE_END; GVAR(HITPOINTS) = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; GVAR(SELECTIONS) = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]; -GVAR(STATE_MACHINE) = (configFile >> "ACE_Medical_StateMachine") call CBA_statemachine_fnc_createFromConfig; - /* [ QGVAR(advancedBandages), diff --git a/addons/medical/functions/fnc_dev_watchMedicalStats.sqf b/addons/medical/functions/fnc_dev_watchMedicalStats.sqf index 30335eb1b0..4bec01ea1b 100644 --- a/addons/medical/functions/fnc_dev_watchMedicalStats.sqf +++ b/addons/medical/functions/fnc_dev_watchMedicalStats.sqf @@ -34,7 +34,7 @@ // State: private _hasStableVitals = [_unit] call EFUNC(medical_status,hasStableVitals); - private _targetState = [_unit, GVAR(STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState; + private _targetState = [_unit, EGVAR(medical,STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState; if (!local _unit) then {_targetState = "NotLocal";}; private _color = switch (_targetState) do {case "Default": {"33FF33"}; case "Injured": {"FF3333"}; case "Unconscious": {"FF8833"}; case "CardiacArrest": {"FF33AA"}; default {"555555"}}; private _unconcFlag = if IS_UNCONSCIOUS(_unit) then {"[U]"} else {""}; diff --git a/addons/medical/functions/fnc_getUnitState.sqf b/addons/medical/functions/fnc_getUnitState.sqf index 6821124e32..3de149e2bb 100644 --- a/addons/medical/functions/fnc_getUnitState.sqf +++ b/addons/medical/functions/fnc_getUnitState.sqf @@ -19,4 +19,4 @@ params ["_unit"]; if (!local _unit) exitWith { ERROR("unit is not local"); }; -[_unit, GVAR(STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState +[_unit, EGVAR(medical,STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState diff --git a/addons/medical_ai/StateMachine.hpp b/addons/medical_ai/StateMachine.hpp index 36642fbab3..89bacf3036 100644 --- a/addons/medical_ai/StateMachine.hpp +++ b/addons/medical_ai/StateMachine.hpp @@ -5,7 +5,7 @@ class GVAR(stateMachine) { class Initial { class Injured { targetState = "Injured"; - condition = QUOTE(call FUNC(isInjured)); + condition = QFUNC(isInjured); }; class HealUnit { targetState = "HealUnit"; @@ -20,7 +20,7 @@ class GVAR(stateMachine) { class InSafety { targetState = "Safe"; - condition = QUOTE(call FUNC(isSafe)); + condition = QFUNC(isSafe); }; }; @@ -31,8 +31,8 @@ class GVAR(stateMachine) { class RequestMedic { targetState = "HealSelf"; - condition = QUOTE(call FUNC(canRequestMedic)); - onTransition = QUOTE(call FUNC(requestMedic)); + condition = QFUNC(canRequestMedic); + onTransition = QFUNC(requestMedic); }; class HealSelf { targetState = "HealSelf"; @@ -41,7 +41,7 @@ class GVAR(stateMachine) { }; class HealSelf { - onState = QUOTE(call FUNC(healSelf)); + onState = QFUNC(healSelf); onStateLeaving = QUOTE(_this setVariable [ARR_2(QUOTE(QGVAR(treatmentOverAt)),nil)]); class Initial { @@ -63,7 +63,7 @@ class GVAR(stateMachine) { }; class HealUnit { - onState = QUOTE(call FUNC(healUnit)); + onState = QFUNC(healUnit); onStateLeaving = QUOTE(_this setVariable [ARR_2(QUOTE(QGVAR(treatmentOverAt)),nil)]); class Initial { diff --git a/addons/medical_statemachine/Statemachine.hpp b/addons/medical_statemachine/Statemachine.hpp index 92182357df..599481856d 100644 --- a/addons/medical_statemachine/Statemachine.hpp +++ b/addons/medical_statemachine/Statemachine.hpp @@ -5,7 +5,7 @@ class ACE_Medical_StateMachine { skipNull = 1; class Default { - onState = QUOTE(call FUNC(handleStateDefault)); + onState = QFUNC(handleStateDefault); class Injury { targetState = "Injured"; events[] = {QEGVAR(medical,Injury)}; @@ -24,7 +24,7 @@ class ACE_Medical_StateMachine { }; }; class Injured { - onState = QUOTE(call FUNC(handleStateInjured)); + onState = QFUNC(handleStateInjured); class FullHeal { targetState = "Default"; events[] = {QEGVAR(medical,FullHeal)}; @@ -43,7 +43,7 @@ class ACE_Medical_StateMachine { }; }; class Unconscious { - onState = QUOTE(call FUNC(handleStateUnconscious)); + onState = QFUNC(handleStateUnconscious); onStateEntered = QUOTE([ARR_2(_this,(true))] call EFUNC(medical,setUnconsciousStatemachine)); class DeathAI { targetState = "Dead"; @@ -51,7 +51,7 @@ class ACE_Medical_StateMachine { }; class WakeUp { targetState = "Injured"; - condition = QUOTE(_this call EFUNC(medical_status,hasStableVitals)); + condition = QEFUNC(medical_status,hasStableVitals); events[] = {QEGVAR(medical,WakeUp)}; onTransition = QUOTE([ARR_2(_this,(false))] call EFUNC(medical,setUnconsciousStatemachine)); }; @@ -67,7 +67,7 @@ class ACE_Medical_StateMachine { class FatalInjury { // Transition state for handling instant death // This state raises the next transition in the same frame - onStateEntered = QUOTE(call FUNC(enteredStateFatalInjury)); + onStateEntered = QFUNC(enteredStateFatalInjury); class DeathAI { events[] = {QEGVAR(medical,FatalInjuryInstantTransition)}; targetState = "Dead"; @@ -77,7 +77,7 @@ class ACE_Medical_StateMachine { events[] = {QEGVAR(medical,FatalInjuryInstantTransition)}; targetState = "CardiacArrest"; condition = QUOTE(EGVAR(medical,fatalInjuryCondition) > 0); - onTransition = QUOTE(call FUNC(transitionSecondChance)); + onTransition = QFUNC(transitionSecondChance); }; class Death { events[] = {QEGVAR(medical,FatalInjuryInstantTransition)}; @@ -86,15 +86,15 @@ class ACE_Medical_StateMachine { }; }; class CardiacArrest { - onStateEntered = QUOTE(call FUNC(enteredStateCardiacArrest)); - onStateLeaving = QUOTE(call FUNC(leftStateCardiacArrest)); + onStateEntered = QFUNC(enteredStateCardiacArrest); + onStateLeaving = QFUNC(leftStateCardiacArrest); class DeathAI { targetState = "Dead"; condition = QUOTE(!isPlayer _this && {EGVAR(medical,fatalInjuryConditionAI)}); }; class Timeout { targetState = "Dead"; - condition = QUOTE(call EFUNC(medical,conditionCardiacArrestTimer)); + condition = QEFUNC(medical,conditionCardiacArrestTimer); }; class Reanimation { targetState = "Unconscious"; @@ -102,7 +102,7 @@ class ACE_Medical_StateMachine { }; class Execution { targetState = "Dead"; - condition = QUOTE(call EFUNC(medical,conditionExecutionDeath)); + condition = QEFUNC(medical,conditionExecutionDeath); events[] = {QEGVAR(medical,FatalInjury)}; }; }; diff --git a/addons/medical_statemachine/XEH_preInit.sqf b/addons/medical_statemachine/XEH_preInit.sqf index a7feade1c3..279b11a23f 100644 --- a/addons/medical_statemachine/XEH_preInit.sqf +++ b/addons/medical_statemachine/XEH_preInit.sqf @@ -4,4 +4,6 @@ ADDON = false; #include "XEH_PREP.hpp" +EGVAR(medical,STATE_MACHINE) = (configFile >> "ACE_Medical_StateMachine") call CBA_statemachine_fnc_createFromConfig; + ADDON = true; diff --git a/addons/medical_statemachine/functions/fnc_handleStateInjured.sqf b/addons/medical_statemachine/functions/fnc_handleStateInjured.sqf index 5156670201..d9d7398b80 100644 --- a/addons/medical_statemachine/functions/fnc_handleStateInjured.sqf +++ b/addons/medical_statemachine/functions/fnc_handleStateInjured.sqf @@ -19,3 +19,4 @@ private _painLevel = GET_PAIN_PERCEIVED(_unit); if (_painLevel > 0) then { [_unit, "moan", PAIN_TO_MOAN(_painLevel)] call EFUNC(medical_engine,playInjuredSound); }; +