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