-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathai_delegation_full.patch
648 lines (633 loc) · 23.7 KB
/
ai_delegation_full.patch
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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
diff --git a/WarfareV2_073LiteCO.Chernarus/Client/FSM/updateavailableactions.fsm b/WarfareV2_073LiteCO.Chernarus/Client/FSM/updateavailableactions.fsm
index 1668fcd..2275600 100644
--- a/WarfareV2_073LiteCO.Chernarus/Client/FSM/updateavailableactions.fsm
+++ b/WarfareV2_073LiteCO.Chernarus/Client/FSM/updateavailableactions.fsm
@@ -119,7 +119,7 @@ class FSM
" _ai_delegation_fps = _ai_delegation_fps + diag_fps;" \n
" _ai_delegation_fps_count = _ai_delegation_fps_count + 1;" \n
" if (time - _ai_delegation_lastsent > (missionNamespace getVariable ""WFBE_C_AI_DELEGATION_FPS_INTERVAL"")) then { //--- Send the FPS Avg to the server." \n
- " [""RequestSpecial"", [""update-clientfps"", getPlayerUID(player), round(_ai_delegation_fps / _ai_delegation_fps_count)]] Call WFBE_CO_FNC_SendToServer;" \n
+ " //[""RequestSpecial"", [""update-clientfps"", getPlayerUID(player), round(_ai_delegation_fps / _ai_delegation_fps_count)]] Call WFBE_CO_FNC_SendToServer;" \n
" _ai_delegation_lastsent = time;" \n
" _ai_delegation_fps_count = 0;" \n
" _ai_delegation_fps = 0;" \n
diff --git a/WarfareV2_073LiteCO.Chernarus/Client/Init/Init_Client.sqf b/WarfareV2_073LiteCO.Chernarus/Client/Init/Init_Client.sqf
index bd549b1..296530d 100644
--- a/WarfareV2_073LiteCO.Chernarus/Client/Init/Init_Client.sqf
+++ b/WarfareV2_073LiteCO.Chernarus/Client/Init/Init_Client.sqf
@@ -137,7 +137,9 @@ if ((missionNamespace getVariable "WFBE_C_ENVIRONMENT_WEATHER_VOLUMETRIC") > 0)
//--- Global Client Variables.
sideID = sideJoined Call GetSideID;
clientTeam = group player;
+if (hasInterface) then {
clientTeams = missionNamespace getVariable Format['WFBE_%1TEAMS',sideJoinedText];
+};
playerType = typeOf player;
playerDead = false;
paramBoundariesRunning = false;
@@ -146,8 +148,10 @@ WFBE_Client_Logic = (WFBE_Client_SideJoined) Call WFBE_CO_FNC_GetSideLogic;
WFBE_Client_SideID = sideID;
WFBE_Client_Color = switch (WFBE_Client_SideJoined) do { case west: {missionNamespace getVariable "WFBE_C_WEST_COLOR"}; case east: {missionNamespace getVariable "WFBE_C_EAST_COLOR"}; case resistance: {missionNamespace getVariable "WFBE_C_GUER_COLOR"}};
WFBE_Client_Team = clientTeam;
+if (hasInterface) then {
WFBE_Client_Teams = clientTeams;
WFBE_Client_Teams_Count = count WFBE_Client_Teams;
+};
WFBE_Client_IsRespawning = false;
WFBE_Client_LastGroupJoinRequest = -5000;
WFBE_Client_PendingRequests = [];
@@ -188,6 +192,11 @@ hangarInRange = false;
enableTeamSwitch false;
+//--- AI delegation, Headless Client.
+if (!hasInterface) exitWith {
+ ["INITIALIZATION", Format ["Init_Client.sqf: Headless Client is complete at [%1]", time]] Call WFBE_CO_FNC_LogContent;
+};
+
//--- Import the client side upgrade informations.
ExecVM "Common\Config\Core_Upgrades\Labels_Upgrades.sqf";
diff --git a/WarfareV2_073LiteCO.Chernarus/Common/Common_Update_fps.sqf b/WarfareV2_073LiteCO.Chernarus/Common/Common_Update_fps.sqf
new file mode 100644
index 0000000..1f88316
--- /dev/null
+++ b/WarfareV2_073LiteCO.Chernarus/Common/Common_Update_fps.sqf
@@ -0,0 +1,40 @@
+/*
+ Среднее значение FPS.
+ TODO: Нужна проверка.
+*/
+
+private["_interval","_sleep","_uid","_hc","_fnc","_f"];
+
+gosa_fps_array = [[time, diag_frameno]];
+gosa_fps_array_size = 256;
+
+_interval = missionNamespace getVariable "WFBE_C_AI_DELEGATION_FPS_INTERVAL";
+_sleep = 15;
+
+if (isServer) then {
+ waitUntil{!isNil "serverInitComplete"};
+ waitUntil{serverInitComplete};
+ _fnc = {
+ missionNamespace setVariable ["WFBE_AI_DELEGATION_SERVER", _this];
+ };
+} else {
+ _uid = getPlayerUID player;
+ _hc = !hasInterface;
+ waitUntil{!isNil "clientInitComplete"};
+ waitUntil{clientInitComplete};
+ _fnc = {
+ ["RequestSpecial",
+ ["update-clientfps", _uid, _this, _hc]
+ ] Call WFBE_CO_FNC_SendToServer;
+ };
+};
+
+["INITIALIZATION", "Common_Update_fps.sqf: is loaded."] Call WFBE_CO_FNC_LogContent;
+
+while{true}do{
+ sleep _sleep;
+ [time,diag_frameno] call gosa_FNC_AddFPS;
+ _f = [_interval] call gosa_FNC_GetFPS;
+ _f = round((_f select 1) / (_f select 0));
+ _f call _fnc;
+};
diff --git a/WarfareV2_073LiteCO.Chernarus/Common/Functions/Common_AddFPS.sqf b/WarfareV2_073LiteCO.Chernarus/Common/Functions/Common_AddFPS.sqf
new file mode 100644
index 0000000..6feafa6
--- /dev/null
+++ b/WarfareV2_073LiteCO.Chernarus/Common/Functions/Common_AddFPS.sqf
@@ -0,0 +1,21 @@
+private["_a","_c","_l"];
+// Копия, чтобы `_a set [0,-1];` не влиял на глобальную переменную. TODO: Нужно оптимизировать.
+_a =+ gosa_fps_array;
+_c = count _a;
+_l = _a select (_c -1);
+
+// Можно не добавлять если разница во времени очень мала.
+if ((_l select 0)+0.5 < (_this select 0)) then {
+ //private["_s"];
+ // `2^n` поск использует `/2`.
+ //_s = 2048;
+ if (_c >= gosa_fps_array_size) then {
+ _a set [0,-1];
+ _a = _a -[-1];
+ _c = _c -1;
+ };
+
+ //-- Добавляем в конец.
+ _a set [_c, _this];
+ gosa_fps_array = _a;
+};
diff --git a/WarfareV2_073LiteCO.Chernarus/Common/Functions/Common_GetFPS.sqf b/WarfareV2_073LiteCO.Chernarus/Common/Functions/Common_GetFPS.sqf
new file mode 100644
index 0000000..6cc1a46
--- /dev/null
+++ b/WarfareV2_073LiteCO.Chernarus/Common/Functions/Common_GetFPS.sqf
@@ -0,0 +1,52 @@
+private["_r","_a","_c","_n","_chunk","_chunk_last","_time_admit","_time_lost"];
+
+//-- Время, которое Нужно учитывать.
+_time_admit = _this select 0;
+
+_a = gosa_fps_array;
+_c = count _a;
+_n = _c -1;
+
+//-- Куски, первый и последний.
+_chunk = _a select 0;
+_chunk_last = _a select _n;
+
+//-- Время, которое Можно учитывать.
+_time_lost = ((_chunk_last select 0) - (_chunk select 0));
+
+// Ошибки данных.
+if (_time_admit >= _time_lost or _time_admit < 0 or _time_lost <= 0) then {
+ _r = [_time_lost, (_chunk_last select 1) - (_chunk select 1)];
+
+}else{
+ private["_time_first"];
+ //_n = round (_c - (_c*(_time_admit/_time_lost)));
+ // Так с первой попытки нужный кусок найдется, нет.
+
+ //-- Время, которое должно быть у начального куска.
+ //-- Точное _time_first отсутствует в массиве _a обычно,
+ //-- оно чуть меньше/больше начального куска.
+ _time_first = ((_chunk_last select 0) - _time_admit);
+
+ //-- Ищем начальный кусок.
+ while {isNil "_r"} do {
+ _chunk = _a select round _n;
+
+ // TODO: Улучшить точность.
+ if (_c > 1) then {
+ _c = (_c/2);
+ if (_time_first > (_chunk select 0)) then {
+ _n = _n+_c;
+ }else{
+ _n = _n-_c;
+ };
+ }else{
+ _r = [(_chunk_last select 0) - (_chunk select 0),
+ (_chunk_last select 1) - (_chunk select 1)];
+ };
+
+ }; // while
+
+};
+
+_r;
diff --git a/WarfareV2_073LiteCO.Chernarus/Common/Init/Init_Common.sqf b/WarfareV2_073LiteCO.Chernarus/Common/Init/Init_Common.sqf
index f9e5be4..0d9931d 100644
--- a/WarfareV2_073LiteCO.Chernarus/Common/Init/Init_Common.sqf
+++ b/WarfareV2_073LiteCO.Chernarus/Common/Init/Init_Common.sqf
@@ -127,6 +127,9 @@ WFBE_CO_FNC_WaypointSimple = Compile preprocessFileLineNumbers "Common\Functions
WFBE_CO_FNC_WaypointsAdd = Compile preprocessFileLineNumbers "Common\Functions\Common_WaypointsAdd.sqf";
WFBE_CO_FNC_WaypointsRemove = Compile preprocessFileLineNumbers "Common\Functions\Common_WaypointsRemove.sqf";
+gosa_FNC_GetFPS = Compile preprocessFileLineNumbers "Common\Functions\Common_GetFPS.sqf";
+gosa_FNC_AddFPS = Compile preprocessFileLineNumbers "Common\Functions\Common_AddFPS.sqf";
+
["INITIALIZATION", "Init_Common.sqf: Functions are initialized."] Call WFBE_CO_FNC_LogContent;
varQueu = random(10)+random(100)+random(1000);
@@ -339,6 +342,9 @@ if (isServer) then {
//--- Airports Init.
ExecVM "Common\Init\Init_Airports.sqf";
+//--- diag_fps.
+ExecVM "Common\Common_Update_fps.sqf";
+
["INITIALIZATION", "Init_Common.sqf: Config Files are loaded."] Call WFBE_CO_FNC_LogContent;
//--- Boundaries, use setPos to find the perfect spot on other islands and worldName to determine the island name (editor: diag_log worldName; player setPos [0,5120,0]; ).
diff --git a/WarfareV2_073LiteCO.Chernarus/Common/Init/Init_CommonConstants.sqf b/WarfareV2_073LiteCO.Chernarus/Common/Init/Init_CommonConstants.sqf
index 1835d5a..f5b96bb 100644
--- a/WarfareV2_073LiteCO.Chernarus/Common/Init/Init_CommonConstants.sqf
+++ b/WarfareV2_073LiteCO.Chernarus/Common/Init/Init_CommonConstants.sqf
@@ -54,6 +54,10 @@ WFBE_UP_SUPPLYPARADROP = 16;
WFBE_UP_ARTYAMMO = 17;
WFBE_UP_IRSMOKE = 18;
+gosa_load_balancing_sv = 100;
+gosa_load_balancing_hc = 150;
+gosa_load_balancing_cl = 33;
+
//--- New Variables, use isNil to check whether it's already defined or not (MP parameters).
//--- AI.
@@ -64,7 +68,7 @@ if (isNil {missionNamespace getVariable "WFBE_C_AI_MAX"}) then {missionNamespace
if (isNil {missionNamespace getVariable "WFBE_C_AI_DELEGATION"}) then {missionNamespace setVariable ["WFBE_C_AI_DELEGATION", 0]}; //--- Enable AI delegation (creation of ai on the client).
missionNamespace setVariable ["WFBE_C_AI_DELEGATION_FPS_INTERVAL", 60*3]; //--- A client send it's FPS average each x seconds to the server.
missionNamespace setVariable ["WFBE_C_AI_DELEGATION_FPS_MIN", 25]; //--- A client can handle groups if it's FPS average is above x.
-missionNamespace setVariable ["WFBE_C_AI_DELEGATION_GROUPS_MAX", 1]; //--- A client max have up to x groups managed on his computer (high values may makes lag, be careful).
+missionNamespace setVariable ["WFBE_C_AI_DELEGATION_GROUPS_MAX", 15]; //--- A client max have up to x groups managed on his computer (high values may makes lag, be careful).
missionNamespace setVariable ["WFBE_C_AI_PATROL_RANGE", 400];
if (isNil {missionNamespace getVariable "WFBE_C_AI_TEAMS_ENABLED"}) then {missionNamespace setVariable ["WFBE_C_AI_TEAMS_ENABLED", 1]}; //--- Enable or disable the AI Teams.
if (isNil {missionNamespace getVariable "WFBE_C_AI_TEAMS_JIP_PRESERVE"}) then {missionNamespace setVariable ["WFBE_C_AI_TEAMS_JIP_PRESERVE", 0]}; //--- Keep the AI Teams units on JIP.
diff --git a/WarfareV2_073LiteCO.Chernarus/Rsc/Parameters.hpp b/WarfareV2_073LiteCO.Chernarus/Rsc/Parameters.hpp
index ae7ca46..c58c028 100644
--- a/WarfareV2_073LiteCO.Chernarus/Rsc/Parameters.hpp
+++ b/WarfareV2_073LiteCO.Chernarus/Rsc/Parameters.hpp
@@ -5,7 +5,7 @@ class Params {
title = "$STR_WF_PARAMETER_AI_Delegation";
values[] = {0,1};
texts[] = {"$STR_WF_Disabled", "$STR_WF_Enabled"};
- default = 0;
+ default = 1;
};
class WFBE_C_AI_MAX {
title = "$STR_WF_PARAMETER_GroupSizeAI";
diff --git a/WarfareV2_073LiteCO.Chernarus/Server/Functions/Server_FNC_Delegation.sqf b/WarfareV2_073LiteCO.Chernarus/Server/Functions/Server_FNC_Delegation.sqf
index d2b6f7f..279f399 100644
--- a/WarfareV2_073LiteCO.Chernarus/Server/Functions/Server_FNC_Delegation.sqf
+++ b/WarfareV2_073LiteCO.Chernarus/Server/Functions/Server_FNC_Delegation.sqf
@@ -125,42 +125,130 @@ WFBE_SE_FNC_GetDelegatorID = {
- Count.
*/
WFBE_SE_FNC_GetDelegators = {
- Private ["_amount", "_count", "_delegators", "_fps", "_get", "_limit", "_unit", "_units"];
+ // TODO: Нужно учитывать растояние до игрока.
+ // TODO: Уровни логирования.
+ private["_amount","_count","_delegators","_cl_limit_fps","_get","_medium",
+ "_cl_limit_grpoups","_unit","_units","_cl_fps_total","_hc_fps_total",
+ "_sv_fps","_cl_units","_hc_units","_tmp","_must","_now","_new","_fps",
+ "_hc","_obj"];
+ //-- args
_count = _this;
- _units = if (isMultiplayer) then {playableUnits} else {switchableUnits};
- _limit = missionNamespace getVariable "WFBE_C_AI_DELEGATION_GROUPS_MAX";
- _fps = missionNamespace getVariable "WFBE_C_AI_DELEGATION_FPS_MIN";
+ //-- dynamic
+ _sv_fps = missionNamespace getVariable "WFBE_AI_DELEGATION_SERVER";
+ if (isNil "_sv_fps") then {
+ _sv_fps = diag_fps;
+ };
+ //_sv_fps = [missionNamespace getVariable "WFBE_C_AI_DELEGATION_FPS_INTERVAL"] call gosa_fps_getAVG;
+ _cl_limit_grpoups = missionNamespace getVariable "WFBE_C_AI_DELEGATION_GROUPS_MAX";
+ _cl_limit_fps = missionNamespace getVariable "WFBE_C_AI_DELEGATION_FPS_MIN";
+
+ //-- static
+ _hc_fps_total = 0;
+ _cl_fps_total = 0;
+ _hc_units = [];
+ _cl_units = [];
_delegators = [];
_amount = 1;
-
- while {count _units != 0 && count _delegators < _count && _amount <= _limit} do {
- for '_i' from 0 to (count _units)-1 do {
+
+ //-- Подготовка.
+ _units = if (isMultiplayer) then {playableUnits} else {switchableUnits};
+ // Нужно узнать _fps_total для начала.
+ for "_i" from 0 to (count _units -1) do {
_unit = _units select _i;
- if (isPlayer _unit) then { //--- Only get players.
- _get = missionNamespace getVariable format["WFBE_AI_DELEGATION_%1", getPlayerUID _unit];
- if !(isNil '_get') then { //--- Make sure the client already communicated with the server.
- if ((_get select 0) >= _fps && ((_get select 1) + ({_x == _unit} count _delegators)) <= _limit) then { //--- Check that the client FPS avg is above the FPS min and that it still has room for groups.
- if ((_get select 1) < _amount) then { //--- Progressive checks to prevent client overloading.
- _delegators = _delegators + [_unit];
+ ["INFORMATION", Format["gosa_SE_FNC_GetDelegators: unit:%1, uid:%2", _unit, getPlayerUID _unit]] Call WFBE_CO_FNC_LogContent;
+ if (isPlayer _unit) then {
+ _get = missionNamespace getVariable format["WFBE_AI_DELEGATION_%1",
+ getPlayerUID _unit];
+ if !(isNil '_get') then {
+ ["INFORMATION", Format["gosa_SE_FNC_GetDelegators: unit:%1, var:%2", _unit, _get]] Call WFBE_CO_FNC_LogContent;
+ if (count _get > 3) then {
+ if (_get select 3) then {
+ _hc_fps_total = _hc_fps_total + (_get select 0);
+ _tmp = [_unit, _get select 0, _get select 1, _get select 2, _get select 3];
+ if (random 10 < 5) then {
+ _hc_units set [count _hc_units, _tmp];
+ }else{
+ _hc_units = [_tmp] + _hc_units;
+ };
+ };
+ }else{
+ if ((_get select 0) >= _cl_limit_fps) then {
+ _cl_fps_total = _cl_fps_total + (_get select 0);
+ _tmp = [_unit, _get select 0, _get select 1, _get select 2, false];
+ if (random 10 < 5) then {
+ _cl_units set [count _cl_units, _tmp];
+ }else{
+ _cl_units = [_tmp] + _cl_units;
+ };
};
- } else {
- _units set [_i, "**NIL**"];
};
+ };
+ };
+ };
+ ["INFORMATION", Format["gosa_SE_FNC_GetDelegators: units: %1 -> %2+%3",_units,_hc_units,_cl_units]] Call WFBE_CO_FNC_LogContent;
+ _units = _hc_units+_cl_units;
+
+ //-- Среднее.
+ _medium = (_hc_fps_total * gosa_load_balancing_hc)
+ + (_cl_fps_total * gosa_load_balancing_cl)
+ + (_sv_fps * gosa_load_balancing_sv);
+ _medium = _medium / _count;
+ ["INFORMATION", Format["gosa_SE_FNC_GetDelegators: medium: %1, need: %2, sv: %3, hc: %4, cl: %5",
+ _medium,_count,_sv_fps,[_hc_fps_total,count _hc_units],[_cl_fps_total,count _cl_units]]
+ ] Call WFBE_CO_FNC_LogContent;
+
+ // TODO: Оптимизировать.
+ while {count _units > 0 && count _delegators < _count
+ //&& _amount <= _cl_limit_grpoups
+ }do {
+ ["INFORMATION", Format["gosa_SE_FNC_GetDelegators: amount:%1",_amount]] Call WFBE_CO_FNC_LogContent;
+ for '_i' from 0 to (count _units -1) do {
+ _unit = _units select _i;
+ ["INFORMATION", Format["gosa_SE_FNC_GetDelegators: unit:%1", [_i,_unit]]] Call WFBE_CO_FNC_LogContent;
+ _obj = _unit select 0;
+ _fps = _unit select 1;
+ _now = _unit select 2;
+ _hc = _unit select 4;
+ if (count _unit > 5) then {
+ _must = _unit select 5;
+ } else {
+ if (_hc) then {
+ _must = _fps * gosa_load_balancing_hc / _medium;
} else {
- _units set [_i, "**NIL**"];
+ _must = _fps * gosa_load_balancing_cl / _medium;
};
+ ["INFORMATION", Format["gosa_SE_FNC_GetDelegators: unit:%1, set must:%2", [_i,_unit], _must]] Call WFBE_CO_FNC_LogContent;
+ };
+
+ // TODO: Нужно учитывать float.
+
+ if (count _unit > 6) then {
+ _new = (_unit select 6);
+ }else{
+ _new = 0;
+ };
+
+ if ((_must > 0) && {_hc or ((_now + _new) <= _cl_limit_grpoups)}) then {
+ //if ((_get select 1) < _amount) then { //--- Progressive checks to prevent client overloading.
+ _delegators set [count _delegators, _obj];
+ ["INFORMATION", Format["gosa_SE_FNC_GetDelegators: delegators+[%1]", _unit]] Call WFBE_CO_FNC_LogContent;
+ _unit set [5, _must -1];
+ _unit set [6, _new +1];
+ //};
} else {
_units set [_i, "**NIL**"];
};
-
- if (count _delegators >= _count) exitWith {};
- };
-
+
+ if (count _delegators >= _count) exitWith {
+ ["INFORMATION", Format["gosa_SE_FNC_GetDelegators: count _delegators >= _count exitWith", nil]] Call WFBE_CO_FNC_LogContent;
+ };
+ };// for
+
_units = _units - ["**NIL**"];
_amount = _amount + 1;
- };
+ };// while
_delegators
-};
\ No newline at end of file
+};
diff --git a/WarfareV2_073LiteCO.Chernarus/Server/Functions/Server_HandleSpecial.sqf b/WarfareV2_073LiteCO.Chernarus/Server/Functions/Server_HandleSpecial.sqf
index ef89059..86448f9 100644
--- a/WarfareV2_073LiteCO.Chernarus/Server/Functions/Server_HandleSpecial.sqf
+++ b/WarfareV2_073LiteCO.Chernarus/Server/Functions/Server_HandleSpecial.sqf
@@ -73,10 +73,17 @@ switch (_args select 0) do {
_fps = _args select 2;
_get = missionNamespace getVariable format["WFBE_AI_DELEGATION_%1", _uid];
- if !(isNil "_get") then {
+ if (isNil "_get") then {
+ // FIXME: OnPlayerConnected не срабатывает, по неизвестной причине.
+ // TODO: Это временное решение, нужно сделать должным образом, select 1 и 2.
+ _get = [_fps,0,-10];
+ }else{
_get set [0, _fps];
- missionNamespace setVariable [format["WFBE_AI_DELEGATION_%1", _uid], _get];
};
+ if (count _args > 3) then {
+ _get set [3, _args select 3];
+ };
+ missionNamespace setVariable [format["WFBE_AI_DELEGATION_%1", _uid], _get];
};
case "update-delegation": {
Private ["_town","_vehicles"];
diff --git a/WarfareV2_073LiteCO.Chernarus/Server/Functions/Server_OnPlayerConnected.sqf b/WarfareV2_073LiteCO.Chernarus/Server/Functions/Server_OnPlayerConnected.sqf
index 42fda64..b1e72ab 100644
--- a/WarfareV2_073LiteCO.Chernarus/Server/Functions/Server_OnPlayerConnected.sqf
+++ b/WarfareV2_073LiteCO.Chernarus/Server/Functions/Server_OnPlayerConnected.sqf
@@ -18,6 +19,12 @@ waitUntil {commonInitComplete && serverInitFull};
//--- Skip this script if the server is trying to run this.
if (_name == '__SERVER__' || _uid == '' || local player) exitWith {};
+//--- If AI delegation is enabled, we create a special variable for player based on his UID and ID. FPS | Groups handled | Session ID.
+if ((missionNamespace getVariable "WFBE_C_AI_DELEGATION") > 0) then {
+ // FIXME: Этот код не работает по неизвестной причине.
+ missionNamespace setVariable [format["WFBE_AI_DELEGATION_%1", _uid], [0,0,_id]];
+};
+
//--- We try to get the player and it's group from the playableUnits.
_max = 10;
_team = grpNull;
@@ -64,11 +71,6 @@ _team Call WFBE_CO_FNC_WaypointsRemove;
_team setVariable ["wfbe_uid", _uid];
_team setVariable ["wfbe_teamleader", leader _team];
-//--- If AI delegation is enabled, we create a special variable for player based on his UID and ID. FPS | Groups handled | Session ID.
-if ((missionNamespace getVariable "WFBE_C_AI_DELEGATION") > 0) then {
- missionNamespace setVariable [format["WFBE_AI_DELEGATION_%1", _uid], [0,0,_id]];
-};
-
//--- The player has joined for the first time.
if (isNil '_get') exitWith {
/*
diff --git a/WarfareV2_073LiteCO.Chernarus/mission.sqm b/WarfareV2_073LiteCO.Chernarus/mission.sqm
index 9ca2118..323a53f 100644
--- a/WarfareV2_073LiteCO.Chernarus/mission.sqm
+++ b/WarfareV2_073LiteCO.Chernarus/mission.sqm
@@ -20,7 +20,7 @@ class Mission
randomSeed=10034581;
class Intel
{
- briefingName="Warfare BE V2.073 Lite CO - Chernarus";
+ briefingName="Warfare BE mod2 Lite CO - Chernarus";
briefingDescription="By Benny";
resistanceWest=0;
startWeather=0;
@@ -33,7 +33,7 @@ class Mission
};
class Groups
{
- items=119;
+ items=121;
class Item0
{
side="LOGIC";
@@ -5200,10 +5200,158 @@ class Mission
};
};
};
+ class Item119
+ {
+ side="CIV";
+ class Vehicles
+ {
+ items=10;
+ class Item0
+ {
+ position[]={13754.831,20.483839,3054.7898};
+ id=359;
+ side="CIV";
+ vehicle="Profiteer4";
+ player="PLAY CDG";
+ forceHeadlessClient=1;
+ leader=1;
+ skill=0.2;
+ text="headlessClient";
+ synchronizations[]={369};
+ };
+ class Item1
+ {
+ position[]={13757.831,21.881147,3049.7898};
+ id=360;
+ side="CIV";
+ vehicle="Worker2";
+ player="PLAY CDG";
+ forceHeadlessClient=1;
+ skill=0.2;
+ text="headlessClient (2)";
+ synchronizations[]={369};
+ };
+ class Item2
+ {
+ position[]={13759.831,21.102314,3049.7898};
+ id=361;
+ side="CIV";
+ vehicle="Functionary1";
+ player="PLAY CDG";
+ forceHeadlessClient=1;
+ skill=0.2;
+ text="headlessClient (3)";
+ synchronizations[]={369};
+ };
+ class Item3
+ {
+ position[]={13761.831,20.323837,3049.7898};
+ id=362;
+ side="CIV";
+ vehicle="Woodlander4";
+ player="PLAY CDG";
+ forceHeadlessClient=1;
+ skill=0.2;
+ text="headlessClient (4)";
+ synchronizations[]={369};
+ };
+ class Item4
+ {
+ position[]={13763.831,19.601841,3049.7898};
+ id=363;
+ side="CIV";
+ vehicle="Rocker1";
+ player="PLAY CDG";
+ forceHeadlessClient=1;
+ skill=0.2;
+ text="headlessClient (5)";
+ synchronizations[]={369};
+ };
+ class Item5
+ {
+ position[]={13765.831,18.896244,3049.7898};
+ id=364;
+ side="CIV";
+ vehicle="Worker3";
+ player="PLAY CDG";
+ forceHeadlessClient=1;
+ skill=0.2;
+ text="headlessClient (6)";
+ synchronizations[]={369};
+ };
+ class Item6
+ {
+ position[]={13767.831,18.162754,3049.7898};
+ id=365;
+ side="CIV";
+ vehicle="Profiteer3";
+ player="PLAY CDG";
+ forceHeadlessClient=1;
+ skill=0.2;
+ text="headlessClient (7)";
+ synchronizations[]={369};
+ };
+ class Item7
+ {
+ position[]={13771.266,16.931637,3049.8438};
+ id=366;
+ side="CIV";
+ vehicle="Profiteer2";
+ player="PLAY CDG";
+ forceHeadlessClient=1;
+ skill=0.2;
+ text="headlessClient (8)";
+ synchronizations[]={369};
+ };
+ class Item8
+ {
+ position[]={13772.915,16.415674,3049.8171};
+ id=367;
+ side="CIV";
+ vehicle="Worker4";
+ player="PLAY CDG";
+ forceHeadlessClient=1;
+ skill=0.2;
+ text="headlessClient (9)";
+ synchronizations[]={369};
+ };
+ class Item9
+ {
+ position[]={13769.831,17.4296,3049.7898};
+ id=368;
+ side="CIV";
+ vehicle="Profiteer1";
+ player="PLAY CDG";
+ forceHeadlessClient=1;
+ skill=0.2;
+ text="headlessClient (10)";
+ synchronizations[]={369};
+ };
+ };
+ };
+ class Item120
+ {
+ side="LOGIC";
+ class Vehicles
+ {
+ items=1;
+ class Item0
+ {
+ position[]={13764.278,13.570059,3061.2251};
+ id=369;
+ side="LOGIC";
+ vehicle="LocationLogicOwnerCivilian";
+ leader=1;
+ skill=0.60000002;
+ text="sideNull";
+ synchronizations[]={367,366,368,365,364,363,362,361,360,359};
+ };
+ };
+ };
};
class Markers
{
- items=3;
+ items=4;
class Item0
{
position[]={14155.423,17.164606,2797.7344};
@@ -5222,6 +5370,12 @@ class Mission
name="GuerTempRespawnMarker";
type="Empty";
};
+ class Item3
+ {
+ position[]={13740.863,34.818417,3029.5674};
+ name="CivilianTempRespawnMarker";
+ type="Empty";
+ };
};
};
class Intro