-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrepetitive_cleanup.sqf
133 lines (103 loc) · 3.02 KB
/
repetitive_cleanup.sqf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
AUTHOR: aeroson
NAME: repetitive_cleanup.sqf
VERSION: 1.7
DESCRIPTION:
Can delete everything that is not really needed
dead bodies, dropped items, smokes, chemlights, explosives, empty groups
Works even on Altis, it eats only items which are 100m from all units
USAGE:
in server's init
[
60, // seconds to delete dead bodies (0 means don't delete)
5*60, // seconds to delete dead vehicles (0 means don't delete)
2*60, // seconds to delete dropped weapons (0 means don't delete)
10*60, // seconds to deleted planted explosives (0 means don't delete)
0 // seconds to delete dropped smokes/chemlights (0 means don't delete)
] execVM 'repetitive_cleanup.sqf';
will delete dead bodies after 60 seconds (1 minute)
will delete dead vehicles after 5*60 seconds (5 minutes)
will delete weapons after 2*60 seconds (2 minutes)
will delete planted explosives after 10*60 seconds (10 minutes)
will not delete any smokes/chemlights since its disabled (set to 0)
*/
if (!isServer) exitWith {}; // isn't server
#define PUSH(A,B) A set [count (A),B];
#define REM(A,B) A=A-[B];
private ["_ttdBodies","_ttdVehicles","_ttdWeapons","_ttdPlanted","_ttdSmokes","_delete","_unit"];
_ttdBodies=[_this,0,0,[0]] call BIS_fnc_param;
_ttdVehicles=[_this,1,0,[0]] call BIS_fnc_param;
_ttdWeapons=[_this,2,0,[0]] call BIS_fnc_param;
_ttdPlanted=[_this,3,0,[0]] call BIS_fnc_param;
_ttdSmokes=[_this,4,0,[0]] call BIS_fnc_param;
if (_ttdWeapons<=0 && _ttdPlanted<=0 && _ttdSmokes<=0 && _ttdBodies<=0 && _ttdVehicles<=0) exitWith {};
_objects=[];
_items=[];
_delete = {
_object = _this select 0;
_time = _this select 1;
if(_objects find _object == -1) then {
PUSH(_objects,_object)
PUSH(_items,_time+time)
};
};
while{true} do {
sleep 10;
if (_ttdBodies>0) then {
{
if(!isPlayer _x) then {
[_x, _ttdBodies] call _delete;
};
} forEach allDeadMen;
};
if (_ttdVehicles>0) then {
{
if(!isPlayer _x) then {
[_x, _ttdVehicles] call _delete;
};
} forEach (allDead - allDeadMen);
};
{
_unit = _x;
if (_ttdWeapons>0) then {
{
{
[_x, _ttdWeapons] call _delete;
} forEach (getpos _unit nearObjects [_x, 100]);
} forEach ["WeaponHolder","GroundWeaponHolder","WeaponHolderSimulated"];
};
if (_ttdPlanted>0) then {
{
{
[_x, _ttdPlanted] call _delete;
} forEach (getpos _unit nearObjects [_x, 100]);
} forEach ["TimeBombCore"];
};
if (_ttdSmokes>0) then {
{
{
[_x, _ttdSmokes] call _delete;
} forEach (getpos _unit nearObjects [_x, 100]);
} forEach ["SmokeShell"];
};
} forEach allUnits;
{
if ((count units _x)==0) then {
deleteGroup _x;
};
} forEach allGroups;
{
if(isNull(_x)) then {
_objects set[_forEachIndex, 0];
_items set[_forEachIndex, 0];
} else {
if(_items select _forEachIndex < time) then {
deleteVehicle _x;
_objects set[_forEachIndex, 0];
_items set[_forEachIndex, 0];
};
};
} forEach _objects;
REM(_objects,0)
REM(_items,0)
};