mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Use macros for unit variables
Improves the way medical is storing variables in object space by having a common list of variables names as macros. Makes the code a bit cleaner and ensured consistency across components. Also a handy reference for when working on medical to see what values are all stored.
This commit is contained in:
parent
e0503129f0
commit
1dc934e1b1
@ -41,14 +41,14 @@ if (!isNull _instigator) then {
|
||||
|
||||
#ifdef DEBUG_TESTRESULTS
|
||||
private _startDmg = +(_unit getVariable [QGVAR(bodyPartDamage), [-1]]);
|
||||
private _startPain = GET_PAIN_TOTAL(_unit);
|
||||
private _startPain = GET_PAIN(_unit);
|
||||
#endif
|
||||
|
||||
[QEGVAR(medical_engine,woundReceived), [_unit, _bodyPart, _damageToAdd, _instigator, _typeOfDamage]] call CBA_fnc_localEvent;
|
||||
|
||||
#ifdef DEBUG_TESTRESULTS
|
||||
private _endDmg = _unit getVariable [QGVAR(bodyPartDamage), [-1]];
|
||||
private _endPain = GET_PAIN_TOTAL(_unit);
|
||||
private _endPain = GET_PAIN(_unit);
|
||||
private _typeOfDamageAdj = _typeOfDamage call EFUNC(medical_damage,getTypeOfDamage);
|
||||
private _config = configFile >> "ACE_Medical_Injuries" >> "damageTypes" >> _typeOfDamageAdj;
|
||||
private _selectionSpecific = true;
|
||||
|
@ -24,6 +24,7 @@ TRACE_2("adjustPainLevel",_unit,_desiredPainLevel);
|
||||
|
||||
_desiredPainLevel = _desiredPainLevel * GVAR(painCoefficient);
|
||||
|
||||
private _pain = GET_PAIN_TOTAL(_unit);
|
||||
private _pain = GET_PAIN(_unit);
|
||||
_pain = 0 max (_pain max _desiredPainLevel) min 1;
|
||||
|
||||
SET_PAIN_TOTAL(_unit,_pain max _desiredPainLevel,false);
|
||||
_unit setVariable [VAR_PAIN, _pain];
|
||||
|
@ -55,8 +55,8 @@
|
||||
_return pushBack format [" - [HR: %1] [BP: %2 / %3]", _heartRate toFixed 1, _bpLow toFixed 1, _bpHigh toFixed 1];
|
||||
|
||||
// Pain:
|
||||
private _pain = GET_PAIN_TOTAL(_unit);
|
||||
private _painSuppress = _unit getVariable [QEGVAR(medical_status,painSuppress), 0];
|
||||
private _pain = GET_PAIN(_unit);
|
||||
private _painSuppress = GET_PAIN_SUPPRESS(_unit);
|
||||
private _painLevel = GET_PAIN_PERCEIVED(_unit);
|
||||
_return pushBack format ["Effective Pain: %1", _painLevel toFixed 3];
|
||||
_return pushBack format [" - [Pain: %1] [Suppress: %2]", _pain toFixed 3, _painSuppress toFixed 3];
|
||||
|
@ -20,6 +20,6 @@ params ["_unit"];
|
||||
|
||||
if (!local _unit) exitWith {};
|
||||
|
||||
SET_PAIN_TOTAL(_unit,0);
|
||||
SET_HEART_RATE(_unit,0);
|
||||
_unit setVariable [QGVAR(bloodPressure), [0, 0], true];
|
||||
_unit setVariable [VAR_PAIN, 0, true];
|
||||
_unit setVariable [VAR_HEART_RATE, 0, true];
|
||||
_unit setVariable [VAR_BLOOD_PRESS, [0, 0], true];
|
||||
|
@ -57,21 +57,32 @@
|
||||
// Minimum body part damage required for blood effect on uniform
|
||||
#define VISUAL_BODY_DAMAGE_THRESHOLD 0.35
|
||||
|
||||
// - Status macro functions ---------------------------------------------------
|
||||
// These macros provide the same functionality as the functions in the status
|
||||
// component, but are slightly faster (because most are just object variables)
|
||||
#define GET_BLOOD_LOSS(unit) ([unit] call EFUNC(medical_status,getBloodLoss)) // Just for consistency
|
||||
#define GET_BLOOD_PRESSURE(unit) ([unit] call EFUNC(medical_status,getBloodPressure)) // Just for consistency
|
||||
#define GET_BLOOD_VOLUME(unit) (unit getVariable [QEGVAR(medical_status,bloodVolume), DEFAULT_BLOOD_VOLUME])
|
||||
#define GET_HEART_RATE(unit) (unit getVariable [QEGVAR(medical_status,heartRate), DEFAULT_HEART_RATE])
|
||||
#define GET_PAIN_PERCEIVED(unit) ([unit] call EFUNC(medical_status,getPainPerceived)) // Just for consistency
|
||||
#define GET_PAIN_TOTAL(unit) (unit getVariable [QEGVAR(medical_status,pain), 0])
|
||||
#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]
|
||||
#define SET_PAIN_TOTAL(unit,value,sync) unit setVariable [QEGVAR(medical_status,pain), 0 max (value) min 1, sync]
|
||||
|
||||
|
||||
// - Unit Variables ----------------------------------------------------
|
||||
// These variables get stored in object space and used across components
|
||||
// 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_HEART_RATE QEGVAR(medical,heartRate)
|
||||
#define VAR_PAIN QEGVAR(medical,pain)
|
||||
#define VAR_PAIN_SUPP QEGVAR(medical,painSuppress)
|
||||
#define VAR_UNCON QEGVAR(medical,isUnconscious)
|
||||
|
||||
|
||||
// - Unit Functions ---------------------------------------------------
|
||||
// Retrieval macros for common unit values
|
||||
// Defined for easy consistency and speed
|
||||
#define GET_BLOOD_VOLUME(unit) (GETVAR(unit,VAR_BLOOD_VOL,DEFAULT_BLOOD_VOLUME))
|
||||
#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 IS_UNCONSCIOUS(unit) (GETVAR(unit,VAR_UNCON,false))
|
||||
|
||||
// The following function calls are defined here just for consistency
|
||||
#define GET_BLOOD_LOSS(unit) ([unit] call EFUNC(medical_status,getBloodLoss))
|
||||
#define GET_BLOOD_PRESSURE(unit) ([unit] call EFUNC(medical_status,getBloodPressure))
|
||||
|
||||
// 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)
|
||||
|
@ -23,7 +23,7 @@ if IS_UNCONSCIOUS(_this) exitWith {};
|
||||
if ((_this getVariable [QGVAR(treatmentOverAt), CBA_missionTime]) > CBA_missionTime) exitWith {};
|
||||
|
||||
private _needsBandaging = GET_BLOOD_LOSS(_this) > 0;
|
||||
private _needsMorphine = GET_PAIN_TOTAL(_this) > 0.2;
|
||||
private _needsMorphine = GET_PAIN(_this) > 0.2;
|
||||
|
||||
switch (true) do {
|
||||
case _needsBandaging: {
|
||||
|
@ -53,7 +53,7 @@ _this forceSpeed 0;
|
||||
_target forceSpeed 0;
|
||||
|
||||
private _needsBandaging = GET_BLOOD_LOSS(_target) > 0;
|
||||
private _needsMorphine = GET_PAIN_TOTAL(_target) > 0.2;
|
||||
private _needsMorphine = GET_PAIN(_target) > 0.2;
|
||||
private _needsEpinephrine = IS_UNCONSCIOUS(_target);
|
||||
|
||||
switch (true) do {
|
||||
|
@ -118,4 +118,4 @@ if (_critialDamage || {_painLevel > PAIN_UNCONSCIOUS}) then {
|
||||
[_unit] call EFUNC(medical,handleIncapacitation);
|
||||
};
|
||||
|
||||
TRACE_5("exit",_unit,_painLevel,GET_PAIN_TOTAL(_unit),_unit getVariable QEGVAR(medical,openWounds),_woundsCreated);
|
||||
TRACE_5("exit",_unit,_painLevel,GET_PAIN(_unit),_unit getVariable QEGVAR(medical,openWounds),_woundsCreated);
|
||||
|
@ -176,4 +176,4 @@ if (_critialDamage || {_painLevel > PAIN_UNCONSCIOUS}) then {
|
||||
[_unit] call EFUNC(medical,handleIncapacitation);
|
||||
};
|
||||
|
||||
TRACE_5("exit",_unit,_painLevel,GET_PAIN_TOTAL(_unit),_unit getVariable QEGVAR(medical,openWounds),_woundsCreated);
|
||||
TRACE_5("exit",_unit,_painLevel,GET_PAIN(_unit),_unit getVariable QEGVAR(medical,openWounds),_woundsCreated);
|
||||
|
@ -8,9 +8,9 @@ if (!alive _unit) exitWith {};
|
||||
|
||||
// If locality changed, broadcast the last medical state and finish the local loop
|
||||
if (!local _unit) exitWith {
|
||||
SET_HEART_RATE(_unit,GET_HEART_RATE(_unit));
|
||||
_unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true];
|
||||
SET_BLOOD_VOLUME(_unit,GET_BLOOD_VOLUME(_unit));
|
||||
_unit setVariable [VAR_HEART_RATE, GET_HEART_RATE(_unit), true];
|
||||
_unit setVariable [VAR_BLOOD_PRESS, _unit getVariable [VAR_BLOOD_PRESS, [80, 120]], true];
|
||||
_unit setVariable [VAR_BLOOD_VOL, GET_BLOOD_VOLUME(_unit), true];
|
||||
};
|
||||
|
||||
[_unit] call EFUNC(medical_vitals,handleUnitVitals);
|
||||
|
@ -8,9 +8,9 @@ if (!alive _unit) exitWith {};
|
||||
|
||||
// If locality changed, broadcast the last medical state and finish the local loop
|
||||
if (!local _unit) exitWith {
|
||||
SET_HEART_RATE(_unit,GET_HEART_RATE(_unit));
|
||||
_unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true];
|
||||
SET_BLOOD_VOLUME(_unit,GET_BLOOD_VOLUME(_unit));
|
||||
_unit setVariable [VAR_HEART_RATE, GET_HEART_RATE(_unit), true];
|
||||
_unit setVariable [VAR_BLOOD_PRESS, _unit getVariable [VAR_BLOOD_PRESS, [80, 120]], true];
|
||||
_unit setVariable [VAR_BLOOD_VOL, GET_BLOOD_VOLUME(_unit), true];
|
||||
};
|
||||
|
||||
[_unit] call EFUNC(medical_vitals,handleUnitVitals);
|
||||
|
@ -9,9 +9,9 @@ if (!alive _unit) exitWith {};
|
||||
|
||||
// If locality changed, broadcast the last medical state and finish the local loop
|
||||
if (!local _unit) exitWith {
|
||||
SET_HEART_RATE(_unit,GET_HEART_RATE(_unit));
|
||||
_unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true];
|
||||
SET_BLOOD_VOLUME(_unit,GET_BLOOD_VOLUME(_unit));
|
||||
_unit setVariable [VAR_HEART_RATE, GET_HEART_RATE(_unit), true];
|
||||
_unit setVariable [VAR_BLOOD_PRESS, _unit getVariable [VAR_BLOOD_PRESS, [80, 120]], true];
|
||||
_unit setVariable [VAR_BLOOD_VOL, GET_BLOOD_VOLUME(_unit), true];
|
||||
};
|
||||
|
||||
[_unit] call EFUNC(medical_vitals,handleUnitVitals);
|
||||
|
@ -16,5 +16,5 @@ params ["_unit"];
|
||||
|
||||
_unit setVariable [QGVAR(inCardiacArrest), false, true];
|
||||
_unit setVariable [QGVAR(cardiacArrestStart), nil];
|
||||
SET_HEART_RATE(_unit,40);
|
||||
_unit setVariable [VAR_HEART_RATE, 40, true];
|
||||
_unit setVariable [QGVAR(lastTimeUpdated), CBA_missionTime];
|
||||
|
@ -3,7 +3,6 @@ PREP(getBloodLoss);
|
||||
PREP(getBloodPressure);
|
||||
PREP(getBloodVolumeChange);
|
||||
PREP(getCardiacOutput);
|
||||
PREP(getPainPerceived);
|
||||
PREP(hasStableVitals);
|
||||
PREP(hasTourniquetAppliedTo);
|
||||
PREP(initUnit);
|
||||
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Get the perceived pain level of a unit.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The Unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Pain level (0 .. 1) <NUMBER>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
private _pain = GET_PAIN_TOTAL(_unit);
|
||||
private _painSuppress = _unit getVariable [QGVAR(painSuppress), 0];
|
||||
|
||||
(0 max (_pain - _painSuppress) min 1)
|
@ -22,10 +22,10 @@ if (damage _unit > 0) then {
|
||||
};
|
||||
|
||||
// - Blood and heart ----------------------------------------------------------
|
||||
SET_BLOOD_VOLUME(_unit,DEFAULT_BLOOD_VOLUME);
|
||||
SET_HEART_RATE(_unit,DEFAULT_HEART_RATE);
|
||||
_unit setVariable [VAR_BLOOD_VOL, DEFAULT_BLOOD_VOLUME, true];
|
||||
_unit setVariable [VAR_HEART_RATE, DEFAULT_HEART_RATE, true];
|
||||
_unit setVariable [QGVAR(heartRateAdjustments), [], true];
|
||||
_unit setVariable [QGVAR(bloodPressure), [80, 120], 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];
|
||||
@ -33,9 +33,9 @@ _unit setVariable [QGVAR(hasLostBlood), 0, true];
|
||||
_unit setVariable [QGVAR(isBleeding), false, true];
|
||||
|
||||
// - Pain ---------------------------------------------------------------------
|
||||
SET_PAIN_TOTAL(_unit,0);
|
||||
_unit setVariable [VAR_PAIN, 0, true];
|
||||
_unit setVariable [QGVAR(hasPain), false, true];
|
||||
_unit setVariable [QGVAR(painSuppress), 0, true];
|
||||
_unit setVariable [VAR_PAIN_SUPP, 0, true];
|
||||
_unit setVariable [QGVAR(painSuppressAdjustments), [], true];
|
||||
|
||||
// - Wounds -------------------------------------------------------------------
|
||||
|
@ -22,7 +22,7 @@ params ["_unit"];
|
||||
if (_unit getVariable [QGVAR(inCardiacArrest), false]) exitWith {};
|
||||
|
||||
_unit setVariable [QGVAR(inCardiacArrest), true, true];
|
||||
SET_HEART_RATE(_unit,0);
|
||||
_unit setVariable [VAR_HEART_RATE, 0, true];
|
||||
|
||||
["ace_cardiacArrestEntered", [_unit]] call CBA_fnc_localEvent;
|
||||
|
||||
|
@ -24,6 +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 = GET_BLOOD_VOLUME(_unit) + _change;
|
||||
SET_BLOOD_VOLUME(_unit,_bloodVolume,_syncValues);
|
||||
private _bloodVolume = 0 max (GET_BLOOD_VOLUME(_unit) + _change) min DEFAULT_BLOOD_VOLUME;
|
||||
_unit setVariable [VAR_BLOOD_VOL, _bloodVolume, _syncValues];
|
||||
};
|
||||
|
@ -17,8 +17,8 @@ params ["_caller", "_target"];
|
||||
|
||||
if (!alive _target) exitWith {};
|
||||
|
||||
SET_PAIN_TOTAL(_target,0);
|
||||
SET_BLOOD_VOLUME(_target,DEFAULT_BLOOD_VOLUME);
|
||||
_unit setVariable [VAR_PAIN, 0, true];
|
||||
_unit setVariable [VAR_BLOOD_VOL, DEFAULT_BLOOD_VOLUME, true];
|
||||
|
||||
// tourniquets
|
||||
_target setVariable [QEGVAR(medical,tourniquets), [0,0,0,0,0,0], true];
|
||||
@ -52,7 +52,7 @@ _target setVariable ["ACE_isUnconscious", 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 [QEGVAR(medical,painSuppress), 0, true];
|
||||
_target setVariable [VAR_PAIN_SUPP, 0, true];
|
||||
_target setVariable [QGVAR(painSuppressAdjustments), [], true];
|
||||
_target setVariable [QGVAR(partialHealCounter), 0, true];
|
||||
|
||||
|
@ -20,8 +20,8 @@ TRACE_3("params",_target,_className,_partIndex);
|
||||
if (!EGVAR(medical,advancedMedication)) exitWith {
|
||||
if (_className == "Morphine") exitWith {
|
||||
#define MORPHINE_PAIN_SUPPRESSION 0.6
|
||||
private _painSupress = _target getVariable [QEGVAR(medical,painSuppress), 0];
|
||||
_target setVariable [QEGVAR(medical,painSuppress), (_painSupress + MORPHINE_PAIN_SUPPRESSION) min 1, true];
|
||||
private _painSupress = GET_PAIN_SUPPRESS(_target);
|
||||
_target setVariable [VAR_PAIN_SUPP, (_painSupress + MORPHINE_PAIN_SUPPRESSION) min 1, true];
|
||||
};
|
||||
|
||||
if (_className == "Epinephrine") exitWith {
|
||||
@ -77,14 +77,14 @@ if (alive _target) then {
|
||||
private _hrIncrease = [_hrIncreaseLow, _hrIncreaseNorm, _hrIncreaseHigh] select (floor ((0 max _heartRate min 110) / 55));
|
||||
_hrIncrease params ["_minIncrease", "_maxIncrease"];
|
||||
private _heartRateChange = _minIncrease + random (_maxIncrease - _minIncrease);
|
||||
|
||||
|
||||
// Adjust the heart rate based upon config entry
|
||||
if (_heartRateChange != 0) then {
|
||||
private _heartRateAdjustments = _target getVariable [QEGVAR(medical,heartRateAdjustments), []];
|
||||
_heartRateAdjustments pushBack [_heartRateChange, _timeTillMaxEffect, _timeInSystem, 0];
|
||||
_target setVariable [QEGVAR(medical,heartRateAdjustments), _heartRateAdjustments];
|
||||
};
|
||||
|
||||
|
||||
// Adjust the pain suppression based upon config entry
|
||||
if (_painReduce > 0) then {
|
||||
private _painSupressAdjustments = _target getVariable [QEGVAR(medical,painSupressAdjustments), []];
|
||||
|
@ -26,17 +26,17 @@ BEGIN_COUNTER(Vitals);
|
||||
|
||||
_unit setVariable [QGVAR(lastTimeUpdated), CBA_missionTime];
|
||||
private _lastTimeValuesSynced = _unit getVariable [QGVAR(lastMomentValuesSynced), 0];
|
||||
private _syncValues = (CBA_missionTime - _lastTimeValuesSynced) >= (10 + floor(random(10)));
|
||||
private _syncValues = (CBA_missionTime - _lastTimeValuesSynced) >= (10 + floor(random 10));
|
||||
|
||||
if (_syncValues) then {
|
||||
_unit setVariable [QGVAR(lastMomentValuesSynced), CBA_missionTime];
|
||||
};
|
||||
|
||||
private _bloodVolume = GET_BLOOD_VOLUME(_unit) + ([_unit, _deltaT, _syncValues] call EFUNC(medical_status,getBloodVolumeChange));
|
||||
//_bloodVolume = 0 max _bloodVolume min DEFAULT_BLOOD_VOLUME;
|
||||
_bloodVolume = 0 max _bloodVolume min DEFAULT_BLOOD_VOLUME;
|
||||
|
||||
// @todo: replace this and the rest of the setVariable with EFUNC(common,setApproximateVariablePublic)
|
||||
SET_BLOOD_VOLUME(_unit,_bloodVolume,_syncValues);
|
||||
_unit setVariable [VAR_BLOOD_VOL, _bloodVolume, _syncValues];
|
||||
|
||||
// Set variables for synchronizing information across the net
|
||||
if (_bloodVolume < BLOOD_VOLUME_CLASS_1_HEMORRHAGE) then {
|
||||
@ -96,7 +96,7 @@ private _heartRate = [_unit, _deltaT, _syncValues] call FUNC(updateHeartRate);
|
||||
[_unit, _deltaT, _syncValues] call FUNC(updatePeripheralResistance);
|
||||
|
||||
private _bloodPressure = GET_BLOOD_PRESSURE(_unit);
|
||||
_unit setVariable [QGVAR(bloodPressure), _bloodPressure, _syncValues];
|
||||
_unit setVariable [VAR_BLOOD_PRESS, _bloodPressure, _syncValues];
|
||||
|
||||
private _cardiacOutput = [_unit] call EFUNC(medical_status,getCardiacOutput);
|
||||
if (_bloodLoss > BLOOD_LOSS_KNOCK_OUT_THRESHOLD * _cardiacOutput) then {
|
||||
|
@ -75,7 +75,7 @@ if (!(_unit getVariable [QGVAR(inCardiacArrest), false])) then {
|
||||
_heartRate = (_heartRate + _deltaT * _hrChange) max 0;
|
||||
};
|
||||
|
||||
SET_HEART_RATE(_unit,_heartRate,_syncValue);
|
||||
_unit setVariable [VAR_HEART_RATE, _heartRate, _syncValue];
|
||||
|
||||
_heartRate
|
||||
|
||||
|
@ -40,16 +40,16 @@ if (!(_adjustment isEqualTo [])) then {
|
||||
_adjustment = _adjustment - [ObjNull];
|
||||
_unit setVariable [QGVAR(painSupressAdjustments), _adjustment, (_syncValue || {_adjustment isEqualTo []})]; // always sync on last run
|
||||
|
||||
_unit setVariable [QGVAR(painSuppress), 0 max _painSupressAdjustment, _syncValue];
|
||||
_unit setVariable [VAR_PAIN_SUPP, 0 max _painSupressAdjustment, _syncValue];
|
||||
};
|
||||
|
||||
// Handle continuous pain reduction
|
||||
private _pain = GET_PAIN_TOTAL(_unit);
|
||||
private _pain = GET_PAIN(_unit);
|
||||
_unit setVariable [QEGVAR(medical_status,pain), 0 max (_pain - _deltaT / PAIN_FADE_TIME), _syncValue];
|
||||
|
||||
// Handles simple medication
|
||||
if (!EGVAR(medical,advancedMedication)) then {
|
||||
private _painSupress = _unit getVariable [QGVAR(painSuppress), 0];
|
||||
private _painSupress = _unit getVariable [VAR_PAIN_SUPP, 0];
|
||||
_painSupress = _painSupress - _deltaT / PAIN_SUPPRESSION_FADE_TIME;
|
||||
_unit setVariable [QGVAR(painSuppress), 0 max _painSupress, _syncValue];
|
||||
_unit setVariable [VAR_PAIN_SUPP, 0 max _painSupress, _syncValue];
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user