Revert "Revert "Merge branch 'master' of https://github.com/EpochModTeam/DayZ-Epoch""

This reverts commit 109ec5c9a3.
This commit is contained in:
seelenapparat
2021-08-24 15:47:06 +02:00
parent c801365a1f
commit d1abb66e9f
145 changed files with 9200 additions and 627 deletions

View File

@@ -0,0 +1,39 @@
/*
Safe Zone Relocate by salival (https://github.com/oiad)
*/
private ["_customPosition","_minDist","_maxDist","_maxDamage","_message","_nearVehicles","_objDist","_position","_safeZonePos","_safeZoneRadius","_useCustomPosition","_unlock"];
_useCustomPosition = false; // Enable a custom position to move vehicles to (i.e a junk yard)
_customPosition = [6942.64,15121.6,0]; // Position for vehicles to be moved to if _useCustomPosition = true;
_minDist = 5; // Minimum distance from the custom position to move vehicles to
_maxDist = 1000; // Maximum distance from the safe zone position to find a safe position or custom position for relocation, setting this too low can make vehicles spawn very close to other vehicles.
_objDist = 15; // Minimum distance from the safe position for relocation to the center of the nearest object. Specifying quite a large distance here will slow the function and might often fail to find a suitable position.
_unlock = false; // Unlock vehicle when moved from the safe zone?
_maxDamage = 0.75; // Vehicles above or equal to this amount of damage will be deleted
{
_safeZonePos = _x select 0;
_safeZoneRadius = _x select 1;
_nearVehicles = _safeZonePos nearEntities [["Air","LandVehicle","Ship"],_safeZoneRadius];
{
if (damage _x >= _maxDamage) then {
_message = format ["[SAFEZONE] %1 was deleted from the server for being too damaged before relocate: @%2 %3",typeOf _x,mapGridPosition _x,getPosATL _x];
diag_log _message;
[_x getVariable["ObjectID","0"],_x getVariable["ObjectUID","0"],_x] call server_deleteObjDirect;
deleteVehicle _x;
} else {
if (_useCustomPosition) then {
_position = [_customPosition,_minDist,_maxDist,_objDist,1,0,0,[]] call BIS_fnc_findSafePos;
} else {
_position = [_safeZonePos,(_safeZoneRadius + 50),_maxDist,_objDist,if (_x isKindOf "Ship") then {2} else {0},0,0,[],[_safeZonePos,_safeZonePos]] call BIS_fnc_findSafePos;
};
_x setPos _position;
[_x,"position"] call server_updateObject;
if (_unlock && {locked _x}) then {_x setVehicleLock "UNLOCKED"};
_message = format ["[SAFEZONE] %1 was moved out of a safe zone to: @%2 %3",typeOf _x,mapGridPosition _position,_position];
diag_log _message;
};
} forEach _nearVehicles;
} forEach DZE_safeZonePosArray;

View File

@@ -36,7 +36,7 @@ sched_corpses = {
_addFlies = 0;
{
if (local _x && {_x isKindOf "CAManBase"}) then {
if (_x isKindOf "zZombie_Base") then {
if (_x isKindOf "zZombie_Base" || {typeOf _x == "z_bloodsucker"}) then {
_x call sched_co_deleteVehicle;
_delQtyZ = _delQtyZ + 1;
} else {
@@ -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
};

View File

@@ -102,7 +102,7 @@ if ((playersNumber west + playersNumber civilian) == 0) exitWith {
_damage = _x select 8;
_storageMoney = _x select 9;
if ((_type isKindOf "AllVehicles")) then {
if ((_type isKindOf "AllVehicles") && !(_type isKindOf "StaticWeapon")) then {
_VehicleQueue set [_vQty,_x];
_vQty = _vQty + 1;
} else {
@@ -341,7 +341,7 @@ if ((playersNumber west + playersNumber civilian) == 0) exitWith {
// prevent immediate hive write when vehicle parts are set up
_object setVariable ["lastUpdate",diag_ticktime];
_object setVariable ["ObjectID", _idKey, true];
if (Z_SingleCurrency && ZSC_VehicleMoneyStorage) then {
if (Z_SingleCurrency && {ZSC_VehicleMoneyStorage}) then {
_object setVariable ["cashMoney", _storageMoney, true];
};
@@ -466,4 +466,7 @@ if (_hiveLoaded) then {
//Update gear last after all dynamic vehicles are created to save random loot to database (low priority)
{[_x,"gear"] call server_updateObject} count _vehiclesToUpdate;
};
if (DZE_SafeZone_Relocate) then {
execVM "\z\addons\dayz_server\system\safeZoneRelocate.sqf";
};
};