ACE3/addons/medical_status/functions/fnc_initUnit.sqf
PabstMirror e56cc0d74e
Limping / Splint Treatment (#6947)
* Improve adjustment calcs / wound blood loss / medications

fix func descriptions

Calc wound blood loss on events

reorder includes so scritpmacroMed has global effect

trivial optimization for getCardiacOutput

Fix var

Fix wounds not reopening (nil _category)

Fix surgical kit inherting canBandage conditional

debug hitpoints

Update ACE_Medical_Treatment_Actions.hpp

Use woundBleeding for IS_BLEEDING macro

rework medication vars

comments

Reset var in init / fullHeal

Update addons/medical_treatment/functions/fnc_onMedicationUsage.sqf

Co-Authored-By: PabstMirror <pabstmirror@gmail.com>

* Change wound data array

Drop unique id and merge classId and category

* Splinting and treatment and gui

* Add arm fractures and aim effects

* localizations and event

* fix

* cleanup

* Apply suggestions from code review

Co-Authored-By: PabstMirror <pabstmirror@gmail.com>

* formating, rename bone images

* Apply suggestions from code review

Co-Authored-By: PabstMirror <pabstmirror@gmail.com>

* disable calls to extension

* Update fnc_onMedicationUsage.sqf

* Medical - Skip unneeded setVars on initUnit (#6949)

*  Medical - Transfer state machine state on locality (#6950)

* Medical - Transfer state machine state on locality

* Fix feedback isUnconscious var

* Exclude AI

* Make UAV excludes consistant, formating

* Update fnc_treatmentFullHealLocal.sqf

* reset fractures on respawn
2019-05-11 23:13:59 -05:00

89 lines
3.1 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
// - Blood and heart ----------------------------------------------------------
_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];
// - Pain ---------------------------------------------------------------------
_unit setVariable [VAR_PAIN, 0, true];
_unit setVariable [VAR_IN_PAIN, false, true];
_unit setVariable [VAR_PAIN_SUPP, 0, true];
// - Wounds -------------------------------------------------------------------
_unit setVariable [QEGVAR(medical,openWounds), [], true];
_unit setVariable [QEGVAR(medical,bandagedWounds), [], true];
_unit setVariable [QEGVAR(medical,stitchedWounds), [], true];
_unit setVariable [QEGVAR(medical,isLimping), false, true];
_unit setVariable [QEGVAR(medical,fractures), [0,0,0,0,0,0], 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];
// TODO move to treatment
private _logs = _unit getVariable [QEGVAR(medical,allLogs), []];
{
_unit setVariable [_x, nil];
} forEach _logs;
_unit setVariable [QEGVAR(medical,allLogs), [], true];
};
[{
params ["_unit"];
TRACE_3("Unit Init",_unit,local _unit,typeOf _unit);
[QGVAR(initialized), [_unit]] call CBA_fnc_localEvent;
}, [_unit], 0.5] call CBA_fnc_waitAndExecute;