Update fnc_handleDestroyed.sqf

This commit is contained in:
Drofseh 2024-05-26 23:50:53 -07:00
parent 5b519c561b
commit 5e48d85072

View File

@ -29,14 +29,18 @@ if (_loaded isNotEqualTo []) then {
// Delete all cargo // Delete all cargo
{ {
if (_x isEqualType objNull) then { if (_x isEqualType objNull) then {
private _delete = true;
if (_killed && {random 100 < GVAR(unloadOnKilled)}) then { if (_killed && {random 100 < GVAR(unloadOnKilled)}) then {
[_x, _object] call ace_cargo_fnc_unloadItem; _delete = !([_x, _object] call ace_cargo_fnc_unloadItem); // If a safe position to unload cannot be found fnc_unloadItem returns false, delete cargo instead
} else { };
if (_delete) then {
detach _x; detach _x;
deleteVehicle _x; deleteVehicle _x;
}; };
}; };
} forEach _loaded; } forEachReversed _loaded;
// In case vehicle is killed, but not deleted, reset loaded list // In case vehicle is killed, but not deleted, reset loaded list
_object setVariable [QGVAR(loaded), [], true]; _object setVariable [QGVAR(loaded), [], true];