mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Use blood bolume status macros
This commit is contained in:
parent
4715a75351
commit
e0503129f0
@ -69,6 +69,8 @@
|
||||
#define IS_IN_PAIN(unit) (GET_PAIN_PERCEIVED(unit) > 0)
|
||||
#define IS_UNCONSCIOUS(unit) (unit getVariable [QEGVAR(medical_status,isUnconscious), false])
|
||||
// Setters have overloaded versions for locality handling
|
||||
#define SET_BLOOD_VOLUME(unit,value) unit setVariable [QEGVAR(medical_status,bloodVolume), 0 max value min DEFAULT_BLOOD_VOLUME, true]
|
||||
#define SET_BLOOD_VOLUME(unit,value,sync) unit setVariable [QEGVAR(medical_status,bloodVolume), 0 max value min DEFAULT_BLOOD_VOLUME, sync]
|
||||
#define SET_HEART_RATE(unit,value) unit setVariable [QEGVAR(medical_status,heartRate), value, true]
|
||||
#define SET_HEART_RATE(unit,value,sync) unit setVariable [QEGVAR(medical_status,heartRate), value, sync]
|
||||
#define SET_PAIN_TOTAL(unit,value) unit setVariable [QEGVAR(medical_status,pain), 0 max (value) min 1, true]
|
||||
|
@ -118,4 +118,4 @@ if (_critialDamage || {_painLevel > PAIN_UNCONSCIOUS}) then {
|
||||
[_unit] call EFUNC(medical,handleIncapacitation);
|
||||
};
|
||||
|
||||
TRACE_5("exit",_unit,_painLevel,_unit getVariable QEGVAR(medical,pain),_unit getVariable QEGVAR(medical,openWounds),_woundsCreated);
|
||||
TRACE_5("exit",_unit,_painLevel,GET_PAIN_TOTAL(_unit),_unit getVariable QEGVAR(medical,openWounds),_woundsCreated);
|
||||
|
@ -91,10 +91,10 @@ private _woundsCreated = [];
|
||||
_oldInjury params ["_woundClassIDToAdd", "", "_injuryBleedingRate", "_injuryPain"];
|
||||
|
||||
private _bodyPartNToAdd = [floor random 6, _bodyPartN] select _isSelectionSpecific; // 6 == count ALL_BODY_PARTS
|
||||
|
||||
|
||||
_bodyPartDamage set [_bodyPartNToAdd, (_bodyPartDamage select _bodyPartNToAdd) + _woundDamage];
|
||||
_bodyPartVisParams set [[1,2,3,3,4,4] select _bodyPartNToAdd, true]; // Mark the body part index needs updating
|
||||
|
||||
|
||||
// Create a new injury. Format [ID, classID, bodypart, percentage treated, bleeding rate]
|
||||
_injury = [_woundID, _woundClassIDToAdd, _bodyPartNToAdd, 1, _injuryBleedingRate];
|
||||
|
||||
@ -176,4 +176,4 @@ if (_critialDamage || {_painLevel > PAIN_UNCONSCIOUS}) then {
|
||||
[_unit] call EFUNC(medical,handleIncapacitation);
|
||||
};
|
||||
|
||||
TRACE_5("exit",_unit,_painLevel,_unit getVariable QEGVAR(medical,pain),_unit getVariable QEGVAR(medical,openWounds),_woundsCreated);
|
||||
TRACE_5("exit",_unit,_painLevel,GET_PAIN_TOTAL(_unit),_unit getVariable QEGVAR(medical,openWounds),_woundsCreated);
|
||||
|
@ -10,7 +10,7 @@ if (!alive _unit) exitWith {};
|
||||
if (!local _unit) exitWith {
|
||||
SET_HEART_RATE(_unit,GET_HEART_RATE(_unit));
|
||||
_unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true];
|
||||
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME], true];
|
||||
SET_BLOOD_VOLUME(_unit,GET_BLOOD_VOLUME(_unit));
|
||||
};
|
||||
|
||||
[_unit] call EFUNC(medical_vitals,handleUnitVitals);
|
||||
|
@ -10,7 +10,7 @@ if (!alive _unit) exitWith {};
|
||||
if (!local _unit) exitWith {
|
||||
SET_HEART_RATE(_unit,GET_HEART_RATE(_unit));
|
||||
_unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true];
|
||||
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME], true];
|
||||
SET_BLOOD_VOLUME(_unit,GET_BLOOD_VOLUME(_unit));
|
||||
};
|
||||
|
||||
[_unit] call EFUNC(medical_vitals,handleUnitVitals);
|
||||
|
@ -11,7 +11,7 @@ if (!alive _unit) exitWith {};
|
||||
if (!local _unit) exitWith {
|
||||
SET_HEART_RATE(_unit,GET_HEART_RATE(_unit));
|
||||
_unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true];
|
||||
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME], true];
|
||||
SET_BLOOD_VOLUME(_unit,GET_BLOOD_VOLUME(_unit));
|
||||
};
|
||||
|
||||
[_unit] call EFUNC(medical_vitals,handleUnitVitals);
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
params ["_unit", "_deltaT", "_syncValues"];
|
||||
|
||||
private _bloodVolume = _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME];
|
||||
private _bloodVolume = GET_BLOOD_VOLUME(_unit);
|
||||
private _bloodVolumeChange = -_deltaT * GET_BLOOD_LOSS(_unit);
|
||||
|
||||
if (!isNil {_unit getVariable QGVAR(ivBags)}) then {
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
if (_unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME] < BLOOD_VOLUME_CLASS_2_HEMORRHAGE) exitWith { false };
|
||||
if (GET_BLOOD_VOLUME(_unit) < BLOOD_VOLUME_CLASS_2_HEMORRHAGE) exitWith { false };
|
||||
if (_unit getVariable [QGVAR(inCardiacArrest), false]) exitWith { false };
|
||||
|
||||
private _cardiacOutput = [_unit] call FUNC(getCardiacOutput);
|
||||
|
@ -22,7 +22,7 @@ if (damage _unit > 0) then {
|
||||
};
|
||||
|
||||
// - Blood and heart ----------------------------------------------------------
|
||||
_unit setVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME, true];
|
||||
SET_BLOOD_VOLUME(_unit,DEFAULT_BLOOD_VOLUME);
|
||||
SET_HEART_RATE(_unit,DEFAULT_HEART_RATE);
|
||||
_unit setVariable [QGVAR(heartRateAdjustments), [], true];
|
||||
_unit setVariable [QGVAR(bloodPressure), [80, 120], true];
|
||||
|
@ -24,7 +24,6 @@ private _syncValues = (CBA_missionTime - _lastTimeValuesSynced) >= (10 + floor(r
|
||||
_unit setVariable [QEGVAR(medical,lastTimeUpdated), CBA_missionTime];
|
||||
if (_deltaT != 0) then {
|
||||
private _change = ([_unit, _deltaT, _syncValues] call EFUNC(medical_status,getBloodVolumeChange));
|
||||
private _bloodVolume = (_unit getVariable [QEGVAR(medical,bloodVolume), DEFAULT_BLOOD_VOLUME]) + _change;
|
||||
_bloodVolume = 0 max _bloodVolume min DEFAULT_BLOOD_VOLUME;
|
||||
_unit setVariable [QEGVAR(medical,bloodVolume), _bloodVolume, _syncValues];
|
||||
private _bloodVolume = GET_BLOOD_VOLUME(_unit) + _change;
|
||||
SET_BLOOD_VOLUME(_unit,_bloodVolume,_syncValues);
|
||||
};
|
||||
|
@ -17,8 +17,8 @@ params ["_caller", "_target"];
|
||||
|
||||
if (!alive _target) exitWith {};
|
||||
|
||||
_target setVariable [QEGVAR(medical,pain), 0, true];
|
||||
_target setVariable [QEGVAR(medical,bloodVolume), DEFAULT_BLOOD_VOLUME, true];
|
||||
SET_PAIN_TOTAL(_target,0);
|
||||
SET_BLOOD_VOLUME(_target,DEFAULT_BLOOD_VOLUME);
|
||||
|
||||
// tourniquets
|
||||
_target setVariable [QEGVAR(medical,tourniquets), [0,0,0,0,0,0], true];
|
||||
|
@ -20,7 +20,7 @@ params ["_target", "_treatmentClassname", "_bodyPart"];
|
||||
private _partIndex = ALL_BODY_PARTS find toLower _bodyPart;
|
||||
if (_partIndex < 0) exitWith { false };
|
||||
|
||||
private _bloodVolume = _target getVariable [QEGVAR(medical,bloodVolume), DEFAULT_BLOOD_VOLUME];
|
||||
private _bloodVolume = GET_BLOOD_VOLUME(_target);
|
||||
|
||||
if (_bloodVolume >= DEFAULT_BLOOD_VOLUME) exitWith {};
|
||||
|
||||
|
@ -32,11 +32,11 @@ if (_syncValues) then {
|
||||
_unit setVariable [QGVAR(lastMomentValuesSynced), CBA_missionTime];
|
||||
};
|
||||
|
||||
private _bloodVolume = (_unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME]) + ([_unit, _deltaT, _syncValues] call EFUNC(medical_status,getBloodVolumeChange));
|
||||
_bloodVolume = 0 max _bloodVolume min DEFAULT_BLOOD_VOLUME;
|
||||
private _bloodVolume = GET_BLOOD_VOLUME(_unit) + ([_unit, _deltaT, _syncValues] call EFUNC(medical_status,getBloodVolumeChange));
|
||||
//_bloodVolume = 0 max _bloodVolume min DEFAULT_BLOOD_VOLUME;
|
||||
|
||||
// @todo: replace this and the rest of the setVariable with EFUNC(common,setApproximateVariablePublic)
|
||||
_unit setVariable [QGVAR(bloodVolume), _bloodVolume, _syncValues];
|
||||
SET_BLOOD_VOLUME(_unit,_bloodVolume,_syncValues);
|
||||
|
||||
// Set variables for synchronizing information across the net
|
||||
if (_bloodVolume < BLOOD_VOLUME_CLASS_1_HEMORRHAGE) then {
|
||||
|
@ -48,7 +48,7 @@ private _heartRate = GET_HEART_RATE(_unit);
|
||||
|
||||
if (!(_unit getVariable [QGVAR(inCardiacArrest), false])) then {
|
||||
private _hrChange = 0;
|
||||
private _bloodVolume = _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME];
|
||||
private _bloodVolume = GET_BLOOD_VOLUME(_unit);
|
||||
if (_bloodVolume > BLOOD_VOLUME_CLASS_4_HEMORRHAGE) then {
|
||||
GET_BLOOD_PRESSURE(_unit) params ["_bloodPressureL", "_bloodPressureH"];
|
||||
private _meanBP = (2/3) * _bloodPressureH + (1/3) * _bloodPressureL;
|
||||
|
Loading…
Reference in New Issue
Block a user