2015-01-18 21:16:35 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-02-03 19:09:25 +00:00
|
|
|
ADDON = false;
|
2015-01-18 21:16:35 +00:00
|
|
|
|
2016-11-23 19:35:25 +00:00
|
|
|
PREP_RECOMPILE_START;
|
2016-02-22 14:20:36 +00:00
|
|
|
#include "XEH_PREP.hpp"
|
2016-11-23 19:35:25 +00:00
|
|
|
PREP_RECOMPILE_END;
|
2015-04-18 15:31:03 +00:00
|
|
|
|
2015-02-08 09:25:03 +00:00
|
|
|
GVAR(injuredUnitCollection) = [];
|
2015-03-22 22:24:24 +00:00
|
|
|
|
2016-02-16 18:19:18 +00:00
|
|
|
private _versionEx = "ace_medical" callExtension "version";
|
|
|
|
DFUNC(handleDamage_assignWounds) = if (_versionEx == "") then {
|
|
|
|
DFUNC(handleDamage_woundsOld)
|
|
|
|
} else {
|
|
|
|
DFUNC(handleDamage_wounds)
|
|
|
|
};
|
2015-06-13 21:20:01 +00:00
|
|
|
|
2015-02-21 20:10:57 +00:00
|
|
|
call FUNC(parseConfigForInjuries);
|
2015-01-18 21:16:35 +00:00
|
|
|
|
2015-04-11 20:30:52 +00:00
|
|
|
GVAR(HITPOINTS) = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"];
|
|
|
|
GVAR(SELECTIONS) = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"];
|
|
|
|
|
2016-02-10 04:43:38 +00:00
|
|
|
//Hack for #3168 (units in static weapons do not take any damage):
|
|
|
|
//doing a manual pre-load with a small distance seems to fix the LOD problems with handle damage not returning full results
|
|
|
|
GVAR(fixedStatics) = [];
|
|
|
|
private _fixStatic = {
|
|
|
|
params ["_vehicle"];
|
|
|
|
private _vehType = typeOf _vehicle;
|
|
|
|
TRACE_2("",_vehicle,_vehType);
|
|
|
|
if (!(_vehType in GVAR(fixedStatics))) then {
|
|
|
|
GVAR(fixedStatics) pushBack _vehType;
|
|
|
|
TRACE_1("starting preload",_vehType);
|
|
|
|
[{
|
|
|
|
1 preloadObject (_this select 0);
|
|
|
|
}, {
|
|
|
|
TRACE_1("preload done",_this);
|
2016-05-22 13:27:24 +00:00
|
|
|
}, [_vehType]] call CBA_fnc_waitUntilAndExecute;
|
2016-02-10 04:43:38 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
["StaticWeapon", "init", _fixStatic] call CBA_fnc_addClassEventHandler;
|
|
|
|
["Car", "init", _fixStatic] call CBA_fnc_addClassEventHandler;
|
2017-11-07 21:21:58 +00:00
|
|
|
["CAManBase", "Init", FUNC(handleInit)] call CBA_fnc_addClassEventHandler;
|
|
|
|
["CAManBase", "Respawn", FUNC(handleRespawn)] call CBA_fnc_addClassEventHandler;
|
|
|
|
["CAManBase", "Killed", FUNC(handleKilled)] call CBA_fnc_addClassEventHandler;
|
|
|
|
["CAManBase", "Local", FUNC(handleLocal)] call CBA_fnc_addClassEventHandler;
|
|
|
|
|
2016-02-10 17:50:30 +00:00
|
|
|
addMissionEventHandler ["Loaded",{
|
|
|
|
{
|
|
|
|
TRACE_1("starting preload (save load)",_x);
|
|
|
|
[{
|
|
|
|
1 preloadObject (_this select 0);
|
|
|
|
}, {
|
|
|
|
TRACE_1("preload done",_this);
|
2016-05-22 13:27:24 +00:00
|
|
|
}, [_x]] call CBA_fnc_waitUntilAndExecute;
|
2016-02-10 17:50:30 +00:00
|
|
|
} forEach GVAR(fixedStatics);
|
2017-03-08 18:33:28 +00:00
|
|
|
|
|
|
|
// Reload configs into extension (handle full game restart)
|
|
|
|
call FUNC(parseConfigForInjuries);
|
2016-02-10 17:50:30 +00:00
|
|
|
}];
|
2016-02-10 04:43:38 +00:00
|
|
|
|
|
|
|
|
2015-01-18 21:16:35 +00:00
|
|
|
ADDON = true;
|