All checks were successful
Generate testing snapshot / Create testing release (push) Successful in 40s
56 lines
1.4 KiB
Plaintext
56 lines
1.4 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
[
|
|
LEVEL_INFO,
|
|
QUOTE(COMPONENT),
|
|
"Initializing dead unit deletion PFH",
|
|
[]
|
|
] call EFUNC(common,log);
|
|
|
|
GVAR(deadUnitCleanupPFH) = [
|
|
{
|
|
_maxTime = getMissionConfigValue ["corpseRemovalMaxTime", 300] * 1.5;
|
|
_maxDead = getMissionConfigValue ["corpseLimit", 80];
|
|
|
|
// _dead = allDead select { (_x isKindOf "CAManBase") and ( ( (time - (_x getVariable ["milsim_death_time", time] ) ) > (_maxTime * 1.5) ) ) };
|
|
// _dead = _dead apply { [ (time - (_x getVariable ["milsim_death_time", time] ) ), _x ] };
|
|
|
|
_dead = [];
|
|
{
|
|
if not (_x isKindOf "CAManBase") then { continue };
|
|
if not (isInRemainsCollector _x) then { continue };
|
|
_dead pushBack [time - (_x getVariable ["milsim_death_time", time] ), _x];
|
|
} forEach allDead;
|
|
|
|
_dead sort false;
|
|
_toDelete = 0 max ( (count _dead ) - _maxDead );
|
|
_dead = _dead select [0, _toDelete];
|
|
{
|
|
_unit = _x#1;
|
|
// _unit setVariable ["milsim_garbage_collected", true];
|
|
deleteVehicle (_unit);
|
|
} foreach _dead;
|
|
},
|
|
180,
|
|
[],
|
|
{ // on creation
|
|
[
|
|
LEVEL_INFO,
|
|
QUOTE(COMPONENT),
|
|
"dead unit deletion PFH loaded",
|
|
[]
|
|
] call EFUNC(common,log);
|
|
},
|
|
{ // on deletion
|
|
[
|
|
LEVEL_INFO,
|
|
QUOTE(COMPONENT),
|
|
"dead unit deletion PFH unloaded",
|
|
[]
|
|
] call EFUNC(common,log);
|
|
},
|
|
{ (missionNamespace getVariable [QGVAR(deadUnitCleanup_enable), false]) },
|
|
{ false },
|
|
[]
|
|
] call CBA_fnc_createPerFrameHandlerObject;
|