-
Notifications
You must be signed in to change notification settings - Fork 100
/
basedestruction.sqf
78 lines (76 loc) · 2.57 KB
/
basedestruction.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
private ["_option","_location","_object","_objects","_objectClasses","_i","_dir","_objectID","_objectUID"];
// global vars
//if (isNil "BD_center") then { BD_center = [0,0,0]; };
if (isNil "BD_radius") then { BD_radius = 10; };
_option = _this select 0;
switch (_option) do {
case "center": {
BD_center = getPosATL player;
cutText [format["center set to %1", BD_center], "PLAIN DOWN"];
};
case "radius": {
if (isNil "BD_center") then {
cutText ["center not set", "PLAIN DOWN"];
} else {
BD_radius = player distance BD_center;
cutText [format["radius set to %1 m", BD_radius], "PLAIN DOWN"];
};
};
case "dome": {
if (isNil "BD_center") then {
cutText ["center not set", "PLAIN DOWN"];
} else {
_objects = [];
// center
_object = "Plastic_Pole_EP1_DZ" createVehicleLocal BD_center;
_object setPosATL BD_center;
_objects set [0, _object];
// circle
for "_i" from 0 to 360 step (270 / BD_radius) do {
_location = [(BD_center select 0) + ((cos _i) * BD_radius), (BD_center select 1) + ((sin _i) * BD_radius), BD_center select 2];
_object = "WoodLargeWall_Preview_DZ" createVehicleLocal _location;
_dir = ((BD_center select 0) - (_location select 0)) atan2 ((BD_center select 1) - (_location select 1));
_object setDir _dir;
_object setPosATL _location;
_objects set [count _objects, _object];
};
// top
_location = [BD_center select 0, BD_center select 1, (BD_center select 2) + BD_radius];
_object = "WoodFloor_Preview_DZ" createVehicleLocal _location;
_object setPosATL _location;
_objects set [count _objects, _object];
sleep 30;
{
deleteVehicle _x;
} forEach _objects;
};
};
case "destroy": {
if (isNil "BD_center") then {
cutText ["center not set", "PLAIN DOWN"];
} else {
if (BD_radius > 100) then {
cutText [format["area is to large for base destruction (radius %1 > 100)", BD_radius], "PLAIN DOWN"];
} else {
_objectClasses = dayz_allowedObjects;
if (BD_vehicles) then {
_objectClasses = _objectClasses + ["LandVehicle","Helicopter","Plane","Ship"];
};
_objects = nearestObjects [BD_center, _objectClasses, BD_radius];
_i = 0;
{
if (alive _x) then {
_objectID = _x getVariable ["ObjectID", "0"];
_objectUID = _x getVariable ["ObjectUID", "0"];
PVDZE_obj_Delete = [_objectID, _objectUID, player];
publicVariableServer "PVDZE_obj_Delete";
//_x setDamage 1;
deleteVehicle _x;
_i = _i + 1;
};
} forEach _objects;
cutText [format["%1 of %2 objects deleted", _i, count _objects], "PLAIN DOWN"];
};
};
};
};