Should fix flies spawning where player relogs

AI mods will need to setVariable "bodyName" on their dead units to
prevent them being cleaned up.
This commit is contained in:
ebaydayz
2016-11-23 17:14:00 -05:00
parent f49c8a4ed6
commit 97431f81c2

View File

@@ -26,20 +26,22 @@ sched_co_deleteVehicle = {
sched_corpses = {
private ["_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"];
// EVERY 2 MINUTE
// DELETE UNCONTROLLED ZOMBIES --- PUT FLIES ON FRESH PLAYER CORPSES --- REMOVE OLD FLIES & CORPSES
_delQtyZ = 0;
_delQtyP = 0;
_delQtyG = 0;
_addFlies = 0;
// diag_log "bodies ...";
{
if (local _x) then {
if (_x isKindOf "zZombie_Base") then {
_x call sched_co_deleteVehicle;
_delQtyZ = _delQtyZ + 1;
} else {
if (_x isKindOf "CAManBase") then {
//Only spawn flies on actual dead player, otherwise delete the body (clean up left over ghost from relogging, sometimes it is not deleted automatically by Arma or onPlayerDisconnect)
//AI mods will need to setVariable "bodyName" on their dead units to prevent them being cleaned up
if (_x getVariable["bodyName",""] != "") then {
_deathTime = _x getVariable ["sched_co_deathTime", -1];
if (_deathTime == -1) then {
_deathPos = _x getVariable [ "deathPos", getMarkerPos "respawn_west" ];
@@ -98,6 +100,9 @@ sched_corpses = {
PVCDZ_flies = [ _onoff, _x ];
publicVariable "PVCDZ_flies";
};
} else {
_x call sched_co_deleteVehicle;
_delQtyG = _delQtyG + 1;
};
};
};
@@ -124,9 +129,9 @@ sched_corpses = {
} forEach allGroups;
#ifdef SERVER_DEBUG
if (_delQtyZ+_delQtyP+_addFlies+_delQtyGrp > 0) then {
diag_log format ["%1: Deleted %2 uncontrolled zombies, %3 uncontrolled animals, %4 dead character bodies and %5 empty groups. Added %6 flies.", __FILE__,
_delQtyZ, _delQtyAnimal, _delQtyP,_delQtyGrp, _addFlies ];
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];
};
#endif