mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Use macros for status state variables
This commit is contained in:
parent
ff33f8e954
commit
c9e11e62a1
@ -64,6 +64,7 @@
|
||||
// Defined here for easy consistency with GETVAR/SETVAR (also a list for reference)
|
||||
#define VAR_BLOOD_PRESS QEGVAR(medical,bloodPressure)
|
||||
#define VAR_BLOOD_VOL QEGVAR(medical,bloodVolume)
|
||||
#define VAR_CRDC_ARRST QEGVAR(medical,inCardiacArrest)
|
||||
#define VAR_HEART_RATE QEGVAR(medical,heartRate)
|
||||
#define VAR_PAIN QEGVAR(medical,pain)
|
||||
#define VAR_PAIN_SUPP QEGVAR(medical,painSuppress)
|
||||
@ -71,6 +72,9 @@
|
||||
// These variables track gradual adjustments (from medication, etc.)
|
||||
#define VAR_HEART_RATE_ADJ QEGVAR(medical,heartRateAdjustments)
|
||||
#define VAR_PAIN_SUPP_ADJ QEGVAR(medical,painSuppressAdjustments)
|
||||
// These variables track the current state of status values
|
||||
#define VAR_IN_PAIN QEGVAR(medical,inPain)
|
||||
#define VAR_IS_BLEEDING QEGVAR(medical,isBleeding)
|
||||
|
||||
|
||||
// - Unit Functions ---------------------------------------------------
|
||||
@ -80,6 +84,9 @@
|
||||
#define GET_HEART_RATE(unit) (GETVAR(unit,VAR_HEART_RATE,DEFAULT_HEART_RATE))
|
||||
#define GET_PAIN(unit) (GETVAR(unit,VAR_PAIN,0))
|
||||
#define GET_PAIN_SUPPRESS(unit) (GETVAR(unit,VAR_PAIN_SUPP,0))
|
||||
#define IN_CRDC_ARRST(unit) (GETVAR(unit,VAR_CRDC_ARRST,false))
|
||||
#define IS_BLEEDING(unit) (GETVAR(unit,VAR_IS_BLEEDING,false))
|
||||
#define IS_IN_PAIN(unit) (GETVAR(unit,VAR_HAS_PAIN,false))
|
||||
#define IS_UNCONSCIOUS(unit) (GETVAR(unit,VAR_UNCON,false))
|
||||
|
||||
// The following function calls are defined here just for consistency
|
||||
@ -88,4 +95,3 @@
|
||||
|
||||
// Derivative unit values commonly used
|
||||
#define GET_PAIN_PERCEIVED(unit) (0 max (GET_PAIN(unit) - GET_PAIN_SUPPRESS(unit)) min 1)
|
||||
#define IS_IN_PAIN(unit) (GET_PAIN_PERCEIVED(unit) > 0)
|
||||
|
@ -18,6 +18,7 @@
|
||||
params ["_unit"];
|
||||
|
||||
if (GVAR(useAceMedical)) exitWith {
|
||||
_unit getVariable [QEGVAR(medical,isBleeding), false];
|
||||
IS_BLEEDING(_unit)
|
||||
};
|
||||
alive _unit && {getDammage _unit > 0.3};
|
||||
|
||||
alive _unit && {getDammage _unit > 0.3}
|
||||
|
@ -52,7 +52,7 @@ if (_show == 1) then {
|
||||
private _partText = [ELSTRING(medical,Head), ELSTRING(medical,Torso), ELSTRING(medical,LeftArm) ,ELSTRING(medical,RightArm) ,ELSTRING(medical,LeftLeg), ELSTRING(medical,RightLeg)] select _selectionN;
|
||||
_genericMessages pushback [localize _partText, [1, 1, 1, 1]];
|
||||
|
||||
if (_target getVariable[QEGVAR(medical,isBleeding), false]) then {
|
||||
if IS_BLEEDING(_target) then {
|
||||
_genericMessages pushback [localize ELSTRING(medical,Status_Bleeding), [1, 0.1, 0.1, 1]];
|
||||
};
|
||||
if (_target getVariable[QEGVAR(medical,hasLostBlood), 0] > 1) then {
|
||||
|
@ -27,7 +27,7 @@ private _genericMessages = [];
|
||||
private _partText = [ELSTRING(medical,Head), ELSTRING(medical,Torso), ELSTRING(medical,LeftArm) ,ELSTRING(medical,RightArm) ,ELSTRING(medical,LeftLeg), ELSTRING(medical,RightLeg)] select _selectionN;
|
||||
_genericMessages pushBack [localize _partText, [1, 1, 1, 1]];
|
||||
|
||||
if (_target getVariable [QEGVAR(medical,isBleeding), false]) then {
|
||||
if IS_BLEEDING(_target) then {
|
||||
_genericMessages pushBack [localize ELSTRING(medical,Status_Bleeding), [1, 0.1, 0.1, 1]];
|
||||
};
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
_unit setVariable [QGVAR(inCardiacArrest), false, true];
|
||||
_unit setVariable [VAR_CRDC_ARRST, false, true];
|
||||
_unit setVariable [QGVAR(cardiacArrestStart), nil];
|
||||
_unit setVariable [VAR_HEART_RATE, 40, true];
|
||||
_unit setVariable [QGVAR(lastTimeUpdated), CBA_missionTime];
|
||||
|
@ -18,7 +18,7 @@
|
||||
params ["_unit"];
|
||||
|
||||
if (GET_BLOOD_VOLUME(_unit) < BLOOD_VOLUME_CLASS_2_HEMORRHAGE) exitWith { false };
|
||||
if (_unit getVariable [QGVAR(inCardiacArrest), false]) exitWith { false };
|
||||
if IN_CRDC_ARRST(_unit) exitWith { false };
|
||||
|
||||
private _cardiacOutput = [_unit] call FUNC(getCardiacOutput);
|
||||
private _bloodLoss = GET_BLOOD_LOSS(_unit);
|
||||
|
@ -28,13 +28,13 @@ _unit setVariable [VAR_HEART_RATE_ADJ, [], true];
|
||||
_unit setVariable [VAR_BLOOD_PRESS, [80, 120], true];
|
||||
_unit setVariable [QGVAR(peripheralResistance), 100, true];
|
||||
_unit setVariable [QGVAR(peripheralResistanceAdjustments), [], true];
|
||||
_unit setVariable [QGVAR(inCardiacArrest), false, true];
|
||||
_unit setVariable [VAR_CRDC_ARRST, false, true];
|
||||
_unit setVariable [QGVAR(hasLostBlood), 0, true];
|
||||
_unit setVariable [QGVAR(isBleeding), false, true];
|
||||
_unit setVariable [VAR_IS_BLEEDING, false, true];
|
||||
|
||||
// - Pain ---------------------------------------------------------------------
|
||||
_unit setVariable [VAR_PAIN, 0, true];
|
||||
_unit setVariable [QGVAR(hasPain), false, true];
|
||||
_unit setVariable [VAR_IN_PAIN, false, true];
|
||||
_unit setVariable [VAR_PAIN_SUPP, 0, true];
|
||||
_unit setVariable [VAR_PAIN_SUPP_ADJ, [], true];
|
||||
|
||||
|
@ -19,9 +19,9 @@
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
if (_unit getVariable [QGVAR(inCardiacArrest), false]) exitWith {};
|
||||
if IN_CRDC_ARRST(_unit) exitWith {};
|
||||
|
||||
_unit setVariable [QGVAR(inCardiacArrest), true, true];
|
||||
_unit setVariable [VAR_CRDC_ARRST, true, true];
|
||||
_unit setVariable [VAR_HEART_RATE, 0, true];
|
||||
|
||||
["ace_cardiacArrestEntered", [_unit]] call CBA_fnc_localEvent;
|
||||
|
@ -34,7 +34,7 @@ if (_target getVariable [QEGVAR(medical,hasLostBlood), 0] > 0) then {
|
||||
};
|
||||
|
||||
if (alive _target) then {
|
||||
if (_target getVariable[QEGVAR(medical,hasPain), false]) then {
|
||||
if IS_IN_PAIN(_target) then {
|
||||
_genericMessages pushBack ELSTRING(medical,inPain);
|
||||
} else {
|
||||
_genericMessages pushBack ELSTRING(medical,noPain);
|
||||
|
@ -22,7 +22,7 @@ _target setVariable [VAR_HEART_RATE, 0, true];
|
||||
_target setVariable [QGVAR(receiveCPR), false, true]; // CPR finished
|
||||
[_target] call FUNC(calculateBlood);
|
||||
|
||||
if (alive _target && {_target getVariable [QEGVAR(medical,inCardiacArrest), false]}) then {
|
||||
if (alive _target && {IN_CRDC_ARRST(_target)}) then {
|
||||
[_target, "activity_view", ELSTRING(medical,Activity_cpr), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
|
||||
[QGVAR(treatmentCPRLocal), [_caller, _target], _target] call CBA_fnc_targetEvent;
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
params ["_caller", "_target"];
|
||||
|
||||
if (!(_target call EFUNC(common,isAwake)) || {_target getVariable [QEGVAR(medical,inCardiacArrest), false]}) then {
|
||||
if (!(_target call EFUNC(common,isAwake)) || {IN_CRDC_ARRST(_target)}) then {
|
||||
_target setVariable [VAR_HEART_RATE, 0, true];
|
||||
};
|
||||
_target setVariable [QGVAR(receiveCPR), false, true];
|
||||
|
@ -21,7 +21,7 @@ _args params ["_caller", "_target"];
|
||||
|
||||
// If the patient awakes by mysterious force, no cpr is needed!
|
||||
if (_target call EFUNC(common,isAwake)) exitWith {false};
|
||||
if (!(_target getVariable [QEGVAR(medical,inCardiacArrest), false])) exitWith {false};
|
||||
if !IN_CRDC_ARRST(_target) exitWith {false};
|
||||
|
||||
[_target] call FUNC(calculateBlood); // Calculate blood volume. If their is no pulse, nothing happens!
|
||||
|
||||
|
@ -47,11 +47,11 @@ _target setVariable [QEGVAR(medical,bodyPartStatus), [0,0,0,0,0,0], true];
|
||||
#endif
|
||||
|
||||
// generic medical admin
|
||||
_target setVariable [QEGVAR(medical,inCardiacArrest), false, true];
|
||||
_target setVariable [VAR_CRDC_ARRST, false, true];
|
||||
_target setVariable [VAR_UNCON, false, true];
|
||||
_target setVariable [QEGVAR(medical,hasLostBlood), 0, true];
|
||||
_target setVariable [QEGVAR(medical,isBleeding), false, true];
|
||||
_target setVariable [QEGVAR(medical,hasPain), false, true];
|
||||
_target setVariable [VAR_IS_BLEEDING, false, true];
|
||||
_target setVariable [VAR_IN_PAIN, false, true];
|
||||
_target setVariable [VAR_PAIN_SUPP, 0, true];
|
||||
_target setVariable [VAR_PAIN_SUPP_ADJ, [], true];
|
||||
_target setVariable [QGVAR(partialHealCounter), 0, true];
|
||||
|
@ -61,24 +61,18 @@ if (_bloodLoss > 0) then {
|
||||
|
||||
[QGVAR(Injury), _unit] call CBA_fnc_localEvent;
|
||||
|
||||
if !(_unit getVariable [QGVAR(isBleeding), false]) then {
|
||||
_unit setVariable [QGVAR(isBleeding), true, true];
|
||||
if !IS_BLEEDING(_unit) then {
|
||||
_unit setVariable [VAR_IS_BLEEDING, true, true];
|
||||
};
|
||||
} else {
|
||||
if (_unit getVariable [QGVAR(isBleeding), false]) then {
|
||||
_unit setVariable [QGVAR(isBleeding), false, true];
|
||||
if IS_BLEEDING(_unit) then {
|
||||
_unit setVariable [VAR_IS_BLEEDING, false, true];
|
||||
};
|
||||
};
|
||||
|
||||
private _painLevel = GET_PAIN_PERCEIVED(_unit);
|
||||
if (_painLevel > 0) then {
|
||||
if !(_unit getVariable [QGVAR(hasPain), false]) then {
|
||||
_unit setVariable [QGVAR(hasPain), true, true];
|
||||
};
|
||||
} else {
|
||||
if (_unit getVariable [QGVAR(hasPain), false]) then {
|
||||
_unit setVariable [QGVAR(hasPain), false, true];
|
||||
};
|
||||
private _inPain = GET_PAIN_PERCEIVED(_unit) > 0;
|
||||
if !(_inPain isEqualTo IS_IN_PAIN(_unit)) then {
|
||||
_unit setVariable [VAR_IN_PAIN, _inPain, true];
|
||||
};
|
||||
|
||||
// Handle pain due tourniquets, that have been applied more than 120 s ago
|
||||
|
@ -45,7 +45,7 @@ if !(_adjustments isEqualTo []) then {
|
||||
|
||||
private _heartRate = GET_HEART_RATE(_unit);
|
||||
|
||||
if !(_unit getVariable [QGVAR(inCardiacArrest), false]) then {
|
||||
if !IN_CRDC_ARRST(_unit) then {
|
||||
private _hrChange = 0;
|
||||
private _bloodVolume = GET_BLOOD_VOLUME(_unit);
|
||||
if (_bloodVolume > BLOOD_VOLUME_CLASS_4_HEMORRHAGE) then {
|
||||
|
Loading…
Reference in New Issue
Block a user