mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fix various namespace issues with medical
This commit is contained in:
parent
78d91edae2
commit
14db38e0f0
@ -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;
|
||||
};
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -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"];
|
||||
|
@ -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];
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
|
@ -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"];
|
||||
|
@ -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;
|
||||
|
@ -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};
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user