Files
DayZ-Epoch/SQF/dayz_server/system/scheduler/sched_lootCrates.sqf
A Man be7898aac1 Add toggleable Bury and Butcher Bodies by salival
This also re-arranges the configVariables.sqf and loads the variables for both (server and client) first. This allows to check for certain variables like Z_SingleCurrency and stops the loading of all other Z_SingleCurrency variables even when Z_SingleCurrency was not on.
2021-08-18 18:38:03 +02:00

38 lines
1.1 KiB
Plaintext

#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
// Delete loot crates, graves and crosses after 25 minutes
sched_lootCrates = {
private ["_delQtyCrate","_crateTime","_objects","_crates","_graves","_cross"];
_delQtyCrate = 0;
#define CENTER getMarkerPos "center"
#define RADIUS ((getMarkerSize "center") select 1)*2
_crates = CENTER nearObjects ["DZ_AmmoBoxSmallUS",RADIUS];
_graves = CENTER nearObjects ["Grave",RADIUS];
_cross = CENTER nearObjects ["GraveCross1",RADIUS];
_objects = _crates + _graves + _cross;
{
if (_x getVariable ["bury",false]) then {
_crateTime = _x getVariable ["sched_co_crateTime", -1];
if (_crateTime == -1) exitWith {
_crateTime = diag_tickTime;
_x setVariable ["sched_co_crateTime", _crateTime];
};
if (diag_tickTime - _crateTime > 25*60) then {
_x call sched_co_deleteVehicle;
_delQtyCrate = _delQtyCrate + 1;
};
};
} forEach _objects;
#ifdef SERVER_DEBUG
if (_delQtyCrate> 0) then {
diag_log format ["%1: Deleted %2 bury/butcher objects.",__FILE__,_delQtyCrate];
};
#endif
objNull
};