mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Don't handle unit vitals when game is paused
This commit is contained in:
parent
7f19ab7750
commit
77ae997993
@ -16,6 +16,11 @@
|
||||
private ["_unit", "_heartRate","_bloodPressure","_bloodVolume","_painStatus", "_lastTimeValuesSynced", "_syncValues"];
|
||||
_unit = _this select 0;
|
||||
|
||||
_interval = time - (_unit getVariable [QGVAR(lastMomentVitalsHandled), 0]);
|
||||
_unit setVariable [QGVAR(lastMomentVitalsHandled), time];
|
||||
|
||||
if (_interval == 0) exitWith {};
|
||||
|
||||
_lastTimeValuesSynced = _unit getvariable [QGVAR(lastMomentValuesSynced), 0];
|
||||
_syncValues = time - _lastTimeValuesSynced >= (10 + floor(random(10)));
|
||||
if (_syncValues) then {
|
||||
@ -76,12 +81,12 @@ if ([_unit] call EFUNC(common,isAwake)) then {
|
||||
if (GVAR(level) == 1) then {
|
||||
// reduce pain
|
||||
if (_unit getVariable [QGVAR(pain), 0] > 0) then {
|
||||
_unit setVariable [QGVAR(pain), ((_unit getVariable QGVAR(pain)) - 0.001) max 0, true];
|
||||
_unit setVariable [QGVAR(pain), ((_unit getVariable QGVAR(pain)) - 0.001 * _interval) max 0, _syncValues];
|
||||
};
|
||||
|
||||
// reduce painkillers
|
||||
if (_unit getVariable [QGVAR(morphine), 0] > 0) then {
|
||||
_unit setVariable [QGVAR(morphine), ((_unit getVariable QGVAR(morphine)) - 0.0015) max 0, true];
|
||||
_unit setVariable [QGVAR(morphine), ((_unit getVariable QGVAR(morphine)) - 0.0015 * _interval) max 0, _syncValues];
|
||||
};
|
||||
};
|
||||
|
||||
@ -89,7 +94,7 @@ if (GVAR(level) == 1) then {
|
||||
if (GVAR(level) >= 2) then {
|
||||
|
||||
// Set the vitals
|
||||
_heartRate = (_unit getvariable [QGVAR(heartRate), 0]) + ([_unit] call FUNC(getHeartRateChange));
|
||||
_heartRate = (_unit getvariable [QGVAR(heartRate), 0]) + ([_unit] call FUNC(getHeartRateChange)) * _interval;
|
||||
_unit setvariable [QGVAR(heartRate), _heartRate, _syncValues];
|
||||
|
||||
_bloodPressure = [_unit] call FUNC(getBloodPressure);
|
||||
@ -100,12 +105,12 @@ if (GVAR(level) >= 2) then {
|
||||
_airwayStatus = _unit getvariable [QGVAR(airwayStatus), 100];
|
||||
if (((_unit getvariable [QGVAR(airwayOccluded), false]) || (_unit getvariable [QGVAR(airwayCollapsed), false])) && !((_unit getvariable [QGVAR(airwaySecured), false]))) then {
|
||||
if (_airwayStatus >= 0.5) then {
|
||||
_unit setvariable [QGVAR(airwayStatus), _airwayStatus - 0.5, _syncValues];
|
||||
_unit setvariable [QGVAR(airwayStatus), _airwayStatus - 0.5 * _interval, _syncValues];
|
||||
};
|
||||
} else {
|
||||
if !((_unit getvariable [QGVAR(airwayOccluded), false]) || (_unit getvariable [QGVAR(airwayCollapsed), false])) then {
|
||||
if (_airwayStatus < 100) then {
|
||||
_unit setvariable [QGVAR(airwayStatus), (_airwayStatus + 1.5) min 100, _syncValues];
|
||||
_unit setvariable [QGVAR(airwayStatus), (_airwayStatus + 1.5 * _interval) min 100, _syncValues];
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -120,7 +125,7 @@ if (GVAR(level) >= 2) then {
|
||||
// Check vitals for medical status
|
||||
// TODO check for in revive state instead of variable
|
||||
// TODO Implement cardiac arrest.
|
||||
_bloodPressureL = _bloodPressure select 0;
|
||||
_bloodPressureL = _bloodPressure select 0;
|
||||
_bloodPressureH = _bloodPressure select 1;
|
||||
|
||||
if (!(_unit getvariable [QGVAR(inCardiacArrest),false])) then {
|
||||
|
Loading…
Reference in New Issue
Block a user