2023-09-12 18:58:10 +00:00
#include "..\script_component.hpp"
2019-06-03 15:31:46 +00:00
/*
* Author: Glowbal
* Local callback for fully healing a patient.
*
* Arguments:
* 0: Patient <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player] call ace_medical_treatment_fnc_fullHealLocal
*
* Public: No
*/
params ["_patient"];
2019-06-12 00:25:05 +00:00
TRACE_1("fullHealLocal",_patient);
2019-06-03 15:31:46 +00:00
if (!alive _patient) exitWith {};
2021-11-04 21:36:53 +00:00
// check if on fire, then put out the fire before healing
if ((["ace_fire"] call EFUNC(common,isModLoaded)) && {[_patient] call EFUNC(fire,isBurning)}) then {
_patient setVariable [QEGVAR(fire,intensity), 0, true];
};
2019-08-06 13:10:33 +00:00
private _state = GET_SM_STATE(_patient);
TRACE_1("start",_state);
2019-06-03 15:31:46 +00:00
// Treatment conditions would normally limit full heal to non-unconscious units
// However, this may be called externally (through Zeus)
if IN_CRDC_ARRST(_patient) then {
TRACE_1("Exiting cardiac arrest",_patient);
[QEGVAR(medical,CPRSucceeded), _patient] call CBA_fnc_localEvent;
2019-08-06 13:10:33 +00:00
_state = GET_SM_STATE(_patient);
TRACE_1("after CPRSucceeded",_state);
2019-06-03 15:31:46 +00:00
};
_patient setVariable [VAR_PAIN, 0, true];
_patient setVariable [VAR_BLOOD_VOL, DEFAULT_BLOOD_VOLUME, true];
// Tourniquets
2021-10-10 22:34:28 +00:00
{
if (_x != 0) then {
[_patient, "ACE_tourniquet"] call EFUNC(common,addToInventory);
};
} forEach GET_TOURNIQUETS(_patient);
2019-06-03 15:31:46 +00:00
_patient setVariable [VAR_TOURNIQUET, DEFAULT_TOURNIQUET_VALUES, true];
_patient setVariable [QGVAR(occludedMedications), nil, true];
// Wounds and Injuries
2023-06-24 05:11:56 +00:00
_patient setVariable [VAR_OPEN_WOUNDS, createHashMap, true];
_patient setVariable [VAR_BANDAGED_WOUNDS, createHashMap, true];
_patient setVariable [VAR_STITCHED_WOUNDS, createHashMap, true];
2019-06-03 15:31:46 +00:00
_patient setVariable [QEGVAR(medical,isLimping), false, true];
_patient setVariable [VAR_FRACTURES, DEFAULT_FRACTURE_VALUES, true];
// Update wound bleeding
[_patient] call EFUNC(medical_status,updateWoundBloodLoss);
// Vitals
_patient setVariable [VAR_HEART_RATE, DEFAULT_HEART_RATE, true];
_patient setVariable [VAR_BLOOD_PRESS, [80, 120], true];
_patient setVariable [VAR_PERIPH_RES, DEFAULT_PERIPH_RES, true];
// IVs
_patient setVariable [QEGVAR(medical,ivBags), nil, true];
// Damage storage
_patient setVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0], true];
2019-06-12 00:25:05 +00:00
// wakeup needs to be done after achieving stable vitals, but before manually reseting unconc var
if IS_UNCONSCIOUS(_patient) then {
2019-08-06 13:10:33 +00:00
if (!([_patient] call EFUNC(medical_status,hasStableVitals))) then { ERROR_2("fullheal [unit %1][state %2] did not restore stable vitals",_patient,_state); };
2019-06-12 00:25:05 +00:00
TRACE_1("Waking up",_patient);
[QEGVAR(medical,WakeUp), _patient] call CBA_fnc_localEvent;
2019-08-06 13:10:33 +00:00
_state = GET_SM_STATE(_patient);
TRACE_1("after WakeUp",_state);
2020-02-29 22:09:31 +00:00
if IS_UNCONSCIOUS(_patient) then { ERROR_2("fullheal [unit %1][state %2] failed to wake up patient",_patient,_state); };
2019-06-12 00:25:05 +00:00
};
2019-06-03 15:31:46 +00:00
// Generic medical admin
2019-08-06 13:10:33 +00:00
// _patient setVariable [VAR_CRDC_ARRST, false, true]; // this should be set by statemachine transition
// _patient setVariable [VAR_UNCON, false, true]; // this should be set by statemachine transition
2019-06-03 15:31:46 +00:00
_patient setVariable [VAR_HEMORRHAGE, 0, true];
_patient setVariable [VAR_IN_PAIN, false, true];
_patient setVariable [VAR_PAIN_SUPP, 0, true];
// Medication
_patient setVariable [VAR_MEDICATIONS, [], true];
// Reset triage card since medication is reset
_patient setVariable [QEGVAR(medical,triageCard), [], true];
[_patient] call EFUNC(medical_engine,updateDamageEffects);
// Reset damage
_patient setDamage 0;
[QEGVAR(medical,FullHeal), _patient] call CBA_fnc_localEvent;
2019-08-06 13:10:33 +00:00
_state = GET_SM_STATE(_patient);
TRACE_1("after FullHeal",_state);