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.
This commit is contained in:
A Man
2021-08-18 18:38:03 +02:00
parent fa75563ae1
commit be7898aac1
11 changed files with 294 additions and 122 deletions

View File

@@ -97,7 +97,7 @@ sched_corpses = {
if (_onoff == 1) then {
_sound = createSoundSource["Sound_Flies",getPosATL _x,[],0];
_sound attachTo [_x];
_x setVariable ["sched_co_fliesSource", _sound];
_x setVariable ["sched_co_fliesSource", _sound,[false,true] select (DZE_Bury_Body || DZE_Butcher_Body)];
//diag_log "create sound";
};
// broadcast flies status for everyone periodically, to update visible swarm

View File

@@ -1,4 +1,4 @@
#define PATH "z\addons\dayz_server\system\scheduler\"
#define PATH "\z\addons\dayz_server\system\scheduler\"
call compile preprocessFileLineNumbers (PATH+"sched_corpses.sqf");
call compile preprocessFileLineNumbers (PATH+"sched_lootpiles.sqf");
@@ -6,8 +6,11 @@ call compile preprocessFileLineNumbers (PATH+"sched_sync.sqf");
call compile preprocessFileLineNumbers (PATH+"sched_safetyVehicle.sqf");
call compile preprocessFileLineNumbers (PATH+"sched_event.sqf");
call compile preprocessFileLineNumbers (PATH+"sched_traps.sqf");
if (DZE_Bury_Body || DZE_Butcher_Body) then {
call compile preprocessFileLineNumbers (PATH+"sched_lootCrates.sqf");
};
[
local _list = [
// period offset code <-> ctx init code ->ctx
[ 60, 0, sched_event, sched_event_init ],
[ 60, 224, sched_corpses ],
@@ -17,17 +20,12 @@ call compile preprocessFileLineNumbers (PATH+"sched_traps.sqf");
[ 120, 48, sched_safetyVehicle ],
[ 360, 480, sched_fps ],
[ 30, 60, sched_traps, sched_traps_init ]
] execFSM ("z\addons\dayz_code\system\scheduler\scheduler.fsm");
];
//diag_log [ __FILE__, "Scheduler started"];
if (DZE_Bury_Body || DZE_Butcher_Body) then {
_list set [count _list, [ 60, 240, sched_lootCrates ]];
};
_list execFSM ("\z\addons\dayz_code\system\scheduler\scheduler.fsm");
/*
// (see ViralZeds.hpp -> zombie_agent.fsm -> zombie_findOwner.sqf), called when a zombie becomes "local" to the server after the player disconnected
zombie_findOwner = {
(_this select 0) call fa_deleteVehicle;
};
*/
//diag_log [ __FILE__, "Scheduler started"];

View File

@@ -0,0 +1,38 @@
#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
};