Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- purge = {
- if(!isNull(_this)) then {
- _this enableSimulation false;
- _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;
- };
- };
- if (isServer) then {
- [] spawn
- {
- waitUntil {!(isNil "sm_done")};
- diag_log ["LinkCleaning CLEANUP Initialized"];
- _lastlootcheck = diag_tickTime;
- _lastZombieClean = diag_tickTime;
- _lastGroupClean = diag_tickTime;
- _lastGullMod = diag_tickTime;
- _lastFixFps = diag_tickTime;
- while {true} do {
- // 1 check
- if ((diag_tickTime - _lastlootcheck) > 180) then
- {
- _lastlootcheck = diag_tickTime;
- _ammobox = ["USLaunchersBox","RULaunchersBox","USSpecialWeapons_EP1","USVehicleBox"];
- _lootpiles = allMissionObjects "ReammoBox";
- _delQty = 0;
- {
- _keep = (_x getVariable ["permaLoot",false]) || (typeOf _x in _ammobox);
- if (!_keep) then {
- _nearby = {(isPlayer _x) and (alive _x)} count (_x nearEntities [["CAManBase","AllVehicles"], 130]);
- if (_nearby==0) then {
- deleteVehicle _x;
- sleep 0.025;
- _delQty = _delQty + 1;
- };
- };
- sleep 0.001;
- } forEach _lootpiles;
- };
- // 2 check
- if ((diag_tickTime - _lastFixFps) > 180) then
- {
- _lastFixFps = diag_tickTime;
- _allstartlk = ((allMissionObjects "WeaponHolder")+(allMissionObjects "Sound_Flies")+(allDead)+([0,0,0] nearEntities ['CAAnimalBase', 10000000]));
- diag_log format["LinkCleaning: Start cleaning. FPS : %1", diag_fps];
- {
- if (!isNull _x) then
- {
- if (_x in vehicles) then {deletevehicle _x;};
- _nearbylk1 = {(isPlayer _x) and (alive _x)} count (_x nearEntities [["CAManBase"], 450]);
- _keeplk = _x getVariable ["permaLoot",false];
- if ((_nearbylk1 == 0) && (!_keeplk) && !(_x in alldead)) then
- {
- deleteVehicle _x;
- };
- _nearbylk2 = {(isPlayer _x) and (alive _x)} count (_x nearEntities [["CAManBase"], 25]);
- if ((_nearbylk2 == 0) && (_x in alldead) && (_x isKindOf "zZombie_Base")) then
- {
- deleteVehicle _x;
- };
- if ((_nearbylk2 == 0) && (_x isKindOf "CAAnimalBase")) then {deleteVehicle _x;};
- };
- } foreach _allstartlk;
- diag_log ("LinkCleaning: Stop cleaning");
- };
- // 3 check
- if ((diag_tickTime - _lastZombieClean) > 180) then {
- _lastZombieClean = diag_tickTime;
- _randomzeds = entities "zZombie_Base";
- {
- if (local _x) then {
- _randomzeds = entities "zZombie_Base";
- _x call purge;
- sleep 0.025;
- } else {
- if (!alive _x) then {
- _pos = getPosATL _x;
- if (count _pos > 0) then {
- _nearby3 = {(isPlayer _x) and (alive _x)} count (_pos nearEntities [["CAManBase","AllVehicles"], 130]);
- if (_nearby3==0) then {
- _x call purge;
- sleep 0.025;
- };
- };
- };
- };
- sleep 0.001;
- } forEach _randomzeds;
- };
- // 4 check
- if ((diag_tickTime - _lastGroupClean) > 360) then {
- _lastGroupClean = diag_tickTime;
- {
- if (count units _x == 0) then
- {
- deleteGroup _x;
- };
- } forEach allGroups;
- };
- // 5 check
- if ((diag_tickTime - _lastGullMod) > 180) then {
- _lastGullMod = diag_tickTime;
- {
- _x call purge;
- } forEach entities "Seagull";
- };
- sleep 5;
- };
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement