From 14db38e0f01087e18cc5dc2e59428ee143ab7521 Mon Sep 17 00:00:00 2001 From: Thomas Kooi Date: Sun, 15 Jul 2018 15:00:16 +0200 Subject: [PATCH] Fix various namespace issues with medical --- .../functions/fnc_handleIncapacitation.sqf | 2 +- addons/medical_statemachine/Statemachine.hpp | 32 +++++++++---------- .../functions/fnc_enteredStateFatalInjury.sqf | 2 +- .../functions/fnc_handleStateUnconscious.sqf | 2 +- .../functions/fnc_getBloodLoss.sqf | 2 +- .../functions/fnc_getBloodVolumeChange.sqf | 10 +++--- .../functions/fnc_hasTourniquetAppliedTo.sqf | 2 +- .../medical_status/functions/fnc_initUnit.sqf | 30 ++++++++--------- .../functions/fnc_isInMedicalFacility.sqf | 4 +-- .../medical_status/functions/fnc_isMedic.sqf | 2 +- .../functions/fnc_isMedicalVehicle.sqf | 2 +- .../functions/fnc_handleUnitVitals.sqf | 10 +++--- 12 files changed, 50 insertions(+), 50 deletions(-) diff --git a/addons/medical/functions/fnc_handleIncapacitation.sqf b/addons/medical/functions/fnc_handleIncapacitation.sqf index 6bb9703c73..d59af87b00 100644 --- a/addons/medical/functions/fnc_handleIncapacitation.sqf +++ b/addons/medical/functions/fnc_handleIncapacitation.sqf @@ -34,5 +34,5 @@ private _damageThreshold = if (isPlayer _unit) then { }; if ((_headDamage > _damageThreshold / 2) || {_bodyDamage > _damageThreshold} || {(_painLevel >= PAIN_UNCONSCIOUS) && {random 1 < 0.1}}) then { - [QGVAR(CriticalInjury), _unit] call CBA_fnc_localEvent; + [QEGVAR(medical, CriticalInjury), _unit] call CBA_fnc_localEvent; }; diff --git a/addons/medical_statemachine/Statemachine.hpp b/addons/medical_statemachine/Statemachine.hpp index 489d2e2bb3..92182357df 100644 --- a/addons/medical_statemachine/Statemachine.hpp +++ b/addons/medical_statemachine/Statemachine.hpp @@ -8,38 +8,38 @@ class ACE_Medical_StateMachine { onState = QUOTE(call FUNC(handleStateDefault)); class Injury { targetState = "Injured"; - events[] = {QGVAR(Injury)}; + events[] = {QEGVAR(medical,Injury)}; }; class CriticalInjuryOrVitals { targetState = "Unconscious"; - events[] = {QGVAR(CriticalInjury), QGVAR(CriticalVitals), QGVAR(knockOut)}; + events[] = {QEGVAR(medical,CriticalInjury), QEGVAR(medical,CriticalVitals), QEGVAR(medical,knockOut)}; }; class FatalVitals { targetState = "CardiacArrest"; - events[] = {QGVAR(FatalVitals)}; + events[] = {QEGVAR(medical,FatalVitals)}; }; class FatalInjury { targetState = "FatalInjury"; - events[] = {QGVAR(FatalInjury)}; + events[] = {QEGVAR(medical,FatalInjury)}; }; }; class Injured { onState = QUOTE(call FUNC(handleStateInjured)); class FullHeal { targetState = "Default"; - events[] = {QGVAR(FullHeal)}; + events[] = {QEGVAR(medical,FullHeal)}; }; class CriticalInjuryOrVitals { targetState = "Unconscious"; - events[] = {QGVAR(CriticalInjury), QGVAR(CriticalVitals), QGVAR(knockOut)}; + events[] = {QEGVAR(medical,CriticalInjury), QEGVAR(medical,CriticalVitals), QEGVAR(medical,knockOut)}; }; class FatalVitals { targetState = "CardiacArrest"; - events[] = {QGVAR(FatalVitals)}; + events[] = {QEGVAR(medical,FatalVitals)}; }; class FatalInjury { targetState = "FatalInjury"; - events[] = {QGVAR(FatalInjury)}; + events[] = {QEGVAR(medical,FatalInjury)}; }; }; class Unconscious { @@ -52,16 +52,16 @@ class ACE_Medical_StateMachine { class WakeUp { targetState = "Injured"; condition = QUOTE(_this call EFUNC(medical_status,hasStableVitals)); - events[] = {QGVAR(WakeUp)}; + events[] = {QEGVAR(medical,WakeUp)}; onTransition = QUOTE([ARR_2(_this,(false))] call EFUNC(medical,setUnconsciousStatemachine)); }; class FatalTransitions { targetState = "CardiacArrest"; - events[] = {QGVAR(FatalVitals)}; + events[] = {QEGVAR(medical,FatalVitals)}; }; class FatalInjury { targetState = "FatalInjury"; - events[] = {QGVAR(FatalInjury)}; + events[] = {QEGVAR(medical,FatalInjury)}; }; }; class FatalInjury { @@ -69,18 +69,18 @@ class ACE_Medical_StateMachine { // This state raises the next transition in the same frame onStateEntered = QUOTE(call FUNC(enteredStateFatalInjury)); class DeathAI { - events[] = {QGVAR(FatalInjuryInstantTransition)}; + events[] = {QEGVAR(medical,FatalInjuryInstantTransition)}; targetState = "Dead"; condition = QUOTE(!isPlayer _this && {EGVAR(medical,fatalInjuryConditionAI)}); }; class SecondChance { - events[] = {QGVAR(FatalInjuryInstantTransition)}; + events[] = {QEGVAR(medical,FatalInjuryInstantTransition)}; targetState = "CardiacArrest"; condition = QUOTE(EGVAR(medical,fatalInjuryCondition) > 0); onTransition = QUOTE(call FUNC(transitionSecondChance)); }; class Death { - events[] = {QGVAR(FatalInjuryInstantTransition)}; + events[] = {QEGVAR(medical,FatalInjuryInstantTransition)}; targetState = "Dead"; condition = "true"; }; @@ -98,12 +98,12 @@ class ACE_Medical_StateMachine { }; class Reanimation { targetState = "Unconscious"; - events[] = {QGVAR(CPRSucceeded)}; + events[] = {QEGVAR(medical,CPRSucceeded)}; }; class Execution { targetState = "Dead"; condition = QUOTE(call EFUNC(medical,conditionExecutionDeath)); - events[] = {QGVAR(FatalInjury)}; + events[] = {QEGVAR(medical,FatalInjury)}; }; }; class Dead { diff --git a/addons/medical_statemachine/functions/fnc_enteredStateFatalInjury.sqf b/addons/medical_statemachine/functions/fnc_enteredStateFatalInjury.sqf index 2f9cbb654c..6c99129ecc 100644 --- a/addons/medical_statemachine/functions/fnc_enteredStateFatalInjury.sqf +++ b/addons/medical_statemachine/functions/fnc_enteredStateFatalInjury.sqf @@ -13,4 +13,4 @@ #include "script_component.hpp" params ["_unit"]; -[QGVAR(FatalInjuryInstantTransition), _unit] call CBA_fnc_localEvent; +[QEGVAR(medical,FatalInjuryInstantTransition), _unit] call CBA_fnc_localEvent; diff --git a/addons/medical_statemachine/functions/fnc_handleStateUnconscious.sqf b/addons/medical_statemachine/functions/fnc_handleStateUnconscious.sqf index d939f00fa2..852f5ec845 100644 --- a/addons/medical_statemachine/functions/fnc_handleStateUnconscious.sqf +++ b/addons/medical_statemachine/functions/fnc_handleStateUnconscious.sqf @@ -30,7 +30,7 @@ if (EGVAR(medical,spontaneousWakeUpChance) > 0) then { _unit setVariable [QGVAR(lastWakeUpCheck), CBA_missionTime]; if ((random 1) < EGVAR(medical,spontaneousWakeUpChance)) then { TRACE_1("Spontaneous wake up!",_unit); - [QGVAR(WakeUp), _unit] call CBA_fnc_localEvent; + [QEGVAR(medical,WakeUp), _unit] call CBA_fnc_localEvent; }; }; } else { diff --git a/addons/medical_status/functions/fnc_getBloodLoss.sqf b/addons/medical_status/functions/fnc_getBloodLoss.sqf index 3ce1790e8b..438a3d8f98 100644 --- a/addons/medical_status/functions/fnc_getBloodLoss.sqf +++ b/addons/medical_status/functions/fnc_getBloodLoss.sqf @@ -17,7 +17,7 @@ params ["_unit"]; -private _tourniquets = _unit getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; +private _tourniquets = _unit getVariable [QEGVAR(medical,tourniquets), [0,0,0,0,0,0]]; private _bodyPartBleeding = [0,0,0,0,0,0]; { _x params ["", "", "_bodyPart", "_amountOf", "_bleeeding"]; diff --git a/addons/medical_status/functions/fnc_getBloodVolumeChange.sqf b/addons/medical_status/functions/fnc_getBloodVolumeChange.sqf index 431a043aa0..ecbff35ef3 100644 --- a/addons/medical_status/functions/fnc_getBloodVolumeChange.sqf +++ b/addons/medical_status/functions/fnc_getBloodVolumeChange.sqf @@ -22,9 +22,9 @@ params ["_unit", "_deltaT", "_syncValues"]; private _bloodVolume = GET_BLOOD_VOLUME(_unit); private _bloodVolumeChange = -_deltaT * GET_BLOOD_LOSS(_unit); -if (!isNil {_unit getVariable QGVAR(ivBags)}) then { - private _bloodBags = _unit getVariable [QGVAR(ivBags), []]; - private _tourniquets = _unit getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; +if (!isNil {_unit getVariable QEGVAR(medical,ivBags)}) then { + private _bloodBags = _unit getVariable [QEGVAR(medical,ivBags), []]; + private _tourniquets = _unit getVariable [QEGVAR(medical,tourniquets), [0,0,0,0,0,0]]; _bloodBags = _bloodBags apply { _x params ["_bagVolumeRemaining", "_type", "_bodyPart"]; @@ -45,9 +45,9 @@ if (!isNil {_unit getVariable QGVAR(ivBags)}) then { _bloodBags = _bloodBags - [[]]; // remove empty bags if (_bloodBags isEqualTo []) then { - _unit setVariable [QGVAR(ivBags), nil, true]; // no bags left - clear variable (always globaly sync this) + _unit setVariable [QEGVAR(medical,ivBags), nil, true]; // no bags left - clear variable (always globaly sync this) } else { - _unit setVariable [QGVAR(ivBags), _bloodBags, _syncValues]; + _unit setVariable [QEGVAR(medical,ivBags), _bloodBags, _syncValues]; }; }; diff --git a/addons/medical_status/functions/fnc_hasTourniquetAppliedTo.sqf b/addons/medical_status/functions/fnc_hasTourniquetAppliedTo.sqf index 6d7b65caa4..10607f56b5 100644 --- a/addons/medical_status/functions/fnc_hasTourniquetAppliedTo.sqf +++ b/addons/medical_status/functions/fnc_hasTourniquetAppliedTo.sqf @@ -22,4 +22,4 @@ private _index = ALL_BODY_PARTS find toLower _bodyPart; if (_index < 0) exitWith { false }; -((_target getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]]) select _index) > 0 +((_target getVariable [QEGVAR(medical,tourniquets), [0,0,0,0,0,0]]) select _index) > 0 diff --git a/addons/medical_status/functions/fnc_initUnit.sqf b/addons/medical_status/functions/fnc_initUnit.sqf index 8416e2b385..92ddbf12e1 100644 --- a/addons/medical_status/functions/fnc_initUnit.sqf +++ b/addons/medical_status/functions/fnc_initUnit.sqf @@ -39,43 +39,43 @@ _unit setVariable [VAR_PAIN_SUPP, 0, true]; _unit setVariable [VAR_PAIN_SUPP_ADJ, [], true]; // - Wounds ------------------------------------------------------------------- -_unit setVariable [QGVAR(openWounds), [], true]; -_unit setVariable [QGVAR(bandagedWounds), [], true]; -_unit setVariable [QGVAR(stitchedWounds), [], true]; +_unit setVariable [QEGVAR(medical,openWounds), [], true]; +_unit setVariable [QEGVAR(medical,bandagedWounds), [], true]; +_unit setVariable [QEGVAR(medical,stitchedWounds), [], true]; _unit setVariable [QEGVAR(medical_engine,isLimping), false, true]; // - Misc --------------------------------------------------------------------- _unit setVariable [VAR_UNCON, false, true]; // - Treatments --------------------------------------------------------------- -_unit setVariable [QGVAR(tourniquets), [0,0,0,0,0,0], true]; -_unit setVariable [QGVAR(occludedMedications), nil, true]; //Delayed Medications (from tourniquets) -_unit setVariable [QGVAR(ivBags), nil, true]; -_unit setVariable [QGVAR(partialHealCounter), 0, true]; +_unit setVariable [QEGVAR(medical,tourniquets), [0,0,0,0,0,0], true]; +_unit setVariable [QEGVAR(medical,occludedMedications), nil, true]; //Delayed Medications (from tourniquets) +_unit setVariable [QEGVAR(medical,ivBags), nil, true]; +_unit setVariable [QEGVAR(medical,partialHealCounter), 0, true]; // triage card and logs -_unit setVariable [QGVAR(triageLevel), 0, true]; -_unit setVariable [QGVAR(triageCard), [], true]; +_unit setVariable [QEGVAR(medical,triageLevel), 0, true]; +_unit setVariable [QEGVAR(medical,triageCard), [], true]; // damage storage -_unit setVariable [QGVAR(bodyPartDamage), [0,0,0,0,0,0], true]; +_unit setVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0], true]; #ifdef DEBUG_TESTRESULTS -_unit setVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0], true]; +_unit setVariable [QEGVAR(medical,bodyPartStatus), [0,0,0,0,0,0], true]; #endif // medication -private _allUsedMedication = _unit getVariable [QGVAR(allUsedMedication), []]; +private _allUsedMedication = _unit getVariable [QEGVAR(medical,allUsedMedication), []]; { _unit setVariable [_x select 0, nil]; } forEach _allUsedMedication; -_unit setVariable [QGVAR(allUsedMedication), [], true]; +_unit setVariable [QEGVAR(medical,allUsedMedication), [], true]; // TODO move to treatment -private _logs = _unit getVariable [QGVAR(allLogs), []]; +private _logs = _unit getVariable [QEGVAR(medical,allLogs), []]; { _unit setVariable [_x, nil]; } forEach _logs; -_unit setVariable [QGVAR(allLogs), [], true]; +_unit setVariable [QEGVAR(medical,allLogs), [], true]; [{ params ["_unit"]; diff --git a/addons/medical_status/functions/fnc_isInMedicalFacility.sqf b/addons/medical_status/functions/fnc_isInMedicalFacility.sqf index 52b5ec01c8..4648b0e3c8 100644 --- a/addons/medical_status/functions/fnc_isInMedicalFacility.sqf +++ b/addons/medical_status/functions/fnc_isInMedicalFacility.sqf @@ -44,14 +44,14 @@ private _medicalFacility = private _objects = (lineIntersectsWith [_unit modelToWorldVisual [0, 0, (_eyePos select 2)], _unit modelToWorldVisual [0, 0, (_eyePos select 2) +10], _unit]); { - if (((typeOf _x) in _medicalFacility) || (_x getVariable [QGVAR(isMedicalFacility),false])) exitWith { + if (((typeOf _x) in _medicalFacility) || (_x getVariable [QEGVAR(medical,isMedicalFacility),false])) exitWith { _isInBuilding = true; }; } forEach _objects; if (!_isInBuilding) then { _objects = _unit nearObjects 7.5; { - if (((typeOf _x) in _medicalFacility) || (_x getVariable [QGVAR(isMedicalFacility),false])) exitWith { + if (((typeOf _x) in _medicalFacility) || (_x getVariable [QEGVAR(medical,isMedicalFacility),false])) exitWith { _isInBuilding = true; }; } forEach _objects; diff --git a/addons/medical_status/functions/fnc_isMedic.sqf b/addons/medical_status/functions/fnc_isMedic.sqf index 4de3b3c105..6fc86b6bdc 100644 --- a/addons/medical_status/functions/fnc_isMedic.sqf +++ b/addons/medical_status/functions/fnc_isMedic.sqf @@ -19,7 +19,7 @@ params ["_unit", ["_medicN", 1]]; -private _class = _unit getVariable [QGVAR(medicClass), [0, 1] select (_unit getUnitTrait "medic")]; +private _class = _unit getVariable [QEGVAR(medical,medicClass), [0, 1] select (_unit getUnitTrait "medic")]; if (_class >= _medicN min EGVAR(medical,medicSetting)) exitWith {true}; if (!EGVAR(medical,increaseTrainingInLocations)) exitWith {false}; diff --git a/addons/medical_status/functions/fnc_isMedicalVehicle.sqf b/addons/medical_status/functions/fnc_isMedicalVehicle.sqf index 92539feaa2..c0118397a2 100644 --- a/addons/medical_status/functions/fnc_isMedicalVehicle.sqf +++ b/addons/medical_status/functions/fnc_isMedicalVehicle.sqf @@ -17,4 +17,4 @@ params ["_vehicle"]; -(_vehicle getVariable [QGVAR(medicClass), getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "attendant")]) > 0 +(_vehicle getVariable [QEGVAR(medical,medicClass), getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "attendant")]) > 0 diff --git a/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf b/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf index 1748e75746..a08b47737a 100644 --- a/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf @@ -52,7 +52,7 @@ private _bloodLoss = GET_BLOOD_LOSS(_unit); if (_bloodLoss > 0) then { _unit setVariable [QGVAR(bloodloss), _bloodLoss, _syncValues]; - [QGVAR(Injury), _unit] call CBA_fnc_localEvent; + [QEGVAR(medical, Injury), _unit] call CBA_fnc_localEvent; if !IS_BLEEDING(_unit) then { _unit setVariable [VAR_IS_BLEEDING, true, true]; @@ -70,7 +70,7 @@ if !(_inPain isEqualTo IS_IN_PAIN(_unit)) then { // Handle pain due tourniquets, that have been applied more than 120 s ago private _tourniquetPain = 0; -private _tourniquets = _unit getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; +private _tourniquets = _unit getVariable [QEGVAR(medical,tourniquets), [0,0,0,0,0,0]]; { if (_x > 0 && {CBA_missionTime - _x > 120}) then { _tourniquetPain = _tourniquetPain max (CBA_missionTime - _x - 120) * 0.001; @@ -87,7 +87,7 @@ _unit setVariable [VAR_BLOOD_PRESS, _bloodPressure, _syncValues]; private _cardiacOutput = [_unit] call EFUNC(medical_status,getCardiacOutput); if (_bloodLoss > BLOOD_LOSS_KNOCK_OUT_THRESHOLD * _cardiacOutput) then { - [QGVAR(CriticalVitals), _unit] call CBA_fnc_localEvent; + [QEGVAR(medical, CriticalVitals), _unit] call CBA_fnc_localEvent; }; #ifdef DEBUG_MODE_FULL @@ -98,10 +98,10 @@ if (!isPlayer _unit) then { _bloodPressure params ["_bloodPressureL", "_bloodPressureH"]; if (_bloodPressureL < 40 || {_heartRate < 30}) then { - [QGVAR(CriticalVitals), _unit] call CBA_fnc_localEvent; + [QEGVAR(medical, CriticalVitals), _unit] call CBA_fnc_localEvent; }; if ((_heartRate < 20) || {_heartRate > 220} || {_bloodPressureH < 50}) then { - [QGVAR(FatalVitals), _unit] call CBA_fnc_localEvent; + [QEGVAR(medical, FatalVitals), _unit] call CBA_fnc_localEvent; }; END_COUNTER(Vitals);