Merge pull request #1217 from acemod/medicalFixes2

Medical Vitals Fixes
This commit is contained in:
Glowbal 2015-05-16 15:35:42 +02:00
commit f02314e996
3 changed files with 12 additions and 6 deletions

View File

@ -27,8 +27,11 @@ if ([_unit] call FUNC(hasMedicalEnabled) || _force) then {
_unit setvariable [QGVAR(addedToUnitLoop), true, true];
[{
private "_unit";
private ["_unit", "_interval"];
_unit = (_this select 0) select 0;
_interval = time - ((_this select 0) select 1);
(_this select 0) set [1, time];
if (!alive _unit || !local _unit) then {
[_this select 1] call CBA_fnc_removePerFrameHandler;
if (!local _unit) then {
@ -39,7 +42,7 @@ if ([_unit] call FUNC(hasMedicalEnabled) || _force) then {
_unit setvariable [QGVAR(bloodVolume), _unit getvariable [QGVAR(bloodVolume), 100], true];
};
} else {
[_unit] call FUNC(handleUnitVitals);
[_unit, _interval] call FUNC(handleUnitVitals);
private "_pain";
_pain = _unit getvariable [QGVAR(pain), 0];
@ -51,5 +54,5 @@ if ([_unit] call FUNC(hasMedicalEnabled) || _force) then {
[_unit, _pain] call FUNC(playInjuredSound);
};
};
}, 1, [_unit]] call CBA_fnc_addPerFrameHandler;
}, 1, [_unit, time]] call CBA_fnc_addPerFrameHandler;
};

View File

@ -15,9 +15,7 @@
private ["_unit", "_heartRate","_bloodPressure","_bloodVolume","_painStatus", "_lastTimeValuesSynced", "_syncValues", "_airwayStatus", "_blood", "_bloodPressureH", "_bloodPressureL", "_interval"];
_unit = _this select 0;
_interval = time - (_unit getVariable [QGVAR(lastMomentVitalsHandled), 0]);
_unit setVariable [QGVAR(lastMomentVitalsHandled), time];
_interval = _this select 1;
if (_interval == 0) exitWith {};

View File

@ -55,3 +55,8 @@ if (isNil _callback) then {
_args call _callback;
_args call FUNC(createLitter);
//If we're not already tracking vitals, start:
if (!(_target getvariable [QGVAR(addedToUnitLoop),false])) then {
[_target] call FUNC(addToInjuredCollection);
};