Add cleanup of destroyed vehicles and CraterLong

This commit is contained in:
ebayShopper
2017-06-24 11:14:32 -04:00
parent a7f2c88c32
commit aab4262ebb
2 changed files with 25 additions and 4 deletions

View File

@@ -13,6 +13,7 @@
[UPDATED] Newest version of DayZero enterable buildings, which fixes #1601 - provided by Tansien and Zac https://zombies.nu/
[UPDATED] Locking and unlocking safes no longer plays the medic animation. #1942 @SmokeyBR
[UPDATED] Locking and unlocking safes now uses call instead of spawn on the server. This fixes the user input lock and safes appearing to disappear momentarily when server FPS is low.
[UPDATED] Added cleanup of destroyed vehicles and CraterLong after 25 minutes in sched_corpses.sqf
[FIXED] Kamaz refuel trucks no longer allow automatic refueling. #1855 @coresync2k @dreamforceinc
[FIXED] Trees at POIs can be chopped down now. Other trees spawned with createVehicle can be added to dayz_treeTypes in variables.sqf to allow chopping them down.

View File

@@ -26,12 +26,13 @@ sched_co_deleteVehicle = {
sched_corpses = {
private ["_delQtyG","_delQtyZ","_delQtyP","_addFlies","_x","_deathTime","_onoff","_delQtyAnimal","_sound","_deathPos","_cpos","_animal","_nearPlayer"];
private ["_delQtyG","_delQtyZ","_delQtyP","_addFlies","_x","_deathTime","_onoff","_delQtyAnimal","_sound","_deathPos","_cpos","_animal","_nearPlayer","_delQtyV","_craters"];
// EVERY 2 MINUTE
// DELETE UNCONTROLLED ZOMBIES --- PUT FLIES ON FRESH PLAYER CORPSES --- REMOVE OLD FLIES & CORPSES
_delQtyZ = 0;
_delQtyP = 0;
_delQtyG = 0;
_delQtyV = 0;
_addFlies = 0;
{
if (local _x && {_x isKindOf "CAManBase"}) then {
@@ -117,6 +118,25 @@ sched_corpses = {
};
};
};
if (_x in vehicles) then {
_deathTime = _x getVariable ["sched_co_deathTime", -1];
if (_deathTime == -1) then {
_deathTime = diag_tickTime;
_x setVariable ["sched_co_deathTime", _deathTime];
};
// 25 minutes = how long a destroyed vehicle stays on the map
if (diag_tickTime - _deathTime > 25*60) then {
_craters = _x nearObjects ["CraterLong",50];
if (count _craters > 0) then {
deleteVehicle (_craters select 0);
};
_x call sched_co_deleteVehicle;
_delQtyV = _delQtyV + 1;
};
};
} forEach allDead;
_delQtyAnimal = 0;
@@ -140,9 +160,9 @@ sched_corpses = {
} forEach allGroups;
#ifdef SERVER_DEBUG
if (_delQtyZ+_delQtyP+_addFlies+_delQtyGrp+_delQtyG > 0) then {
diag_log format ["%1: Deleted %2 uncontrolled zombies, %3 uncontrolled animals, %4 dead character bodies, %7 ghosts and %5 empty groups. Added %6 flies.",__FILE__,
_delQtyZ,_delQtyAnimal,_delQtyP,_delQtyGrp,_addFlies,_delQtyG];
if (_delQtyZ+_delQtyP+_addFlies+_delQtyGrp+_delQtyG+_delQtyV > 0) then {
diag_log format ["%1: Deleted %2 uncontrolled zombies, %3 uncontrolled animals, %4 dead character bodies, %7 ghosts, %8 destroyed vehicles and %5 empty groups. Added %6 flies.",__FILE__,
_delQtyZ,_delQtyAnimal,_delQtyP,_delQtyGrp,_addFlies,_delQtyG,_delQtyV];
};
#endif