DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
missionServer.c
См. документацию.
1
2//: string uid of the player
4
5class MissionServer extends MissionBase
6{
15
16 // -----------------------
17 // ARTILLERY SOUNDS SETUP
18 // -----------------------
19 private float m_ArtyBarrageTimer = 0; // This is not to be edited in Init.c this is just to increment time
20
21 // Variables to be modified in Init.c
22 protected bool m_PlayArty = false; // Toggle if Off map artillery sounds are played
23 protected float m_ArtyDelay = 0; // Set how much time there is between two barrages (in seconds)
24 protected int m_MinSimultaneousStrikes = 0; // The MIN of simultaneous shots on the map (Will be clamped between 1 and max shots)
25 protected int m_MaxSimultaneousStrikes = 0; // The MAX of simultaneous shots on the map (Will be clamped between 1 and max amount of coords)
26 protected ref array<vector> m_FiringPos; // Where we should fire from. On Init set the relevant data
27
28 //All Chernarus firing coordinates
29 protected const ref array<vector> CHERNARUS_STRIKE_POS =
30 {
31 "-500.00 165.00 5231.69",
32 "-500.00 300.00 9934.41",
33 "10406.86 192.00 15860.00",
34 "4811.75 370.00 15860.00",
35 "-500.00 453.00 15860.00"
36 };
37
38 //All livonia firing coordinates
39 protected const ref array<vector> LIVONIA_STRIKE_POS =
40 {
41 "7440.00 417.00 -500.00",
42 "-500.00 276.00 5473.00",
43 "-500.00 265.00 9852.00",
44 "4953.00 240.00 13300.00",
45 "9620.00 188.00 13300.00",
46 "13300.00 204.00 10322.00",
47 "13300.00 288.00 6204.00",
48 "13300.00 296.00 -500.00"
49 };
50 // -----------------------
51 // END OF ARTILLERY SETUP
52 // -----------------------
53
56
57#ifndef NO_GUI
58 protected int m_ControlDisabledMode;
59 protected ref array<string> m_ActiveInputExcludeGroups; //exclude groups defined in 'specific.xml' file
60 protected ref array<int> m_ActiveInputRestrictions; //additional scripted restrictions
61 protected bool m_ProcessInputExcludes;
62#endif
63
77
79 {
80 g_Game.GetCallQueue(CALL_CATEGORY_GAMEPLAY).Remove(this.UpdatePlayersStats);
81 }
82
83 override void OnInit()
84 {
85 super.OnInit();
90 //Either pass consts in Init.c or insert all desired coords (or do both ;))
92 }
93
94 override void OnMissionStart()
95 {
96 super.OnMissionStart();
97
98 // We will load the Effect areas on Default mission start
100 }
101
102 override void OnUpdate(float timeslice)
103 {
104#ifndef NO_GUI
105#ifdef FEATURE_CURSOR
106 if (GetTimeStamp() == 0)
107 {
109 g_Game.GetUIManager().ShowUICursor(false);
110 }
111#endif
112#endif
113
114 UpdateDummyScheduler();
115 TickScheduler(timeslice);
117 m_WorldData.UpdateBaseEnvTemperature(timeslice); // re-calculate base enviro temperature
118 m_RainProcHandler.Update(timeslice);
119
120 RandomArtillery(timeslice);
121
122 super.OnUpdate(timeslice);
123
124#ifndef NO_GUI
125 UIManager uiManager = g_Game.GetUIManager();
126 UIScriptedMenu menu = uiManager.GetMenu();
127 Input input = g_Game.GetInput();
128
129 if (menu && !menu.UseKeyboard() && menu.UseMouse())
130 {
131 int i;
132 for (i = 0; i < 5; i++)
133 {
137 }
138
139 for (i = 0; i < 6; i++)
140 {
142 }
143 }
144
146 {
149 }
150#endif
151
152 }
153
155 {
157 g_Game.SetDebugMonitorEnabled(g_Game.ServerConfigGetInt("enableDebugMonitor"));
158
159 InitialiseWorldData();
160 }
161
162
163 void RandomArtillery(float deltaTime)
164 {
165 // ARTY barrage
166 if (m_PlayArty)
167 {
168 // We only perform timer checks and increments if we enabled the artillery barrage
170 {
171 //We clamp to guarantee 1 and never have multiple shots on same pos, even in case of entry error
174
175 // Variables to be used in this scope
176 int randPos; // Select random position
177 Param1<vector> pos; // The value to be sent through RPC
178 array<ref Param> params; // The RPC params
179
181 {
182 // We only have one set of coordinates to send
183 randPos = Math.RandomIntInclusive(0, m_FiringPos.Count() - 1);
184 pos = new Param1<vector>(m_FiringPos[randPos]);
185 params = new array<ref Param>;
186 params.Insert(pos);
187 g_Game.RPC(null, ERPCs.RPC_SOUND_ARTILLERY, params, true);
188 }
189 else
190 {
191 //We will do some extra steps to
192 /*
193 1. Send multiple coords (Send one RPC per coord set)
194 2. Ensure we don't have duplicates
195 */
196 array<int> usedIndices = new array<int>; // Will store all previusly fired upon indices
197
198 // We determine how many positions fire between MIN and MAX
200 for (int i = 0; i < randFireNb; i++)
201 {
202 randPos = Math.RandomIntInclusive(0, m_FiringPos.Count() - 1);
203
204 if (usedIndices.Count() <= 0 || usedIndices.Find(randPos) < 0) //We do not find the index or array is empty
205 {
206 // We prepare to send the message
207 pos = new Param1<vector>(m_FiringPos[randPos]);
208 params = new array<ref Param>;
209
210 // We send the message with this set of coords
211 params.Insert(pos);
212 g_Game.RPC(null, ERPCs.RPC_SOUND_ARTILLERY, params, true);
213
214 // We store the last used value
215 usedIndices.Insert(randPos);
216 }
217 }
218 }
219
220 // Reset timer for new loop
221 m_ArtyBarrageTimer = 0.0;
222 }
223
224 m_ArtyBarrageTimer += deltaTime;
225 }
226 }
227
228 override bool IsServer()
229 {
230 return true;
231 }
232
233 override bool IsPlayerDisconnecting(Man player)
234 {
235 return (m_LogoutPlayers && m_LogoutPlayers.Contains(PlayerBase.Cast(player))) || (m_NewLogoutPlayers && m_NewLogoutPlayers.Contains(PlayerBase.Cast(player)));
236 }
237
239 {
240 PluginLifespan moduleLifespan;
241 Class.CastTo(moduleLifespan, GetPlugin(PluginLifespan));
242 array<Man> players = new array<Man>();
243 g_Game.GetPlayers(players);
244
245 foreach (Man man : players)
246 {
247 PlayerBase player;
248 if (Class.CastTo(player, man))
249 {
250 player.StatUpdateByTime(AnalyticsManagerServer.STAT_PLAYTIME);
251 player.StatUpdateByPosition(AnalyticsManagerServer.STAT_DISTANCE);
252
253 moduleLifespan.UpdateLifespan(player);
254 }
255 }
256
258 }
259
260 protected void AddNewPlayerLogout(PlayerBase player, notnull LogoutInfo info)
261 {
262 m_LogoutPlayers.Insert(player, info);
263 m_NewLogoutPlayers.Remove(player);
264 }
265
266 // check if logout finished for some players
268 {
269 for (int i = 0; i < m_LogoutPlayers.Count();)
270 {
271 LogoutInfo info = m_LogoutPlayers.GetElement(i);
272
273 if (g_Game.GetTime() >= info.param1)
274 {
275 PlayerIdentity identity;
276 PlayerBase player = m_LogoutPlayers.GetKey(i);
277 if (player)
278 {
279 identity = player.GetIdentity();
280 m_LogoutPlayers.Remove(player);
281 }
282 else
283 {
284 m_LogoutPlayers.RemoveElement(i);
285 }
286
287 // disable reconnecting to old char
288 // g_Game.RemoveFromReconnectCache(info.param2);
289
290 PlayerDisconnected(player, identity, info.param2);
291 }
292 else
293 {
294 ++i;
295 }
296 }
297 }
298
299 override void OnEvent(EventType eventTypeId, Param params)
300 {
301 PlayerIdentity identity;
302 PlayerBase player;
303 int counter = 0;
304
305 switch (eventTypeId)
306 {
308 ClientPrepareEventParams clientPrepareParams;
309 Class.CastTo(clientPrepareParams, params);
310 CfgGameplayHandler.SyncDataSendEx(clientPrepareParams.param1);
311 UndergroundAreaLoader.SyncDataSend(clientPrepareParams.param1);
312 CfgPlayerRestrictedAreaHandler.SyncDataSend(clientPrepareParams.param1);
313 OnClientPrepareEvent(clientPrepareParams.param1, clientPrepareParams.param2, clientPrepareParams.param3, clientPrepareParams.param4, clientPrepareParams.param5);
314 break;
315
317 ClientNewEventParams newParams;
318 Class.CastTo(newParams, params);
319 player = OnClientNewEvent(newParams.param1, newParams.param2, newParams.param3);
320 if (!player)
321 {
322 Debug.Log("ClientNewEvent: Player is empty");
323 return;
324 }
325 identity = newParams.param1;
326 InvokeOnConnect(player,identity);
328
329 ControlPersonalLight(player);
330 SyncGlobalLighting(player);
331
332 break;
333
335 ClientReadyEventParams readyParams;
336 Class.CastTo(readyParams, params);
337 identity = readyParams.param1;
338 Class.CastTo(player, readyParams.param2);
339 if (!player)
340 {
341 Debug.Log("ClientReadyEvent: Player is empty");
342 return;
343 }
344
345 OnClientReadyEvent(identity, player);
346 InvokeOnConnect(player, identity);
347 // Send list of players at all clients
349 ControlPersonalLight(player);
350 SyncGlobalLighting(player);
351 break;
352
354 ClientRespawnEventParams respawnParams;
355 Class.CastTo(respawnParams, params);
356 identity = respawnParams.param1;
357 Class.CastTo(player, respawnParams.param2);
358 if (!player)
359 {
360 Debug.Log("ClientRespawnEvent: Player is empty");
361 return;
362 }
363
364 OnClientRespawnEvent(identity, player);
365 break;
366
368 ClientReconnectEventParams reconnectParams;
369 Class.CastTo(reconnectParams, params);
370
371 identity = reconnectParams.param1;
372 Class.CastTo(player, reconnectParams.param2);
373 if (!player)
374 {
375 Debug.Log("ClientReconnectEvent: Player is empty");
376 return;
377 }
378
379 OnClientReconnectEvent(identity, player);
380 break;
381
384 Class.CastTo(discoParams, params);
385
386 identity = discoParams.param1;
387 Class.CastTo(player, discoParams.param2);
388 int logoutTime = discoParams.param3;
389 bool authFailed = discoParams.param4;
390
391 if (!player)
392 {
393 Debug.Log("ClientDisconnectenEvent: Player is empty");
394 return;
395 }
396
397 OnClientDisconnectedEvent(identity, player, logoutTime, authFailed);
398 break;
399
401 LogoutCancelEventParams logoutCancelParams;
402
403 Class.CastTo(logoutCancelParams, params);
404 Class.CastTo(player, logoutCancelParams.param1);
405 identity = player.GetIdentity();
406 if (identity)
407 {
408 // disable reconnecting to old char
409 // g_Game.RemoveFromReconnectCache(identity.GetId());
410 Print("[Logout]: Player " + identity.GetId() + " cancelled");
411 }
412 else
413 {
414 Print("[Logout]: Player cancelled");
415 }
416 m_LogoutPlayers.Remove(player);
417 m_NewLogoutPlayers.Remove(player);
418 break;
419 }
420 }
421
423 {
424 Debug.Log("InvokeOnConnect:"+this.ToString(),"Connect");
425 if (player)
426 player.OnConnect();
427 }
428
430 {
431 Debug.Log("InvokeOnDisconnect:"+this.ToString(),"Connect");
432 if (player)
433 player.OnDisconnect();
434 }
435
436 void OnClientPrepareEvent(PlayerIdentity identity, out bool useDB, out vector pos, out float yaw, out int preloadTimeout)
437 {
438 if (GetHive())
439 {
440 // use character from database
441 useDB = true;
442 }
443 else
444 {
445 // use following data without database
446 useDB = false;
447 pos = "1189.3 0.0 5392.48";
448 yaw = 0;
449 }
450 }
451
452 // Enables/Disables personal light on the given player.
454 {
455 if (player)
456 {
457 bool is_personal_light = ! g_Game.ServerConfigGetInt("disablePersonalLight");
458 Param1<bool> personal_light_toggle = new Param1<bool>(is_personal_light);
459 g_Game.RPCSingleParam(player, ERPCs.RPC_TOGGLE_PERSONAL_LIGHT, personal_light_toggle, true, player.GetIdentity());
460 }
461 else
462 {
463 Error("Error! Player was not initialized at the right time. Thus cannot send RPC command to enable or disable personal light!");
464 }
465 }
466
467 // syncs global lighting setup from the server (lightingConfig server config parameter)
469 {
470 if (player)
471 {
472 int lightingID = g_Game.ServerConfigGetInt("lightingConfig");
473 Param1<int> lightID = new Param1<int>(lightingID);
474 g_Game.RPCSingleParam(player, ERPCs.RPC_SEND_LIGHTING_SETUP, lightID, true, player.GetIdentity());
475 }
476 }
477
480 {
481 //creates temporary server-side structure for handling default character spawn
482 return g_Game.GetMenuDefaultCharacterData(false).DeserializeCharacterData(ctx);
483 }
484
485 //
486 PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
487 {
488 Entity playerEnt;
489 playerEnt = g_Game.CreatePlayer(identity, characterName, pos, 0, "NONE");//Creates random player
490 Class.CastTo(m_player, playerEnt);
491
492 g_Game.SelectPlayer(identity, m_player);
493
494 return m_player;
495 }
496
499 {
500 int slot_ID;
501 string attachment_type;
502 for (int i = 0; i < DefaultCharacterCreationMethods.GetAttachmentSlotsArray().Count(); i++)
503 {
504 slot_ID = DefaultCharacterCreationMethods.GetAttachmentSlotsArray().Get(i);
505 attachment_type = "";
506 if (m_RespawnMode != GameConstants.RESPAWN_MODE_CUSTOM || !char_data.GetAttachmentMap().Find(slot_ID,attachment_type) || !VerifyAttachmentType(slot_ID,attachment_type)) //todo insert verification fn here
507 {
508 //randomize
509 if (DefaultCharacterCreationMethods.GetConfigArrayCountFromSlotID(slot_ID) > 0)
510 {
511 attachment_type = DefaultCharacterCreationMethods.GetConfigAttachmentTypes(slot_ID).GetRandomElement();
512 }
513 else //undefined, moving on
514 continue;
515 }
516
517 if (attachment_type != "")
518 {
519 m_player.GetInventory().CreateAttachmentEx(attachment_type,slot_ID);
520 }
521 }
522
524 }
525
527 void StartingEquipSetup(PlayerBase player, bool clothesChosen)
528 {
529 }
530
531 bool VerifyAttachmentType(int slot_ID, string attachment_type)
532 {
533 return DefaultCharacterCreationMethods.GetConfigAttachmentTypes(slot_ID).Find(attachment_type) > -1;
534 }
535
537 {
538 string characterType = g_Game.CreateRandomPlayer();
539 bool generateRandomEquip = false;
540
541 // get login data for new character
542 if (ProcessLoginData(ctx) && (m_RespawnMode == GameConstants.RESPAWN_MODE_CUSTOM) && !g_Game.GetMenuDefaultCharacterData(false).IsRandomCharacterForced())
543 {
544 if (g_Game.ListAvailableCharacters().Find(g_Game.GetMenuDefaultCharacterData().GetCharacterType()) > -1)
545 characterType = g_Game.GetMenuDefaultCharacterData().GetCharacterType();
546 }
547 else
548 {
549 generateRandomEquip = true;
550 }
551
553 {
555 if (presetData && presetData.IsValid())
556 {
557 string presetCharType = presetData.GetRandomCharacterType();
558 if (presetCharType == string.Empty)
559 presetCharType = characterType;
560 if (CreateCharacter(identity, pos, ctx, presetCharType) != null)
561 {
563 return m_player;
564 }
565 else
566 {
567 ErrorEx("Failed to create character from type: " + presetCharType + ", using default spawning method");
568 }
569 }
570 else
571 {
572 ErrorEx("Failed to load PlayerSpawnPreset data properly, using default spawning method");
573 }
574 }
575
576 if (CreateCharacter(identity, pos, ctx, characterType))
577 {
578 if (generateRandomEquip)
579 g_Game.GetMenuDefaultCharacterData().GenerateRandomEquip();
580 EquipCharacter(g_Game.GetMenuDefaultCharacterData());
581 }
582
583 return m_player;
584 }
585
587 {
588 g_Game.SelectPlayer(identity, player);
589
590 #ifdef DIAG_DEVELOPER
591 if (FeatureTimeAccel.m_CurrentTimeAccel)
592 {
593 g_Game.RPCSingleParam(player, ERPCs.DIAG_TIMEACCEL_CLIENT_SYNC, FeatureTimeAccel.m_CurrentTimeAccel, true, identity);
594 }
595 #endif
596 }
597
599 {
600 if (player)
601 {
602 if (player.IsUnconscious() || player.IsRestrained())
603 {
604 PluginAdminLog adm = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
605 adm.PlayerKilledByRespawn(player);
606
607 // kill character
608 player.SetHealth("", "", 0.0);
609 }
610 }
611
612 #ifdef DIAG_DEVELOPER
613 if (FeatureTimeAccel.m_CurrentTimeAccel)
614 {
615 g_Game.RPCSingleParam(player, ERPCs.DIAG_TIMEACCEL_CLIENT_SYNC, FeatureTimeAccel.m_CurrentTimeAccel, true, identity);
616 }
617 #endif
618 }
619
621 {
622 if (player)
623 {
624 player.OnReconnect();
625 }
626 }
627
628 void OnClientDisconnectedEvent(PlayerIdentity identity, PlayerBase player, int logoutTime, bool authFailed)
629 {
630 bool disconnectNow = true;
631
632 // TODO: get out of vehicle
633 // using database and no saving if authorization failed
634 if (GetHive() && !authFailed)
635 {
636 if (player.IsAlive())
637 {
638 if (!m_LogoutPlayers.Contains(player) && !m_NewLogoutPlayers.Contains(player))
639 {
640 Print("[Logout]: New player " + identity.GetId() + " with logout time " + logoutTime.ToString());
641
642 // send statistics to client
643 player.StatSyncToClient();
644
645 // inform client about logout time
646 g_Game.SendLogoutTime(player, logoutTime);
647
648 // wait for some time before logout and save
649 LogoutInfo params = new LogoutInfo(g_Game.GetTime() + logoutTime * 1000, identity.GetId());
650
651 m_NewLogoutPlayers.Insert(player, params);
652 g_Game.GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(AddNewPlayerLogout, 0, false, player, params);
653
654 // allow reconnecting to old char only if not in cars, od ladders etc. as they cannot be properly synchronized for reconnect
655 //if (!player.GetCommand_Vehicle() && !player.GetCommand_Ladder())
656 //{
657 // g_Game.AddToReconnectCache(identity);
658 //}
659 // wait until logout timer runs out
660 disconnectNow = false;
661 }
662 return;
663 }
664 }
665
666 if (disconnectNow)
667 {
668 Print("[Logout]: New player " + identity.GetId() + " with instant logout");
669
670 // inform client about instant logout
671 g_Game.SendLogoutTime(player, 0);
672
673 PlayerDisconnected(player, identity, identity.GetId());
674 }
675 }
676
677 void PlayerDisconnected(PlayerBase player, PlayerIdentity identity, string uid)
678 {
679 // Note: At this point, identity can be already deleted
680 if (!player)
681 {
682 Print("[Logout]: Skipping player " + uid + ", already removed");
683 return;
684 }
685
686 // disable reconnecting to old char
687 //g_Game.RemoveFromReconnectCache(uid);
688
689 // now player can't cancel logout anymore, so call everything needed upon disconnect
690 InvokeOnDisconnect(player);
691
692 Print("[Logout]: Player " + uid + " finished");
693
694 if (GetHive())
695 {
696 // save player
697 player.Save();
698
699 // unlock player in DB
700 GetHive().CharacterExit(player);
701 }
702
703 // handle player's existing char in the world
704 player.ReleaseNetworkControls();
705 HandleBody(player);
706
707 // remove player from server
708 g_Game.DisconnectPlayer(identity, uid);
709 // Send list of players at all clients
710 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(SyncEvents.SendPlayerList, 1000);
711 }
712
714 {
715 if (player.IsUnconscious() || player.IsRestrained())
716 {
717 switch (player.GetKickOffReason())
718 {
719 case EClientKicked.SERVER_EXIT:
720 return false;
721 case EClientKicked.KICK_ALL_ADMIN:
722 return false;
723 case EClientKicked.KICK_ALL_SERVER:
724 return false;
725 case EClientKicked.SERVER_SHUTDOWN:
726 return false;
727 default:
728 return true;
729 }
730 }
731
732 return false;
733 }
734
736 {
737 if (player.IsAlive())
738 {
739 if (ShouldPlayerBeKilled(player))
740 {
741 PluginAdminLog adm = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
742 adm.PlayerKilledByDisconnect(player);
743
744 player.SetHealth("", "", 0.0);//kill
745 }
746 else
747 {
748 player.Delete();// remove the body
749 }
750 }
751 }
752
753 void TickScheduler(float timeslice)
754 {
755 g_Game.GetWorld().GetPlayerList(m_Players);
756 int players_count = m_Players.Count();
757 int tick_count_max = Math.Min(players_count, SCHEDULER_PLAYERS_PER_TICK);
758
759 for (int i = 0; i < tick_count_max; ++i)
760 {
761 if (m_currentPlayer >= players_count)
762 {
763 m_currentPlayer = 0;
764 }
765
766 PlayerBase currentPlayer = PlayerBase.Cast(m_Players.Get(m_currentPlayer));
767 if (currentPlayer)
768 currentPlayer.OnTick();
770 }
771 }
772
773 //--------------------------------------------------
774 override bool InsertCorpse(Man player)
775 {
776 CorpseData corpse_data = new CorpseData(PlayerBase.Cast(player),g_Game.GetTime());
777 return m_DeadPlayersArray.Insert(corpse_data) >= 0;
778 }
779
781 {
782 int nDeadPlayers = m_DeadPlayersArray.Count();
783 if (nDeadPlayers == 0)//nothing to process, abort
784 return;
785 int current_time = g_Game.GetTime();
786 array<int> invalid_corpses = new array<int>;
787 CorpseData corpse_data;
788
789 for (int i = 0; i < nDeadPlayers; ++i)
790 {
791 corpse_data = m_DeadPlayersArray.Get(i);
792 if (!corpse_data || (corpse_data && (!corpse_data.m_Player || !corpse_data.m_bUpdate)))
793 {
794 invalid_corpses.Insert(i);
795 }
796 else if (corpse_data.m_bUpdate && current_time - corpse_data.m_iLastUpdateTime >= 30000)
797 {
798 corpse_data.UpdateCorpseState();
799 corpse_data.m_iLastUpdateTime = current_time;
800 }
801 }
802
803 //cleanup
804 int nInvalidCorpses = invalid_corpses.Count();
805 if (nInvalidCorpses > 0)
806 {
807 for (i = nInvalidCorpses - 1; i >= 0; --i)
808 {
809 m_DeadPlayersArray.Remove(invalid_corpses.Get(i));
810 }
811 }
812 }
813 //--------------------------------------------------
814
815 override void SyncRespawnModeInfo(PlayerIdentity identity)
816 {
817 ScriptRPC rpc = new ScriptRPC();
818 rpc.Write(m_RespawnMode);
819 rpc.Send(null, ERPCs.RPC_SERVER_RESPAWN_MODE, true, identity);
820 }
821
826
828 {
829 return m_ActiveRefresherLocations;
830 }
831
832#ifndef NO_GUI
834 override void RemoveActiveInputExcludes(array<string> excludes, bool bForceSupress = false)
835 {
836 super.RemoveActiveInputExcludes(excludes,bForceSupress);
837
838 if (excludes.Count() != 0)
839 {
840 bool changed = false;
841
843 {
844 foreach (string excl : excludes)
845 {
846 if (m_ActiveInputExcludeGroups.Find(excl) != -1)
847 {
848 m_ActiveInputExcludeGroups.RemoveItem(excl);
849 changed = true;
850 }
851 }
852
853 if (changed)
854 {
856 }
857 }
858
859 // supress control for next frame
860 GetUApi().SupressNextFrame(bForceSupress);
861 }
862 }
863
865 override void RemoveActiveInputRestriction(int restrictor)
866 {
867 //unique behaviour outside regular excludes
868 if (restrictor > -1)
869 {
870 switch (restrictor)
871 {
872 case EInputRestrictors.INVENTORY:
873 {
874 GetUApi().GetInputByID(UAWalkRunForced).ForceEnable(false); // force walk off!
875 break;
876 }
877 case EInputRestrictors.MAP:
878 {
879 GetUApi().GetInputByID(UAWalkRunForced).ForceEnable(false); // force walk off!
880 break;
881 }
882 }
883
884 if (m_ActiveInputRestrictions && m_ActiveInputRestrictions.Find(restrictor) != -1)
885 {
886 m_ActiveInputRestrictions.RemoveItem(restrictor);
887 }
888 }
889 }
890
892 override void AddActiveInputExcludes(array<string> excludes)
893 {
894 super.AddActiveInputExcludes(excludes);
895
896 if (excludes.Count() != 0)
897 {
898 bool changed = false;
900 {
902 }
903
904 foreach (string excl : excludes)
905 {
906 if (m_ActiveInputExcludeGroups.Find(excl) == -1)
907 {
908 m_ActiveInputExcludeGroups.Insert(excl);
909 changed = true;
910 }
911 }
912
913 if (changed)
914 {
916 #ifdef BULDOZER
918 #endif
919 }
920 }
921 }
922
924 override void AddActiveInputRestriction(int restrictor)
925 {
926 //unique behaviour outside regular excludes
927 if (restrictor > -1)
928 {
929 switch (restrictor)
930 {
931 case EInputRestrictors.INVENTORY:
932 {
933 GetUApi().GetInputByID(UAWalkRunForced).ForceEnable(true); // force walk on!
934 PlayerBase player = PlayerBase.Cast( g_Game.GetPlayer() );
935 if ( player )
936 {
937 ItemBase item = player.GetItemInHands();
938 if (item && item.IsWeapon())
939 player.RequestResetADSSync();
940 }
941 break;
942 }
943 case EInputRestrictors.MAP:
944 {
945 GetUApi().GetInputByID(UAWalkRunForced).ForceEnable(true); // force walk on!
946 break;
947 }
948 }
949
951 {
953 }
954 if (m_ActiveInputRestrictions.Find(restrictor) == -1)
955 {
956 m_ActiveInputRestrictions.Insert(restrictor);
957 }
958 }
959 }
960
962 override void RefreshExcludes()
963 {
965 }
966
968 protected void PerformRefreshExcludes()
969 {
971 {
972 foreach (string excl : m_ActiveInputExcludeGroups)
973 {
974 GetUApi().ActivateExclude(excl);
975 }
976 }
977
979 }
980
982 override void EnableAllInputs(bool bForceSupress = false)
983 {
985
987 {
988 int count = m_ActiveInputRestrictions.Count();
989 for (int i = 0; i < count; i++)
990 {
992 }
993 m_ActiveInputRestrictions.Clear(); //redundant?
994 }
996 {
998 }
999
1000 GetUApi().UpdateControls(); //it is meant to happen instantly, does not wait for update to process
1001 GetUApi().SupressNextFrame(bForceSupress); // supress control for next frame
1002 }
1003
1005 override bool IsControlDisabled()
1006 {
1007 bool active = false;
1009 {
1010 active |= m_ActiveInputExcludeGroups.Count() > 0;
1011 }
1013 {
1014 active |= m_ActiveInputRestrictions.Count() > 0;
1015 }
1016 active |= m_ControlDisabledMode >= INPUT_EXCLUDE_ALL; //legacy stuff, Justin case
1017 return active;
1018 }
1019
1021 override bool IsInputExcludeActive(string exclude)
1022 {
1023 return m_ActiveInputExcludeGroups && m_ActiveInputExcludeGroups.Find(exclude) != -1;
1024 }
1025
1027 override bool IsInputRestrictionActive(int restriction)
1028 {
1029 return m_ActiveInputRestrictions && m_ActiveInputRestrictions.Find(restriction) != -1;
1030 }
1031#endif
1032
1034 PluginAdditionalInfo m_moduleDefaultCharacter;
1035}
1036
EClientKicked
Определения ClientKickedModule.c:2
DayZGame g_Game
Определения DayZGame.c:3942
ERPCs
Определения ERPCs.c:2
proto string ToString()
WorldData m_WorldData
Определения Environment.c:85
Empty
Определения Hand_States.c:14
proto native Hive GetHive()
void PluginLifespan()
Определения PluginLifespan.c:45
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:325
@ Count
Определения RandomGeneratorSyncManager.c:8
proto native UAInputAPI GetUApi()
const string STAT_PLAYTIME
Определения AnalyticsManagerServer.c:4
const string STAT_DISTANCE
Определения AnalyticsManagerServer.c:3
static bool LoadData()
Определения CfgGameplayHandler.c:44
static bool GetDisableRespawnDialog()
Определения CfgGameplayHandler.c:173
static void SyncDataSendEx(notnull PlayerIdentity identity)
Определения CfgGameplayHandler.c:94
static void SyncDataSend(notnull PlayerIdentity identity)
Super root of all classes in Enforce script.
Определения EnScript.c:11
PlayerBase m_Player
Определения CorpseData.c:14
int m_iLastUpdateTime
Определения CorpseData.c:6
bool m_bUpdate
Определения CorpseData.c:5
void UpdateCorpseState(bool force_check=false)
Определения CorpseData.c:27
Определения CorpseData.c:2
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Определения 3_Game/DayZ/tools/Debug.c:182
Определения 3_Game/DayZ/tools/Debug.c:2
static void CreateZones()
Определения ContaminatedAreaLoader.c:6
Определения Camera.c:2
proto native void CharacterExit(Man player)
proto native void DisableKey(int key)
Disable key until end of frame.
Определения input.c:11
Определения EnMath.c:7
map< int, string > GetAttachmentMap()
Определения gameplay.c:1125
int m_RespawnMode
Определения missionServer.c:14
override void EnableAllInputs(bool bForceSupress=false)
Removes all active input excludes and restrictions.
Определения missionServer.c:982
void RandomArtillery(float deltaTime)
Определения missionServer.c:163
void ~MissionServer()
Определения missionServer.c:78
ref array< vector > m_FiringPos
Определения missionServer.c:26
void EquipCharacter(MenuDefaultCharacterData char_data)
Spawns character equip from received data. Checks validity against config, randomizes if invalid valu...
Определения missionServer.c:498
int m_currentPlayer
Определения missionServer.c:13
override void AddActiveInputExcludes(array< string > excludes)
Adds one or more exclude groups to disable and refreshes excludes.
Определения missionServer.c:892
int m_ControlDisabledMode
Определения missionGameplay.c:38
override void OnUpdate(float timeslice)
Определения missionServer.c:102
float m_ArtyBarrageTimer
Определения missionServer.c:19
override void OnInit()
Определения missionServer.c:83
override void RemoveActiveInputExcludes(array< string > excludes, bool bForceSupress=false)
Removes one or more exclude groups and refreshes excludes.
Определения missionServer.c:834
int m_MaxSimultaneousStrikes
Определения missionServer.c:25
PluginAdditionalInfo m_moduleDefaultCharacter
DEPRECATED.
Определения missionServer.c:1034
ref array< Man > m_Players
Определения missionServer.c:7
bool m_PlayArty
Определения missionServer.c:22
void AddNewPlayerLogout(PlayerBase player, notnull LogoutInfo info)
Определения missionServer.c:260
void SyncGlobalLighting(PlayerBase player)
Определения missionServer.c:468
override bool IsInputExcludeActive(string exclude)
Returns true if the particular input exclude group had been activated via script and is active.
Определения missionServer.c:1021
ref array< string > m_ActiveInputExcludeGroups
Определения missionGameplay.c:39
override bool InsertCorpse(Man player)
Определения missionServer.c:774
override bool IsControlDisabled()
returns if ANY exclude groups, restriction (or deprecated disable, if applicable) is active
Определения missionServer.c:1005
void UpdateCorpseStatesServer()
Определения missionServer.c:780
override RainProcurementHandler GetRainProcurementHandler()
Определения missionServer.c:822
override void OnGameplayDataHandlerLoad()
Определения missionServer.c:154
void HandleBody(PlayerBase player)
Определения missionServer.c:735
const int SCHEDULER_PLAYERS_PER_TICK
Определения missionServer.c:12
void MissionServer()
Определения missionServer.c:64
override bool IsServer()
Определения missionServer.c:228
void TickScheduler(float timeslice)
Определения missionGameplay.c:216
const ref array< vector > CHERNARUS_STRIKE_POS
Определения missionServer.c:29
override bool IsInputRestrictionActive(int restriction)
Returns true if the particular 'restriction' (those govern special behaviour outside regular input ex...
Определения missionServer.c:1027
override void OnEvent(EventType eventTypeId, Param params)
Определения missionServer.c:299
MissionBase m_mission
Определения missionServer.c:55
ref array< int > m_ActiveInputRestrictions
Определения missionGameplay.c:40
void UpdatePlayersStats()
Определения missionServer.c:238
bool ProcessLoginData(ParamsReadContext ctx)
returns whether received data is valid, ctx can be filled on client in StoreLoginData()
Определения missionServer.c:479
ref RainProcurementHandler m_RainProcHandler
Определения missionServer.c:11
void InvokeOnConnect(PlayerBase player, PlayerIdentity identity)
Определения missionServer.c:422
override void RefreshExcludes()
queues refresh of input excludes
Определения missionGameplay.c:1039
PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
Определения missionServer.c:486
void PlayerDisconnected(PlayerBase player, PlayerIdentity identity, string uid)
Определения missionServer.c:677
bool ShouldPlayerBeKilled(PlayerBase player)
Определения missionServer.c:713
float m_ArtyDelay
Определения missionServer.c:23
void InvokeOnDisconnect(PlayerBase player)
Определения missionServer.c:429
void ControlPersonalLight(PlayerBase player)
Определения missionServer.c:453
bool VerifyAttachmentType(int slot_ID, string attachment_type)
Определения missionServer.c:531
override void AddActiveInputRestriction(int restrictor)
Adds one input restriction (specific behaviour oudside regular excludes, defined below)
Определения missionServer.c:924
ref map< PlayerBase, ref LogoutInfo > m_NewLogoutPlayers
Определения missionServer.c:10
const ref array< vector > LIVONIA_STRIKE_POS
Определения missionServer.c:39
void StartingEquipSetup(PlayerBase player, bool clothesChosen)
can be overriden to manually set up starting equip. 'clothesChosen' is legacy parameter,...
Определения missionServer.c:527
PlayerBase m_player
Определения missionServer.c:54
void OnClientReadyEvent(PlayerIdentity identity, PlayerBase player)
Определения missionServer.c:586
void OnClientPrepareEvent(PlayerIdentity identity, out bool useDB, out vector pos, out float yaw, out int preloadTimeout)
Определения missionServer.c:436
override void SyncRespawnModeInfo(PlayerIdentity identity)
Определения missionServer.c:815
void OnClientDisconnectedEvent(PlayerIdentity identity, PlayerBase player, int logoutTime, bool authFailed)
Определения missionServer.c:628
ref map< PlayerBase, ref LogoutInfo > m_LogoutPlayers
Определения missionServer.c:9
void UpdateLogoutPlayers()
Определения missionServer.c:267
bool m_ProcessInputExcludes
Определения missionGameplay.c:41
void PerformRefreshExcludes()
applies queued excludes (0 == clear excludes)
Определения missionGameplay.c:1045
override void RemoveActiveInputRestriction(int restrictor)
Removes one restriction (specific behaviour oudside regular excludes, defined below)
Определения missionServer.c:865
override void OnMissionStart()
Определения missionServer.c:94
void OnClientReconnectEvent(PlayerIdentity identity, PlayerBase player)
Определения missionServer.c:620
PlayerBase OnClientNewEvent(PlayerIdentity identity, vector pos, ParamsReadContext ctx)
Определения missionServer.c:536
override array< vector > GetActiveRefresherLocations()
Определения missionServer.c:827
void OnClientRespawnEvent(PlayerIdentity identity, PlayerBase player)
Определения missionServer.c:598
ref array< ref CorpseData > m_DeadPlayersArray
Определения missionServer.c:8
int m_MinSimultaneousStrikes
Определения missionServer.c:24
override bool IsPlayerDisconnecting(Man player)
Определения missionServer.c:233
Определения missionGameplay.c:2
Определения PPEConstants.c:68
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Определения param.c:12
Определения PlayerBaseClient.c:2
proto string GetId()
unique id of player (hashed steamID, database Xbox id...) can be used in database or logs
The class that will be instanced (moddable)
Определения gameplay.c:389
static bool IsInitialized()
Определения CfgPlayerSpawnHandler.c:35
static bool ProcessEquipmentData(PlayerBase player, PlayerSpawnPreset data)
equips character with the chosen preset
Определения CfgPlayerSpawnHandler.c:72
static bool LoadData()
Определения CfgPlayerSpawnHandler.c:6
static PlayerSpawnPreset GetRandomCharacterPreset()
Определения CfgPlayerSpawnHandler.c:40
override bool IsValid()
Определения CfgPlayerSpawnDataJson.c:33
string GetRandomCharacterType()
Определения CfgPlayerSpawnDataJson.c:24
proto native void Send(Object target, int rpc_type, bool guaranteed, PlayerIdentity recipient=NULL)
Initiate remote procedure call. When called on client, RPC is evaluated on server; When called on ser...
Определения gameplay.c:105
proto bool Write(void value_out)
static void SendPlayerList()
Определения SyncEvents.c:47
Определения SyncEvents.c:2
proto native void ForceEnable(bool bEnable)
proto native void UpdateControls()
proto native void ActivateExclude(string sExcludeName)
proto native UAInput GetInputByID(int iID)
returns list of all bindable (i.e. visible) inputs from the active group ('core' by default)
proto native void SupressNextFrame(bool bForce)
proto native UIScriptedMenu GetMenu()
Returns most-top open menu.
Определения UIManager.c:2
override bool UseMouse()
Определения GesturesMenu.c:274
override bool UseKeyboard()
Определения ChatInputMenu.c:24
Определения DayZGame.c:64
static void SyncDataSend(PlayerIdentity identity)
Определения UndergroundAreaLoader.c:173
static void SpawnAllTriggerCarriers()
Определения UndergroundAreaLoader.c:134
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения CachedEquipmentStorage.c:4
Определения EnConvert.c:119
const EventType LogoutCancelEventTypeID
params: LogoutCancelEventParams
Определения gameplay.c:529
Param1< Man > LogoutCancelEventParams
Player.
Определения gameplay.c:435
const EventType ClientNewEventTypeID
params: ClientNewEventParams
Определения gameplay.c:509
Param5< PlayerIdentity, bool, vector, float, int > ClientPrepareEventParams
PlayerIdentity, useDB, pos, yaw, preloadTimeout (= additional time in seconds to how long server wait...
Определения gameplay.c:414
Serializer ParamsReadContext
Определения gameplay.c:15
Param2< PlayerIdentity, Man > ClientRespawnEventParams
PlayerIdentity, Man.
Определения gameplay.c:420
const EventType ClientReconnectEventTypeID
params: ClientReconnectEventParams
Определения gameplay.c:515
Param4< PlayerIdentity, Man, int, bool > ClientDisconnectedEventParams
PlayerIdentity, Man, LogoutTime, AuthFailed.
Определения gameplay.c:426
const EventType ClientRespawnEventTypeID
params: ClientRespawnEventParams
Определения gameplay.c:513
Param2< PlayerIdentity, Man > ClientReconnectEventParams
PlayerIdentity, Man.
Определения gameplay.c:424
Param2< PlayerIdentity, Man > ClientReadyEventParams
PlayerIdentity, Man.
Определения gameplay.c:422
Param3< PlayerIdentity, vector, Serializer > ClientNewEventParams
PlayerIdentity, PlayerPos, Top, Bottom, Shoe, Skin.
Определения gameplay.c:416
const EventType ClientDisconnectedEventTypeID
params: ClientDisconnectedEventParams
Определения gameplay.c:519
const EventType ClientReadyEventTypeID
params: ClientReadyEventParams
Определения gameplay.c:517
const EventType ClientPrepareEventTypeID
params: ClientPrepareEventParams
Определения gameplay.c:507
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
proto void Print(void var)
Prints content of variable to console/log.
enum ShapeType ErrorEx
const int INPUT_EXCLUDE_ALL
Определения 3_Game/DayZ/constants.c:657
const int RESPAWN_MODE_CUSTOM
Определения 3_Game/DayZ/constants.c:1050
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const int INPUT_DEVICE_MOUSE
Определения 1_Core/DayZ/constants.c:24
const int INPUT_ACTION_TYPE_DOUBLETAP
Определения 1_Core/DayZ/constants.c:40
const int INPUT_DEVICE_MOUSE_AXIS
Определения 1_Core/DayZ/constants.c:42
const int INPUT_ACTION_TYPE_DOWN_EVENT
Определения 1_Core/DayZ/constants.c:33
static proto float Min(float x, float y)
Returns smaller of two given values.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Определения EnMath.c:54
const int CALL_CATEGORY_GAMEPLAY
Определения 3_Game/DayZ/tools/tools.c:10
const int CALL_CATEGORY_SYSTEM
Определения 3_Game/DayZ/tools/tools.c:8
TypeID EventType
Определения EnWidgets.c:55
Param2< int, string > LogoutInfo
int time of the logout end
Определения missionServer.c:3