Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2014
838
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.70 KB | None | 0 0
  1. purge = {
  2. if(!isNull(_this)) then {
  3. _this enableSimulation false;
  4. _this removeAllMPEventHandlers "mpkilled";
  5. _this removeAllMPEventHandlers "mphit";
  6. _this removeAllMPEventHandlers "mprespawn";
  7. _this removeAllEventHandlers "FiredNear";
  8. _this removeAllEventHandlers "HandleDamage";
  9. _this removeAllEventHandlers "Killed";
  10. _this removeAllEventHandlers "Fired";
  11. _this removeAllEventHandlers "GetOut";
  12. _this removeAllEventHandlers "GetIn";
  13. _this removeAllEventHandlers "Local";
  14. clearVehicleInit _this;
  15. deleteVehicle _this;
  16. deleteGroup (group _this);
  17. _this = nil;
  18. };
  19. };
  20.  
  21. if (isServer) then {
  22. [] spawn
  23. {
  24. waitUntil {!(isNil "sm_done")};
  25. diag_log ["LinkCleaning CLEANUP Initialized"];
  26.  
  27. _lastlootcheck = diag_tickTime;
  28. _lastZombieClean = diag_tickTime;
  29. _lastGroupClean = diag_tickTime;
  30. _lastGullMod = diag_tickTime;
  31. _lastFixFps = diag_tickTime;
  32.  
  33. while {true} do {
  34. // 1 check
  35. if ((diag_tickTime - _lastlootcheck) > 180) then
  36. {
  37. _lastlootcheck = diag_tickTime;
  38. _ammobox = ["USLaunchersBox","RULaunchersBox","USSpecialWeapons_EP1","USVehicleBox"];
  39. _lootpiles = allMissionObjects "ReammoBox";
  40. _delQty = 0;
  41. {
  42. _keep = (_x getVariable ["permaLoot",false]) || (typeOf _x in _ammobox);
  43. if (!_keep) then {
  44. _nearby = {(isPlayer _x) and (alive _x)} count (_x nearEntities [["CAManBase","AllVehicles"], 130]);
  45. if (_nearby==0) then {
  46. deleteVehicle _x;
  47. sleep 0.025;
  48. _delQty = _delQty + 1;
  49. };
  50. };
  51. sleep 0.001;
  52. } forEach _lootpiles;
  53. };
  54. // 2 check
  55. if ((diag_tickTime - _lastFixFps) > 180) then
  56. {
  57. _lastFixFps = diag_tickTime;
  58. _allstartlk = ((allMissionObjects "WeaponHolder")+(allMissionObjects "Sound_Flies")+(allDead)+([0,0,0] nearEntities ['CAAnimalBase', 10000000]));
  59. diag_log format["LinkCleaning: Start cleaning. FPS : %1", diag_fps];
  60. {
  61. if (!isNull _x) then
  62. {
  63. if (_x in vehicles) then {deletevehicle _x;};
  64. _nearbylk1 = {(isPlayer _x) and (alive _x)} count (_x nearEntities [["CAManBase"], 450]);
  65. _keeplk = _x getVariable ["permaLoot",false];
  66. if ((_nearbylk1 == 0) && (!_keeplk) && !(_x in alldead)) then
  67. {
  68. deleteVehicle _x;
  69. };
  70. _nearbylk2 = {(isPlayer _x) and (alive _x)} count (_x nearEntities [["CAManBase"], 25]);
  71. if ((_nearbylk2 == 0) && (_x in alldead) && (_x isKindOf "zZombie_Base")) then
  72. {
  73. deleteVehicle _x;
  74. };
  75. if ((_nearbylk2 == 0) && (_x isKindOf "CAAnimalBase")) then {deleteVehicle _x;};
  76. };
  77. } foreach _allstartlk;
  78. diag_log ("LinkCleaning: Stop cleaning");
  79. };
  80. // 3 check
  81. if ((diag_tickTime - _lastZombieClean) > 180) then {
  82. _lastZombieClean = diag_tickTime;
  83. _randomzeds = entities "zZombie_Base";
  84. {
  85. if (local _x) then {
  86. _randomzeds = entities "zZombie_Base";
  87. _x call purge;
  88. sleep 0.025;
  89. } else {
  90. if (!alive _x) then {
  91. _pos = getPosATL _x;
  92. if (count _pos > 0) then {
  93. _nearby3 = {(isPlayer _x) and (alive _x)} count (_pos nearEntities [["CAManBase","AllVehicles"], 130]);
  94. if (_nearby3==0) then {
  95. _x call purge;
  96. sleep 0.025;
  97. };
  98. };
  99. };
  100. };
  101. sleep 0.001;
  102. } forEach _randomzeds;
  103. };
  104. // 4 check
  105. if ((diag_tickTime - _lastGroupClean) > 360) then {
  106. _lastGroupClean = diag_tickTime;
  107. {
  108. if (count units _x == 0) then
  109. {
  110. deleteGroup _x;
  111. };
  112. } forEach allGroups;
  113. };
  114. // 5 check
  115. if ((diag_tickTime - _lastGullMod) > 180) then {
  116. _lastGullMod = diag_tickTime;
  117. {
  118. _x call purge;
  119. } forEach entities "Seagull";
  120. };
  121. sleep 5;
  122. };
  123. };
  124. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement