ACE3/addons/medical_engine/XEH_postInit.sqf

44 lines
1.7 KiB
Plaintext
Raw Normal View History

#include "script_component.hpp"
["CAManBase", "init", {
params ["_unit"];
// Check if last hit point is our dummy.
private _allHitPoints = getAllHitPointsDamage _unit param [0, []];
reverse _allHitPoints;
if (_allHitPoints param [0, ""] != "ACE_HDBracket") then {
private _config = [_unit] call CBA_fnc_getObjectConfig;
if (getText (_config >> "simulation") == "UAVPilot") exitWith {TRACE_1("ignore UAV AI",typeOf _unit);};
if (getNumber (_config >> "isPlayableLogic") == 1) exitWith {TRACE_1("ignore logic unit",typeOf _unit)};
2016-10-02 15:50:17 +00:00
ERROR_1("Bad hitpoints for unit type ""%1""",typeOf _unit);
} else {
// Calling this function inside curly brackets allows the usage of
// "exitWith", which would be broken with "HandleDamage" otherwise.
2018-01-02 15:34:13 +00:00
_unit setVariable [
2018-01-02 15:36:17 +00:00
QEGVAR(medical,HandleDamageEHID),
2018-01-02 15:34:13 +00:00
_unit addEventHandler ["HandleDamage", {_this call FUNC(handleDamage)}]
];
};
}, nil, [IGNORE_BASE_UAVPILOTS], true] call CBA_fnc_addClassEventHandler;
#ifdef DEBUG_MODE_FULL
[QEGVAR(medical,woundReceived), {
2017-03-06 21:06:01 +00:00
params ["_unit", "_woundedHitPoint", "_receivedDamage", "_shooter", "_ammo"];
TRACE_5("wound",_unit,_woundedHitPoint, _receivedDamage, _shooter, _ammo);
2016-12-05 20:34:20 +00:00
//systemChat str _this;
}] call CBA_fnc_addEventHandler;
#endif
// this handles moving units into vehicles via load functions or zeus
// needed, because the vanilla INCAPACITATED state does not handle vehicles
["CAManBase", "GetInMan", {
params ["_unit"];
2017-09-23 16:46:48 +00:00
if (!local _unit) exitWith {};
if (lifeState _unit == "INCAPACITATED") then {
[_unit, true] call FUNC(setUnconsciousAnim);
};
}] call CBA_fnc_addClassEventHandler;