-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinitServer.sqf
More file actions
303 lines (297 loc) · 9.88 KB
/
initServer.sqf
File metadata and controls
303 lines (297 loc) · 9.88 KB
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
#include "includes.sqf"
authenicatedAdmins = [];
publicVariable "authenicatedAdmins";
initserverfinished = false; publicVariable "initserverfinished";
missionsetupprogress = 0; publicVariable "missionsetupprogress";
sleep 0.5;
// added advanced urban rapelling via serverside addon
/*independentcenter = createCenter independent;
civcenter = createCenter civilian;*/
logiccenter = createCenter sideLogic;
blufor setFriend [opfor, 0.1];// blufor enemy to opfpr
opfor setFriend [blufor, 0.1];// opfor enemy to opfor
blufor setFriend [independent, 0.1]; //blufor enemy to indi
independent setFriend [blufor, 0.1]; //indi enemy to blufor
opfor setFriend [independent, 1]; //opfor friendly to indi
independent setFriend [opfor, 1]; //indi freindly to opfor
#include "server\global_variables.sqf";
["Initialize"] call BIS_fnc_dynamicGroups;
mapsize = getnumber (configfile/"CfgWorlds"/worldName/"mapSize");
mapcentre = [mapsize / 2, mapsize /2, 0];// <-- is a posatl
sleep 0.5;
primarytargetcounter = 1;
previousmission = locationNull;
foundairfields = [];
pdflag = false;
[] spawn //moving markers on forward and fob
{
while {true} do
{
sleep 1;
if (not isnull forward) then
{
"forwardmarker" setMarkerPos getpos forward;
if ((alive forward) and (isTouchingGround forward) and (initserverfinished)) then // hide marker if fobveh isnt yet in the game or is in the air (ie, being dropped in)
{"forwardmarker" setMarkerAlpha 1}
else
{"fowardmarker" setMarkerAlpha 0};
};
if (not isnull fobveh) then
{
"fobmarker" setMarkerPos getpos fobveh;
if ((alive fobveh) and (isTouchingGround fobveh) and (initserverfinished)) then // hide marker if fobveh isnt yet in the game or is in the air (ie, being dropped in)
{"fobmarker" setMarkerAlpha 1}
else
{"fobmarker" setMarkerAlpha 0};
};
};
};
__tky_debug
if ((tolower worldName) in ["altis", "tanoa", "panthera3"]) then
{
diag_log "*** mission uses existing targetdata file";
_airportlogicgroup = createGroup logiccenter;
_logicgroup = createGroup logiccenter;
_loadfilename = format ["targetdata\%1.txt", (toLower worldName)];
altisdata = (loadfile _loadfilename) splitstring "\";
TESTOUTPUT = [];
//-------------------------
// BEWARE THE STRINGPARSER
//-------------------------
// I'M SO SORRY TANKY
{
// Get First Element and transform it into numbers, Also get rid of first brackets
_currentN = toArray ([[_x,1] call BIS_fnc_trimString,0,-1] call BIS_fnc_trimString);
// This will be used to check where we are.
// 1 is at position
// 2 is at radius
// 3 is at landmassid
// 4 is at status
// 5 is at type
// 6 is at ruin count
_arrayState = 0;
// Variables for the gameLogic
_targetName= "";
_targetLocation = [0,0,0];
_targetRadius = 0;
_targetlandmassId = 0;
_targetStatus = 0;
_targetType = 0;
_targetRuinCount = 0;
// Flag to check when we reached a '"', this means that the name will be coming up until the next '"'
_isName = false;
// Flag to check we have reached location bit
_isLocation = false;
_locationXF = true;
_locationYF = false;
_locationXString = "";
_locationYString = "";
_locationX = 0;
_locationY = 0;
_locationDone = false;
// Generic helper flag for the last 4 properties
_tnF = false;
_radiusString = "";
_landmassidstring = "";
_statusString = "";
_typeString = "";
_ruincountString = "";
{ // Name shite ------------------------------------------------------
if (_arrayState == 0) then {
if (_isName && (_x != 34)) then {_targetName = _targetName + (toString [_x]);};
if ((_x == 34)) then {
if ((!_isName)) then {
_isName = true;
} else {
_arrayState = 1;
}; //34 is '"'
};
};
// Location Shite --------------------------------------------------
if (_arrayState == 1) then {
if ((_x == 93) && (_isLocation)) then
{
_isLocation = false;
_locationXF = false;
_locationYF = false;
_arrayState = 2; // We are now at Radius
}; //91 is ']'
if (_isLocation) then {
if (_x == 44) then {
if (_locationYF) then // Second "," we now have X and Y and are at Z which is 0 anyway
{
_locationXF = false;
_locationYF = false;
};
if (_locationXF) then {
_locationXF = false;
_locationYF = true;
};
}; // 44 is ","
if (_locationXF) then {_locationXString = _locationXString + (toString [_x]);};
if (_locationYF && (_x != 44)) then {_locationYString = _locationYString + (toString [_x]);};
};
// Fill in location
if ((_arrayState == 2) && (!_locationDone)) then {
_locationX = parseNumber _locationXString;
_locationY = parseNumber _locationYString;
_targetLocation = [_locationX, _locationY, 0];
_locationDone = true;
};
if (_x == 91) then {_isLocation = true;}; //91 is '['
};
// Radius Shite --------------------------------------------------
if (_arrayState == 2) then {
if (_tnF) then {
_radiusString = _radiusString + (toString [_x]);
};
if (_x == 44) then {
if (!_tnF) then {_tnF = true;}
else {
_arrayState = 3;
_targetRadius = parseNumber _radiusString;
_tnF = false;
};
};
};
// Landmass ID Shite --------------------------------------------------
if (_arrayState == 3) then {
if (_tnF) then {
_landmassidstring = _landmassidstring + (toString [_x]);
};
if (_x == 44) then {
if (!_tnF) then {_tnF = true;}
else {
_arrayState = 4;
_targetlandmassId = parseNumber _landmassidstring;
_tnF = false;
};
};
};
// Status Shite --------------------------------------------------
if (_arrayState == 4) then {
if (_tnF) then {
_statusString = _statusString + (toString [_x]);
};
if (_x == 44) then {
if (!_tnF) then {_tnF = true;}
else {
_arrayState = 5;
_targetStatus = parseNumber _statusString;
_tnF = false;
};
};
};
// Type Shite --------------------------------------------------
if (_arrayState == 5) then {
if (_tnF) then {
_typeString = _typeString + (toString [_x]);
};
if (_x == 44) then {
if (!_tnF) then {_tnF = true;}
else {
_arrayState = 6;
_targetType = parseNumber _typeString;
_tnF = false;
};
};
};
// Ruin Shite --------------------------------------------------
if (_arrayState == 6) then {
if (_tnF) then {
_ruincountString = _ruincountString + (toString [_x]);
_targetRuinCount = parseNumber _ruincountString;
};
if (_x == 44) then {
if (!_tnF) then {_tnF = true;};
};
};
} foreach _currentN;
_logic = _logicgroup createUnit ["Logic", _targetLocation, [], 0, "NONE"];
if (_targetType == 2) then {
_logic = _airportlogicgroup createUnit ["Logic", _targetLocation, [], 0, "NONE"];
};
_logic setVariable ["targetname", _targetName];
_logic setVariable ["targetradius", _targetRadius];
_logic setVariable ["targetlandmassid", _targetlandmassId];
_logic setvariable ["targetstatus", _targetStatus];
_logic setVariable ["targettype", _targetType];
_logic setVariable ["targetruincount", _targetRuinCount];
if (_targetType == 2) then {
foundairfields pushback _logic;
};
if (false) then
{
_mname2 = format ["smn%1", _foreachindex];
_mkr2 = createMarker [_mname2, _targetLocation];
_mkr2 setMarkerShape "ELLIPSE";
_mkr2 setMarkerType "Empty";
_mkr2 setMarkerSize [_targetRadius,_targetRadius];
_mkr2 setMarkerText (str _foreachindex);
_mkr2 setMarkerBrush "Vertical";
};
//TESTOUTPUT pushBack _tempArr;
missionsetupprogress = 1;
publicVariable "missionsetupprogress";
} foreach altisdata;
//-------------------------
// REJOICE THE STRINGPARSER
//-------------------------
}else
{
diag_log "*** mission doesn't find a targetdata file and runs gptl instead";
_handle1 = [] execVM "server\getprimarytargetlocations.sqf";
waitUntil {scriptDone _handle1};
};
__tky_debug
//diag_log "*** initServer done targetdata stuff";
sleep 0.5;
if ((tolower worldName) isEqualTo "tanoa") then
{
_ntobjs = nearestTerrainObjects [[5693, 9930], [], 60, false];
//diag_log format ["marker4 is at %1 and nto is %2", getmarkerpos "marker_4", _ntobjs ];
{
if (_x inArea "marker_4") then
{
hideObjectGlobal _x;
//diag_log format ["hiding a %1", _x];
};
} foreach _ntobjs;
};
__tky_debug
if not (false) then
{
for "_m" from 1 to 100 do
{
_mname = format ["dep_safezone_marker_%1", _m];
_thismarkerpos = getMarkerPos _mname;
if ((_thismarkerpos select 0) isEqualTo 0 ) exitWith {};// no more markers, can quit loop.
_mname setMarkerAlpha 0; //marker exists and not testmode, so hide markers
};
};
__tky_debug
// ^^^^ hide dep safezone markers if not testmode
forward allowDamage false;
_handle2 = [] execVM "server\missionsetup.sqf";
__tky_debug
waitUntil {missionrunning};
sleep 0.5;
__tky_debug
_nul = execVM "server\tky_fobveh_killed_eh.sqf";
_nul = execVM "server\tky_forward_killed_eh.sqf";
__tky_debug
_nul = [] execVM "server\doprimary.sqf";
_nul = [] execVM "server\queuehints.sqf";
preservedvehicles = [];
"gotinvec" addPublicVariableEventHandler {preservedvehicles pushBackUnique gotinvec};
[] spawn
{
while {true} do
{// remove deads
sleep 5;
preservedvehicles = preservedvehicles select {alive _x};
};
};
Saro_fnc_bomber = compileFinal preProcessFileLineNumbers "server\PT_ai\sssb.sqf";
initserverfinished = true;
publicVariable "initserverfinished";