mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added calculateBlood function
This commit is contained in:
parent
327124003c
commit
6ed90496a2
@ -49,6 +49,7 @@ PREP(healTime);
|
||||
PREP(isBeingCarried);
|
||||
PREP(isBeingDragged);
|
||||
PREP(onMedicationUsage);
|
||||
PREP(calculateBlood);
|
||||
|
||||
// items
|
||||
PREP(checkItems);
|
||||
|
30
addons/medical_treatment/functions/fnc_calculateBlood.sqf
Normal file
30
addons/medical_treatment/functions/fnc_calculateBlood.sqf
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Author: Zakant
|
||||
* Calculate the blood loost and blood volume for a unit. Used from CPR to simulate a heart rate while in cardiac arrest
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* NONE
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params["_unit"];
|
||||
|
||||
// We will just simulate blood flow for now!
|
||||
private _lastTimeUpdated = _unit getVariable [QEGVAR(medical,lastTimeUpdated), CBA_missionTime];
|
||||
private _deltaT = CBA_missionTime - _lastTimeUpdated;
|
||||
|
||||
private _lastTimeValuesSynced = _unit getVariable [QEGVAR(medical,lastMomentValuesSynced), 0];
|
||||
private _syncValues = (CBA_missionTime - _lastTimeValuesSynced) >= (10 + floor(random(10)));
|
||||
|
||||
_unit setVariable [QEGVAR(medical,lastTimeUpdated), CBA_missionTime];
|
||||
if (_deltaT != 0) then {
|
||||
private _change = ([_unit, _deltaT, _syncValues] call EFUNC(medical,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];
|
||||
};
|
Loading…
Reference in New Issue
Block a user