Skip to content

Commit f02314e

Browse files
committed
Merge pull request acemod#1217 from acemod/medicalFixes2
Medical Vitals Fixes
2 parents 6385b3d + 1d64e59 commit f02314e

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

addons/medical/functions/fnc_addToInjuredCollection.sqf

+6-3
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ if ([_unit] call FUNC(hasMedicalEnabled) || _force) then {
2727
_unit setvariable [QGVAR(addedToUnitLoop), true, true];
2828

2929
[{
30-
private "_unit";
30+
private ["_unit", "_interval"];
3131
_unit = (_this select 0) select 0;
32+
_interval = time - ((_this select 0) select 1);
33+
(_this select 0) set [1, time];
34+
3235
if (!alive _unit || !local _unit) then {
3336
[_this select 1] call CBA_fnc_removePerFrameHandler;
3437
if (!local _unit) then {
@@ -39,7 +42,7 @@ if ([_unit] call FUNC(hasMedicalEnabled) || _force) then {
3942
_unit setvariable [QGVAR(bloodVolume), _unit getvariable [QGVAR(bloodVolume), 100], true];
4043
};
4144
} else {
42-
[_unit] call FUNC(handleUnitVitals);
45+
[_unit, _interval] call FUNC(handleUnitVitals);
4346

4447
private "_pain";
4548
_pain = _unit getvariable [QGVAR(pain), 0];
@@ -51,5 +54,5 @@ if ([_unit] call FUNC(hasMedicalEnabled) || _force) then {
5154
[_unit, _pain] call FUNC(playInjuredSound);
5255
};
5356
};
54-
}, 1, [_unit]] call CBA_fnc_addPerFrameHandler;
57+
}, 1, [_unit, time]] call CBA_fnc_addPerFrameHandler;
5558
};

addons/medical/functions/fnc_handleUnitVitals.sqf

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515

1616
private ["_unit", "_heartRate","_bloodPressure","_bloodVolume","_painStatus", "_lastTimeValuesSynced", "_syncValues", "_airwayStatus", "_blood", "_bloodPressureH", "_bloodPressureL", "_interval"];
1717
_unit = _this select 0;
18-
19-
_interval = time - (_unit getVariable [QGVAR(lastMomentVitalsHandled), 0]);
20-
_unit setVariable [QGVAR(lastMomentVitalsHandled), time];
18+
_interval = _this select 1;
2119

2220
if (_interval == 0) exitWith {};
2321

addons/medical/functions/fnc_treatment_success.sqf

+5
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,8 @@ if (isNil _callback) then {
5555
_args call _callback;
5656

5757
_args call FUNC(createLitter);
58+
59+
//If we're not already tracking vitals, start:
60+
if (!(_target getvariable [QGVAR(addedToUnitLoop),false])) then {
61+
[_target] call FUNC(addToInjuredCollection);
62+
};

0 commit comments

Comments
 (0)