-
Notifications
You must be signed in to change notification settings - Fork 2
/
initserver.sqf
251 lines (194 loc) · 5.93 KB
/
initserver.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
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
#include "\z\ace\addons\main\script_component.hpp"
#include "\z\ace\addons\main\script_macros.hpp"
call compile preprocessfile "node_modules\shk_pos\functions\shk_pos_init.sqf"; // absolute basic!
DEBUG_MODE = false;
if (!isMultiplayer) then {
DEBUG_MODE = true;
};
publicVariable "DEBUG_MODE";
[] call BC_setup_fnc_initialSpawnServer;
addMissionEventHandler ["HandleDisconnect",{
params ["_unit", "_id", "_uid", "_name"];
if (_unit getVariable ["BC_spawnSelector", false] && !OPFOR_TELEPORTED) then {
private _spawnSelector = [east, _unit] call BC_setup_fnc_getHighestRankOfSide;
_spawnSelector setVariable ["BC_spawnSelector", true];
[] remoteExec ["BC_setup_fnc_openSpawnDialog", _spawnSelector];
};
if (_unit getVariable ["BC_potentToBuy", false]) then {
private _potentToBuy = [side _unit, _unit] call BC_setup_fnc_getHighestRankOfSide;
_potentToBuy setVariable ["BC_potentToBuy", true, true];
["The Commander disconnected. You are now authorized to buy."] remoteExec ["hint", _unit];
};
if (_unit getVariable ["GRAD_loadout_applicationCount",0] < 1) then {
deleteVehicle _unit;
};
false
}];
// read parameters
TIME_OF_DAY = ["TIME_OF_DAY", 10] call BIS_fnc_getParamValue;
publicVariable "TIME_OF_DAY";
WEATHER_OVERCAST = ["WEATHER_OVERCAST", -1] call BIS_fnc_getParamValue;
publicVariable "WEATHER_OVERCAST";
WEATHER_FOG = ["WEATHER_FOG", -1] call BIS_fnc_getParamValue;
publicVariable "WEATHER_FOG";
WEATHER_WIND = ["WEATHER_WIND", -1] call BIS_fnc_getParamValue;
publicVariable "WEATHER_WIND";
BLUFOR_SPAWN_DISTANCE = ["BLUFOR_SPAWN_DISTANCE", 3000] call BIS_fnc_getParamValue;
publicVariable "BLUFOR_SPAWN_DISTANCE";
TIME_ACCELERATION = ["TIME_ACCELERATION", 1] call BIS_fnc_getParamValue;
GRAD_REPLAY_PRECISION = ["GRAD_REPLAY_PRECISION", 4] call BIS_fnc_getParamValue;
publicVariable "GRAD_REPLAY_PRECISION"; // clients need to know this
AR3PLAY_ENABLE_REPLAY = (["AR3PLAY_ENABLE_REPLAY", 0] call BIS_fnc_getParamValue) == 1;
AR3PLAY_IS_STREAMABLE = (["AR3PLAY_IS_STREAMABLE", 0] call BIS_fnc_getParamValue) == 1;
JIP_TIME_ALLOWED = ["JIP_TIME_ALLOWED", 999999] call BIS_fnc_getParamValue;
publicVariable "JIP_TIME_ALLOWED"; // clients need to know this
// todo activate grad civs
PREPARATION_TIME = [3, ["PREPARATION_TIME", 0] call BIS_fnc_getParamValue] select (!DEBUG_MODE);
publicVariable "PREPARATION_TIME";
TRUCK_DESTROYED_NOT_CONQUERED = false;
publicVariable "TRUCK_DESTROYED_NOT_CONQUERED";
setCustomWeather = {
// get random shit
if (str WEATHER_OVERCAST isEqualTo "-1") then {
WEATHER_OVERCAST = [[
0.0,
0.1,
0.2,
0.3,
0.4,
0.5,
0.6,
0.7,
0.8,
0.9,
1.0
], [
0.3,
0.3,
0.1,
0.1,
0.05,
0.025,
0.025,
0.025,
0.025,
0.025,
0.025]] call BIS_fnc_selectRandomWeighted;
};
if (str WEATHER_FOG isEqualTo "-1") then {
WEATHER_FOG = [[
0.0,
0.05,
0.1,
0.2,
0.3,
0.4,
0.5,
0.6,
0.7,
0.8,
1.0
], [
0.5,
0.3,
0.1,
0.075,
0.01,
0.005,
0.005,
0.004,
0.003,
0.002,
0.001]] call BIS_fnc_selectRandomWeighted;
};
if (str WEATHER_WIND isEqualTo "-1") then {
WEATHER_WIND = (random 2) - (random 4);
};
diag_log format ["BC setup: setting wind to %1", WEATHER_WIND];
// basics
10 setOvercast WEATHER_OVERCAST;
10 setFog WEATHER_FOG;
setWind [WEATHER_WIND, WEATHER_WIND, true];
10 setWindForce 0.1;
// add specials dependent on values
if (WEATHER_OVERCAST > 0.5 && WEATHER_OVERCAST < 0.8) then {
10 setRain 0.5;
10 setRainbow 0.8;
};
if (WEATHER_OVERCAST >= 0.8) then {
10 setRain 1;
10 setLightnings 0.8;
};
// enforce changes
forceWeatherChange;
};
// allow view distance to be up to 10k
// set to full moon date
setDate [2015, 2, 1, TIME_OF_DAY, 1]; // set to 5:00 for perfect full moon
call setCustomWeather;
// set time acceleration
setTimeMultiplier TIME_ACCELERATION;
["Initialize", [true]] call BIS_fnc_dynamicGroups;
MISSION_STARTED = false;
publicVariable "MISSION_STARTED";
BLUFOR_ELIMINATED = false;
publicVariable "BLUFOR_ELIMINATED";
OPFOR_ELIMINATED = false;
publicVariable "OPFOR_ELIMINATED";
BLUFOR_CAPTURED = false;
publicVariable "BLUFOR_CAPTURED";
TRANSMISSION_COMPLETE = false;
publicVariable "TRANSMISSION_COMPLETE";
MISSION_COMPLETED = false;
publicVariable "MISSION_COMPLETED";
OPFOR_TELEPORT_TARGET = [0, 0];
publicVariable "OPFOR_TELEPORT_TARGET";
BLUFOR_TELEPORT_TARGET = [0, 0];
publicVariable "BLUFOR_TELEPORT_TARGET";
VEHICLE_ORDERED_WEST = [false,0];
publicVariable "VEHICLE_ORDERED_WEST";
VEHICLE_ORDERED_EAST = [false,0];
publicVariable "VEHICLE_ORDERED_EAST";
BUY_OPTION_BLUFOR = true;
publicVariable "BUY_OPTION_BLUFOR";
BUY_OPTION_OPFOR = true;
publicVariable "BUY_OPTION_OPFOR";
OPFOR_TELEPORTED = false;
publicVariable "OPFOR_TELEPORTED";
BLUFOR_TELEPORTED = false;
publicVariable "BLUFOR_TELEPORTED";
// civilian traffic
CIV_KILLED = [[0,0,0],objNull];
publicVariable "CIV_KILLED";
CIV_GUNFIGHT_POS = [0,0,0];
publicVariable "CIV_GUNFIGHT_POS";
// replay
REPLAY_FINISHED = false;
publicVariable "REPLAY_FINISHED";
REPLAY_SPEED = 0.05;
REPLAY_STEPS_PER_TICK = 1;
// spectator side center
SPEC_CENTER = createCenter independent;
SPEC_GROUP = createGroup [SPEC_CENTER, false];
publicVariable "SPEC_GROUP";
[] call grad_civMarker_fnc_civGunfightListener;
[] call grad_civMarker_fnc_civKilledListener;
// let highest player rank choose spawn
private _spawnSelector = [east] call BC_setup_fnc_getHighestRankOfSide;
_spawnSelector setVariable ["BC_spawnSelector", true];
[] remoteExec ["BC_setup_fnc_openSpawnDialog", _spawnSelector];
/*
[] spawn {
waitUntil {
BLUFOR_TELEPORT_TARGET select 0 != 0
};
{
if (!isPlayer _x) then {
sleep 0.5;
_x setVariable ["BIS_noCoreConversations", true];
[_x] call BC_setup_fnc_teleportAI;
};
} forEach allUnits;
};
*/
diag_log format ["setup: server done"];