convert dead players into graves after about 30 minutes

also removed _this = nil as it maybe actually causing more null objects
This commit is contained in:
[VB]AWOL
2013-12-04 09:38:27 -06:00
parent e88ef697f9
commit be18ef8339

View File

@@ -58,7 +58,7 @@ array_reduceSizeReverse = {
array_reduceSize = {
private ["_array1","_array","_count","_num"];
_array1 = _this select 0;
_array = _array1 - ["Hatchet_Swing","Machete_Swing","Fishing_Swing","sledge_swing","crowbar_swing"];
_array = _array1 - ["Hatchet_Swing","Machete_Swing","Fishing_Swing","sledge_swing","crowbar_swing","CSGAS"];
_count = _this select 1;
_num = count _array;
if (_num > _count) then {
@@ -138,7 +138,7 @@ eh_localCleanup = {
clearVehicleInit _unit;
deleteVehicle _unit;
deleteGroup _myGroupUnit;
_unit = nil;
//_unit = nil;
diag_log ("CLEANUP: DELETED A " + str(_type) );
};
}];
@@ -597,6 +597,7 @@ dayz_recordLogin = {
};
dayz_perform_purge = {
_this removeAllMPEventHandlers "mpkilled";
_this removeAllMPEventHandlers "mphit";
_this removeAllMPEventHandlers "mprespawn";
@@ -610,9 +611,81 @@ dayz_perform_purge = {
clearVehicleInit _this;
deleteVehicle _this;
deleteGroup (group _this);
_this = nil;
// _this = nil;
};
dayz_perform_purge_player = {
private ["_countr","_backpack","_backpackType","_backpackWpn","_backpackMag","_objWpnTypes","_objWpnQty","_location","_dir","_holder","_weapons","_magazines"];
diag_log ("Purging player: " + str(_this));
_location = getPosATL _this;
_dir = getDir _this;
_holder = createVehicle ["GraveDZE", _location, [], 0, "CAN_COLLIDE"];
_holder setDir _dir;
_holder setPosATL _location;
_holder enableSimulation false;
_weapons = weapons _this;
_magazines = magazines _this;
// find backpack
if(!(isNull unitBackpack _this)) then {
_backpack = unitBackpack _this;
_backpackType = typeOf _backpack;
_backpackWpn = getWeaponCargo _backpack;
_backpackMag = getMagazineCargo _backpack;
_holder addBackpackCargoGlobal [_backpackType,1];
// add items from backpack
_objWpnTypes = _backpackWpn select 0;
_objWpnQty = _backpackWpn select 1;
_countr = 0;
{
_holder addWeaponCargoGlobal [_x,(_objWpnQty select _countr)];
_countr = _countr + 1;
} forEach _objWpnTypes;
// add backpack magazine items
_objWpnTypes = _backpackMag select 0;
_objWpnQty = _backpackMag select 1;
_countr = 0;
{
_holder addMagazineCargoGlobal [_x,(_objWpnQty select _countr)];
_countr = _countr + 1;
} forEach _objWpnTypes;
};
// add weapons
{
_holder addWeaponCargoGlobal [_x, 1];
} forEach _weapons;
// add mags
{
_holder addMagazineCargoGlobal [_x, 1];
} forEach _magazines;
_this removeAllMPEventHandlers "mpkilled";
_this removeAllMPEventHandlers "mphit";
_this removeAllMPEventHandlers "mprespawn";
_this removeAllEventHandlers "FiredNear";
_this removeAllEventHandlers "HandleDamage";
_this removeAllEventHandlers "Killed";
_this removeAllEventHandlers "Fired";
_this removeAllEventHandlers "GetOut";
_this removeAllEventHandlers "GetIn";
_this removeAllEventHandlers "Local";
clearVehicleInit _this;
deleteVehicle _this;
deleteGroup (group _this);
// _this = nil;
};
dayz_removePlayerOnDisconnect = {
_this removeAllMPEventHandlers "mphit";
deleteVehicle _this;
@@ -621,7 +694,8 @@ dayz_removePlayerOnDisconnect = {
server_timeSync = {
//Send request
_key = "CHILD:307:";
private ["_year","_month","_day","_hour","_minute","_date","_key","_result","_outcome"];
_key = "CHILD:307:";
_result = _key call server_hiveReadWrite;
_outcome = _result select 0;
if(_outcome == "PASS") then {
@@ -659,13 +733,15 @@ server_spawncleanDead = {
_x call dayz_perform_purge;
sleep 0.025;
_delQtyZ = _delQtyZ + 1;
};
if (_x isKindOf "CAManBase") then {
_deathTime = _x getVariable ["processedDeath", diag_tickTime];
if (diag_tickTime - _deathTime > 3600) then {
_x call dayz_perform_purge;
sleep 0.025;
_delQtyP = _delQtyP + 1;
} else {
if (_x isKindOf "CAManBase") then {
_deathTime = _x getVariable ["processedDeath", diag_tickTime];
if (diag_tickTime - _deathTime > 1800) then {
_x call dayz_perform_purge_player;
sleep 0.025;
_delQtyP = _delQtyP + 1;
};
};
};
};
@@ -682,6 +758,7 @@ server_spawnCleanNull = {
_delQtyNull = 0;
{
if (isNull _x) then {
diag_log (format["CLEANUP: Purge performed on null OBJ: %1",_x]);
_x call dayz_perform_purge;
sleep 0.025;
_delQtyNull = _delQtyNull + 1;