ACE3/addons/medical_blood/XEH_postInit.sqf

30 lines
1.1 KiB
Plaintext
Raw Normal View History

2016-09-11 18:46:35 +00:00
#include "script_component.hpp"
2024-07-17 19:49:23 +00:00
["CBA_settingsInitialized", {
if !(GETEGVAR(medical,enabled,false)) exitWith {};
2016-09-11 18:46:35 +00:00
2024-07-17 19:49:23 +00:00
// To support public API regardless of component settings
[QGVAR(spurt), LINKFUNC(spurt)] call CBA_fnc_addEventHandler;
2016-09-11 18:46:35 +00:00
2024-07-17 19:49:23 +00:00
if (isServer) then {
GVAR(bloodDrops) = [];
2024-07-17 19:49:23 +00:00
[QGVAR(bloodDropCreated), {
params ["_bloodDrop", "_source"];
2024-07-17 19:49:23 +00:00
// Add to created queue with format: [expire time, blood object, source unit]
private _index = GVAR(bloodDrops) pushBack [CBA_missionTime + GVAR(bloodLifetime), _bloodDrop, _source];
2016-09-11 18:46:35 +00:00
2024-07-17 19:49:23 +00:00
if (count GVAR(bloodDrops) >= GVAR(maxBloodObjects)) then {
(GVAR(bloodDrops) deleteAt 0) params ["", "_deletedBloodDrop"];
deleteVehicle _deletedBloodDrop;
};
// Start the cleanup loop
if (_index == 0) then {
[LINKFUNC(cleanupLoop), [], GVAR(bloodLifetime)] call CBA_fnc_waitAndExecute;
};
}] call CBA_fnc_addEventHandler;
};
}] call CBA_fnc_addEventHandler;