2016-09-11 18:46:35 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
GVAR(useAceMedical) = ["ace_medical"] call EFUNC(common,isModLoaded);
|
|
|
|
|
|
|
|
// To support public API regardless of component settings
|
2016-10-02 16:35:40 +00:00
|
|
|
[QGVAR(spurt), FUNC(spurt)] call CBA_fnc_addEventHandler;
|
2016-09-11 18:46:35 +00:00
|
|
|
|
|
|
|
if (isServer) then {
|
|
|
|
GVAR(bloodDrops) = [];
|
|
|
|
|
|
|
|
[QGVAR(bloodDropCreated), {
|
|
|
|
params ["_bloodDrop"];
|
2016-11-09 19:00:18 +00:00
|
|
|
// Add to created queue with format [expireTime, object]
|
|
|
|
private _index = GVAR(bloodDrops) pushBack [(CBA_missionTime + BLOOD_OBJECT_LIFETIME), _bloodDrop];
|
|
|
|
|
2016-09-19 10:27:02 +00:00
|
|
|
if (count GVAR(bloodDrops) >= MAX_BLOOD_OBJECTS) then {
|
2016-11-09 19:00:18 +00:00
|
|
|
(GVAR(bloodDrops) deleteAt 0) params ["", "_deletedBloodDrop"];
|
2016-09-11 18:46:35 +00:00
|
|
|
deleteVehicle _deletedBloodDrop;
|
|
|
|
};
|
|
|
|
|
2016-11-09 19:00:18 +00:00
|
|
|
if (_index == 1) then { // Start the waitAndExecute loop
|
|
|
|
[FUNC(serverCleanupBlood), [], BLOOD_OBJECT_LIFETIME] call CBA_fnc_waitAndExecute;
|
|
|
|
};
|
2016-09-11 18:46:35 +00:00
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
};
|
|
|
|
|
|
|
|
["ace_settingsInitialized", {
|
|
|
|
TRACE_1("settingsInitialized", GVAR(enabledFor));
|
|
|
|
if (GVAR(enabledFor) == 0) exitWith {}; // 0: disabled
|
2016-09-29 15:42:56 +00:00
|
|
|
if ((GVAR(enabledFor) == 1) && {!hasInterface}) exitWith {}; // 1: enabledFor_OnlyPlayers
|
|
|
|
|
|
|
|
private _listcode = if (GVAR(enabledFor) == 1) then {
|
2019-02-27 05:28:16 +00:00
|
|
|
{[ACE_player]} // ace_player is only possible local player
|
2016-09-29 15:42:56 +00:00
|
|
|
} else {
|
2019-02-27 05:28:16 +00:00
|
|
|
EFUNC(common,getLocalUnits) // filter all local units
|
2016-09-29 15:42:56 +00:00
|
|
|
};
|
2016-11-09 19:00:18 +00:00
|
|
|
|
2016-09-29 15:42:56 +00:00
|
|
|
private _stateMachine = [_listcode, true] call CBA_statemachine_fnc_create;
|
|
|
|
[_stateMachine, {call FUNC(onBleeding)}, {}, {}, "Bleeding"] call CBA_statemachine_fnc_addState;
|
2016-09-11 18:46:35 +00:00
|
|
|
|
2018-07-15 14:24:04 +00:00
|
|
|
[QEGVAR(medical,woundReceived), FUNC(handleWoundReceived)] call CBA_fnc_addEventHandler;
|
2016-09-11 18:46:35 +00:00
|
|
|
}] call CBA_fnc_addEventHandler;
|