mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
1649422cbd
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> Co-authored-by: LinkIsGrim <salluci.lovi@gmail.com>
92 lines
3.2 KiB
Plaintext
92 lines
3.2 KiB
Plaintext
#include "..\script_component.hpp"
|
|
/*
|
|
* Author: KoffeinFlummi, commy2
|
|
* Initializes unit variables.
|
|
*
|
|
* Arguments:
|
|
* 0: The Unit <OBJECT>
|
|
* 1: Is Respawned <BOOL>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [bob, false] call ace_medical_status_fnc_initUnit
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_unit", ["_isRespawn", true]];
|
|
TRACE_2("initUnit",_unit,_isRespawn);
|
|
|
|
if (!_isRespawn) then { // Always add respawn EH (same as CBA's onRespawn=1)
|
|
_unit addEventHandler ["Respawn", {[(_this select 0), true] call FUNC(initUnit)}];
|
|
};
|
|
|
|
if (!local _unit) exitWith {};
|
|
|
|
if (damage _unit > 0) then {
|
|
_unit setDamage 0;
|
|
};
|
|
|
|
if (_isRespawn) then {
|
|
TRACE_1("reseting all vars on respawn",_isRespawn); // note: state is handled by ace_medical_statemachine_fnc_resetStateDefault
|
|
|
|
// - Vitals ------------------------------------------------------------------
|
|
_unit setVariable [VAR_BLOOD_VOL, DEFAULT_BLOOD_VOLUME, true];
|
|
_unit setVariable [VAR_HEART_RATE, DEFAULT_HEART_RATE, true];
|
|
_unit setVariable [VAR_BLOOD_PRESS, [80, 120], true];
|
|
_unit setVariable [VAR_PERIPH_RES, DEFAULT_PERIPH_RES, true];
|
|
_unit setVariable [VAR_CRDC_ARRST, false, true];
|
|
_unit setVariable [VAR_HEMORRHAGE, 0, true];
|
|
_unit setVariable [VAR_SPO2, DEFAULT_SPO2, true];
|
|
_unit setVariable [VAR_OXYGEN_DEMAND, 0, true];
|
|
|
|
// - Pain ---------------------------------------------------------------------
|
|
_unit setVariable [VAR_PAIN, 0, true];
|
|
_unit setVariable [VAR_IN_PAIN, false, true];
|
|
_unit setVariable [VAR_PAIN_SUPP, 0, true];
|
|
|
|
// - Wounds -------------------------------------------------------------------
|
|
_unit setVariable [VAR_OPEN_WOUNDS, createHashMap, true];
|
|
_unit setVariable [VAR_BANDAGED_WOUNDS, createHashMap, true];
|
|
_unit setVariable [VAR_STITCHED_WOUNDS, createHashMap, true];
|
|
_unit setVariable [QEGVAR(medical,isLimping), false, true];
|
|
_unit setVariable [VAR_FRACTURES, DEFAULT_FRACTURE_VALUES, true];
|
|
|
|
// - Misc ---------------------------------------------------------------------
|
|
_unit setVariable [VAR_UNCON, false, true];
|
|
|
|
// - Treatments ---------------------------------------------------------------
|
|
_unit setVariable [VAR_TOURNIQUET, DEFAULT_TOURNIQUET_VALUES, true];
|
|
_unit setVariable [QEGVAR(medical,occludedMedications), nil, true]; // Delayed Medications (from tourniquets)
|
|
_unit setVariable [QEGVAR(medical,ivBags), nil, true];
|
|
|
|
// Update wound bleeding
|
|
[_unit] call EFUNC(medical_status,updateWoundBloodLoss);
|
|
|
|
// Triage card and logs
|
|
_unit setVariable [QEGVAR(medical,triageLevel), 0, true];
|
|
_unit setVariable [QEGVAR(medical,triageCard), [], true];
|
|
|
|
// Damage storage
|
|
_unit setVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0], true];
|
|
|
|
// Medication
|
|
_unit setVariable [VAR_MEDICATIONS, [], true];
|
|
|
|
// Unconscious spontanious wake up chance
|
|
_unit setVariable [QEGVAR(medical,lastWakeUpCheck), nil, true];
|
|
|
|
// Cause of death
|
|
_unit setVariable [QEGVAR(medical,causeOfDeath), nil, true];
|
|
};
|
|
|
|
[{
|
|
params ["_unit"];
|
|
TRACE_3("Unit Init",_unit,local _unit,typeOf _unit);
|
|
|
|
_unit setVariable [QEGVAR(medical,initialized), true, true];
|
|
[QGVAR(initialized), [_unit]] call CBA_fnc_localEvent;
|
|
}, [_unit], 0.5] call CBA_fnc_waitAndExecute;
|