2016-07-30 12:00:42 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
ADDON = false;
|
|
|
|
|
2016-12-10 03:03:52 +00:00
|
|
|
PREP_RECOMPILE_START;
|
2016-07-30 12:00:42 +00:00
|
|
|
#include "XEH_PREP.hpp"
|
2016-12-10 03:03:52 +00:00
|
|
|
PREP_RECOMPILE_END;
|
2016-07-30 12:00:42 +00:00
|
|
|
|
2021-08-23 23:27:00 +00:00
|
|
|
#include "initSettings.sqf"
|
|
|
|
|
2019-10-20 16:14:31 +00:00
|
|
|
// Define "Constants" variables (both are macros defined in script_macros_medical.hpp, look there for actual variable names)
|
|
|
|
if (isNil QUOTE(HEAD_DAMAGE_THRESHOLD)) then {HEAD_DAMAGE_THRESHOLD = HEAD_DAMAGE_THRESHOLD_DEFAULT};
|
|
|
|
if (isNil QUOTE(ORGAN_DAMAGE_THRESHOLD)) then {ORGAN_DAMAGE_THRESHOLD = ORGAN_DAMAGE_THRESHOLD_DEFAULT};
|
|
|
|
if (isNil QUOTE(HEART_HIT_CHANCE)) then {HEART_HIT_CHANCE = HEART_HIT_CHANCE_DEFAULT};
|
|
|
|
if (isNil QUOTE(PENETRATION_THRESHOLD)) then {PENETRATION_THRESHOLD = PENETRATION_THRESHOLD_DEFAULT};
|
|
|
|
if (isNil QUOTE(BLOOD_LOSS_KNOCK_OUT_THRESHOLD)) then {BLOOD_LOSS_KNOCK_OUT_THRESHOLD = BLOOD_LOSS_KNOCK_OUT_THRESHOLD_DEFAULT};
|
|
|
|
if (isNil QUOTE(PAIN_UNCONSCIOUS)) then {PAIN_UNCONSCIOUS = PAIN_UNCONSCIOUS_DEFAULT};
|
|
|
|
if (isNil QUOTE(PAIN_FADE_TIME)) then {PAIN_FADE_TIME = PAIN_FADE_TIME_DEFAULT};
|
|
|
|
if (isNil QUOTE(LIMPING_DAMAGE_THRESHOLD)) then {LIMPING_DAMAGE_THRESHOLD = LIMPING_DAMAGE_THRESHOLD_DEFAULT};
|
|
|
|
if (isNil QUOTE(FRACTURE_DAMAGE_THRESHOLD)) then {FRACTURE_DAMAGE_THRESHOLD = FRACTURE_DAMAGE_THRESHOLD_DEFAULT};
|
|
|
|
// Derive the alternate fatal damage coefficents
|
|
|
|
if (isNil QUOTE(FATAL_SUM_DAMAGE_WEIBULL_K) || isNil QUOTE(FATAL_SUM_DAMAGE_WEIBULL_L)) then {
|
|
|
|
private _x1 = 0.5;
|
|
|
|
private _y1 = 0.1;
|
|
|
|
private _x2 = 0.8;
|
|
|
|
private _y2 = 0.9;
|
|
|
|
private _b1 = -ln (1-_y1);
|
|
|
|
private _b2 = -ln (1-_y2);
|
|
|
|
FATAL_SUM_DAMAGE_WEIBULL_K = ln(_b1/_b2) / ln(_x1/_x2);
|
|
|
|
FATAL_SUM_DAMAGE_WEIBULL_L = _x1 / _b1^(1/FATAL_SUM_DAMAGE_WEIBULL_K);
|
|
|
|
};
|
|
|
|
|
2020-02-28 16:54:53 +00:00
|
|
|
// Cache for armor values of equipped items (vests etc)
|
|
|
|
GVAR(armorCache) = false call CBA_fnc_createNamespace;
|
|
|
|
|
2016-08-27 06:50:55 +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) = [];
|
|
|
|
|
2020-07-01 13:08:54 +00:00
|
|
|
GVAR(animations) = [] call CBA_fnc_createNamespace;
|
2021-11-07 23:15:52 +00:00
|
|
|
GVAR(animations) setVariable [QUNCON_ANIM(faceUp), [QUNCON_ANIM(2),QUNCON_ANIM(2_1),QUNCON_ANIM(7_1),QUNCON_ANIM(8_1),QUNCON_ANIM(5_1),QUNCON_ANIM(6_1)]];
|
|
|
|
GVAR(animations) setVariable [QUNCON_ANIM(faceDown), [QUNCON_ANIM(1),QUNCON_ANIM(3),QUNCON_ANIM(4),"unconscious",QUNCON_ANIM(9),QUNCON_ANIM(3_1),QUNCON_ANIM(4_1)]];
|
|
|
|
GVAR(animations) setVariable [QUNCON_ANIM(faceLeft), [QUNCON_ANIM(7),QUNCON_ANIM(8),QUNCON_ANIM(1_1),QUNCON_ANIM(7_1),QUNCON_ANIM(8_1)]];
|
|
|
|
GVAR(animations) setVariable [QUNCON_ANIM(faceRight), [QUNCON_ANIM(5),QUNCON_ANIM(6),QUNCON_ANIM(10),QUNCON_ANIM(5_1),QUNCON_ANIM(6_1)]];
|
2020-07-01 13:08:54 +00:00
|
|
|
|
2016-08-27 06:50:55 +00:00
|
|
|
private _fnc_fixStatic = {
|
|
|
|
params ["_vehicle"];
|
|
|
|
private _type = typeOf _vehicle;
|
|
|
|
|
|
|
|
if !(_type in GVAR(fixedStatics)) then {
|
|
|
|
GVAR(fixedStatics) pushBack _type;
|
|
|
|
PRELOAD_CLASS(_type);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
["StaticWeapon", "init", _fnc_fixStatic] call CBA_fnc_addClassEventHandler;
|
|
|
|
["Car", "init", _fnc_fixStatic] call CBA_fnc_addClassEventHandler;
|
|
|
|
|
|
|
|
addMissionEventHandler ["Loaded", {
|
|
|
|
{
|
|
|
|
PRELOAD_CLASS(_x);
|
|
|
|
} forEach GVAR(fixedStatics);
|
|
|
|
}];
|
|
|
|
|
2020-07-01 13:08:54 +00:00
|
|
|
["ace_unconscious", {
|
|
|
|
params ["_unit", "_active"];
|
|
|
|
if (_active) then {
|
2020-07-22 15:25:47 +00:00
|
|
|
// Use object reference to indicate the waitUnit is already running (this prevents issues with respawning units keeping SetVars)
|
|
|
|
if ((_unit getVariable [QGVAR(waitForAnim), objNull]) == _unit) exitWith {};
|
|
|
|
_unit setVariable [QGVAR(waitForAnim), _unit];
|
2021-11-07 23:15:52 +00:00
|
|
|
[{(animationState _this) find QUNCON_ANIM(face) != -1}, {
|
2020-07-22 15:25:47 +00:00
|
|
|
[_this, animationState _this] call FUNC(applyAnimAfterRagdoll);
|
|
|
|
}, _unit, 20] call CBA_fnc_waitUntilAndExecute;
|
2020-07-01 13:08:54 +00:00
|
|
|
} else {
|
|
|
|
_unit setVariable [QGVAR(waitForAnim), nil];
|
|
|
|
if (local _unit) then {
|
|
|
|
[_unit, _active] call FUNC(setUnconsciousAnim);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}] call CBA_fnc_addEventhandler;
|
|
|
|
|
2021-07-23 19:32:36 +00:00
|
|
|
[] call FUNC(disableThirdParty);
|
|
|
|
|
2016-07-30 12:00:42 +00:00
|
|
|
ADDON = true;
|