Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
game.c
Go to the documentation of this file.
1#ifdef BREAK_COMPILATION
2 THIS DEFINE BREAKS GAME SCRIPT MODULE COMPILATION
3 DO NOT REMOVE IT, IT IS NEEDED FOR VARIOUS TESTS
4#endif
5
14
23
25enum EDiagMenuGame : EDiagMenuGameLib
26{
27}
28
31class ArmaReforgerScripted : ChimeraGame
32{
33 const string CONFIG_CORES_PATH = "Configs/Core/";
34
45 protected SCR_SpawnerAIGroupManagerComponent m_SpawnerAIGroupManager;
46 protected bool m_bHasKeyboard;
47
50
52 protected SCR_DataCollectorComponent m_DataCollectorComponent;
53
56
57 bool m_bIsMainMenuOpen = false;
58 private bool m_bGameStarted = false;
59
61 protected ref SCR_Stack<SCR_GameErrorMessage> m_aErrorStack = new SCR_Stack<SCR_GameErrorMessage>();
62
70
72
75
76 //------------------------------------------------------------------------------------------------
77 // destructor
79 {
80 g_ARGame = null;
81 }
82
83 //------------------------------------------------------------------------------------------------
90 IEntity SpawnEntityPrefabEx(ResourceName prefab, bool randomizeEditableVariant, BaseWorld world = null, EntitySpawnParams params = null)
91 {
92 Resource prefabResource = Resource.Load(prefab);
93 if (!prefabResource.IsValid())
94 return null;
95
96 if (!randomizeEditableVariant)
97 return SpawnEntityPrefab(prefabResource, world, params);
98
100 }
101
102 //------------------------------------------------------------------------------------------------
107
108 //------------------------------------------------------------------------------------------------
110 SCR_DataCollectorComponent GetDataCollector()
111 {
113 }
114
115 //------------------------------------------------------------------------------------------------
124
125 //------------------------------------------------------------------------------------------------
134
135 //------------------------------------------------------------------------------------------------
138 void RegisterDataCollector(SCR_DataCollectorComponent instance)
139 {
141 {
142 Print("Trying to register a SCR_DataCollectorComponent, but one is already registered!", LogLevel.ERROR);
143 return;
144 }
145
146 m_DataCollectorComponent = instance;
147 }
148
149 //------------------------------------------------------------------------------------------------
153 {
154 // Only set to null if it's the passed one
155 if (m_BuildingDestructionManager == manager)
157 }
158
159 //------------------------------------------------------------------------------------------------
163 {
165 {
166 Print("Trying to register a SCR_BuildingDestructionManagerComponent, but one is already registered!", LogLevel.ERROR);
167 return;
168 }
169
171 }
172
173 //------------------------------------------------------------------------------------------------
179
180 //------------------------------------------------------------------------------------------------
187
188 //------------------------------------------------------------------------------------------------
197
198 //------------------------------------------------------------------------------------------------
207
208 //------------------------------------------------------------------------------------------------
211 {
212 return m_bHasKeyboard;
213 }
214
215 //------------------------------------------------------------------------------------------------
218 {
219 return m_Callqueue;
220 }
221
222 //------------------------------------------------------------------------------------------------
228
229 //------------------------------------------------------------------------------------------------
235
236 //------------------------------------------------------------------------------------------------
242
243 //------------------------------------------------------------------------------------------------
249
250 //------------------------------------------------------------------------------------------------
256
257 //------------------------------------------------------------------------------------------------
258 override protected void OnMissionSet(MissionHeader mission)
259 {
260 m_OnMissionSetInvoker.Invoke(mission);
261
262 SCR_MissionHeader pHeader = SCR_MissionHeader.Cast(mission);
263 if (pHeader)
264 SetGameFlags(pHeader.m_eDefaultGameFlags, false);
265
266 GameSessionStorage.s_Data["m_iRejoinAttempt"] = "0";
267
268 ESaveGameType enabledSaveTypes = 0;
269 if (pHeader)
270 enabledSaveTypes = pHeader.m_eSaveTypes;
271
272 GetSaveGameManager().SetEnabledSaveTypes(enabledSaveTypes);
273 }
274
275 //------------------------------------------------------------------------------------------------
276 override void OnCinematicStart()
277 {
278 Print("Cinematic start", LogLevel.DEBUG);
279 }
280
281 //------------------------------------------------------------------------------------------------
282 override void OnCinematicEnd()
283 {
284 Print("Cinematic end", LogLevel.DEBUG);
285 }
286
287 //------------------------------------------------------------------------------------------------
288 override void OnGameInstallComplete()
289 {
290 m_OnGameInstallComplete.Invoke(false);
291 }
292
293 //------------------------------------------------------------------------------------------------
294 override void OnCinematicBlending(float blendFactor, vector cameraPosition)
295 {
296 // This makes the player head dissolve nicely when we are transitioning from/to cinematic
298 if (playerEntity)
299 {
300 SCR_CharacterCameraHandlerComponent camHandlerComp = SCR_CharacterCameraHandlerComponent.Cast(playerEntity.FindComponent(SCR_CharacterCameraHandlerComponent));
301 if (camHandlerComp)
302 {
303 camHandlerComp.UpdateHeadVisibility(cameraPosition);
304 }
305 }
306 }
307
308 //------------------------------------------------------------------------------------------------
310 override protected void OnKickedFromGame(KickCauseCode kickCode)
311 {
312 KickCauseGroup2 groupInt;
313 int reasonInt;
314 string group, reason;
315
316 //~ Get the kick reason ID
317 GetFullKickReason(kickCode, groupInt, reasonInt, group, reason);
318
319 // Detail
320 const string format = "Kick cause code: group=%1 '%2', reason=%3 '%4'";
321 string strDetail = string.Format(format, groupInt, group, reasonInt, reason);
322 Print(strDetail, LogLevel.NORMAL);
323
324 // Set dialog tag
325 string dialogTag = group + "_" + reason;
326
327 // Default error
328 if (group == "<unknown>")
329 dialogTag = "DEFAULT_ERROR";
330 else
331 {
332 // No specific reason in group
333 if (reason == "<unknown>")
334 {
335 dialogTag = group;
336 }
337 }
338
339 // Set msg
340 SCR_KickDialogs.CreateKickErrorDialog(dialogTag, group, strDetail);
341
342 // Add rejoin attempt
344 }
345
346 //------------------------------------------------------------------------------------------------
354 bool GetFullKickReason(KickCauseCode kickCode, out KickCauseGroup2 groupInt, out int reasonInt, out string group, out string reason)
355 {
356 groupInt = KickCauseCodeAPI.GetGroup(kickCode);
357 reasonInt = KickCauseCodeAPI.GetReason(kickCode);
358
359
360 group = "<unknown>";
361 reason = "<unknown>";
362
363 switch (groupInt)
364 {
365 case RplKickCauseGroup.REPLICATION:
366 {
367 group = "REPLICATION";
368 reason = typename.EnumToString(RplError, reasonInt);
369 return true;
370 }
371 case KickCauseGroup.BATTLEYE_INIT:
372 {
373 group = "BATTLEYE_INIT";
374 reason = typename.EnumToString(BattlEyeInitError, reasonInt);
375 return true;
376 }
377 case KickCauseGroup.BATTLEYE:
378 {
379 group = "BATTLEYE";
380 reason = typename.EnumToString(BattlEyeKickReason, reasonInt);
381 return true;
382 }
383 case KickCauseGroup.DATA:
384 {
385 group = "DATA";
386 reason = typename.EnumToString(DataError, reasonInt);
387 return true;
388 }
389 case KickCauseGroup2.PLATFORM:
390 {
391 group = "PLATFORM";
392 reason = typename.EnumToString(PlatformKickReason, reasonInt);
393 return true;
394 }
395 case KickCauseGroup2.PLAYER_MANAGER:
396 {
397 group = "PLAYER_MANAGER";
398 reason = typename.EnumToString(SCR_PlayerManagerKickReason, reasonInt);
399 return true;
400 }
401 }
402
403 return false;
404 }
405
406 //------------------------------------------------------------------------------------------------
407 protected void AddRejoinAttempt()
408 {
409 // Get count
410 string strAttempt = GameSessionStorage.s_Data["m_iRejoinAttempt"];
411 int attempt = 0;
412
413 // Setup number
414 if (strAttempt.IsEmpty())
415 {
416 GameSessionStorage.s_Data["m_iRejoinAttempt"] = "0";
417 }
418 else
419 {
420 attempt = strAttempt.ToInt();
421 }
422
423 // Add
424 attempt++;
425 GameSessionStorage.s_Data["m_iRejoinAttempt"] = attempt.ToString();
426 }
427
428 //------------------------------------------------------------------------------------------------
429 protected override void OnWorldPostProcess(World world)
430 {
431 if (m_CoresManager)
432 m_CoresManager.OnWorldPostProcess(world);
433
434 if (GetGameMode())
436 }
437
438 //------------------------------------------------------------------------------------------------
441 protected override void ShowErrorMessage(string msg)
442 {
443 m_aErrorStack.Push(new SCR_GameErrorMessage(msg, "Error"));
444 }
445
446 //------------------------------------------------------------------------------------------------
449 protected void ShowNextErrorDialog()
450 {
451 MenuManager menuManager = GetMenuManager();
452 if (!menuManager) // No menu manager, we have no means of displaying the error atm
453 return;
454
455 DialogUI currentDialog = DialogUI.Cast(menuManager.FindMenuByPreset(ChimeraMenuPreset.ErrorDialog));
456 if (currentDialog != null) // There is already an error dialog displayed, do not display next one
457 return;
458
459 SCR_GameErrorMessage errorMessage = m_aErrorStack.Pop();
460 if (!errorMessage)
461 return; // Should not occur as we're checking for whether the stack is empty
462
463 // Display the error message using DialogUI menu dialogue
464 if (errorMessage)
465 {
466 DialogUI dialog = DialogUI.Cast(menuManager.OpenDialog(ChimeraMenuPreset.ErrorDialog));
467 if (dialog)
468 {
469 dialog.SetTitle(errorMessage.GetTitle());
470 dialog.SetMessage(errorMessage.GetMessage());
471 }
472 }
473 }
474
475 //------------------------------------------------------------------------------------------------
478 {
479 return m_bGameStarted;
480 }
481
482 //------------------------------------------------------------------------------------------------
485 {
486 return m_eGameFlags;
487 }
488
489 //------------------------------------------------------------------------------------------------
492 void SetGameFlags(EGameFlags newGameFlags, bool shouldInvoke)
493 {
495 m_eGameFlags = newGameFlags;
496
497 if (shouldInvoke)
498 {
500 }
501 }
502
503 //------------------------------------------------------------------------------------------------
509 {
511 }
512
513 //------------------------------------------------------------------------------------------------
517 bool AreGameFlagsSet(EGameFlags checkGameFlags)
518 {
519 return (m_eGameFlags & checkGameFlags) != 0;
520 }
521
522 //------------------------------------------------------------------------------------------------
528
529 //------------------------------------------------------------------------------------------------
530 protected void InvokeGameFlags()
531 {
533 }
534
535 //------------------------------------------------------------------------------------------------
538 override typename GetMenuPreset()
539 {
540 return ChimeraMenuPreset;
541 }
542
543 //------------------------------------------------------------------------------------------------
545 {
546 return new ArmaReforgerLoadingAnim(workspaceWidget);
547 }
548
549 //------------------------------------------------------------------------------------------------
552 override void OnAfterInit(BaseWorld world)
553 {
554 if (GetGame().InPlayMode())
556
557 WidgetManager.SetCursor(0);
558 }
559
560 //------------------------------------------------------------------------------------------------
561 override bool OnGameStart()
562 {
563 m_bGameStarted = true;
564 const RplMode currentMode = RplSession.Mode();
565
566 #ifdef ENABLE_DIAG
567 if (currentMode != RplMode.Client)
568 {
569 DiagMenu.RegisterMenu(SCR_DebugMenuID.DEBUGUI_DEPLOYABLE_SPAWNPOINTS, "Deployable SpawnPoints", "Game");
570 DiagMenu.RegisterBool(SCR_DebugMenuID.DEBUGUI_DEPLOYABLE_SPAWNPOINTS_ENABLE_DIAG, "", "Show Exclusion Zones", "Deployable SpawnPoints");
571 }
572
573 DiagMenu.RegisterItem(SCR_DebugMenuID.DEBUGUI_INPUT_MANAGER, "", "Show input manager", "GameCode", "disabled,active,all");
574
575 // Game
576 DiagMenu.RegisterBool(SCR_DebugMenuID.DEBUGUI_GAME_BOUNDS_OVERLAP_PREFAB, "", "Show bounds overlap target info", "Game");
577 DiagMenu.RegisterBool(SCR_DebugMenuID.DEBUGUI_GAME_CURSOR_TARGET_PREFAB, "", "Show cursor target info", "Game");
578 DiagMenu.RegisterBool(SCR_DebugMenuID.DEBUGUI_GAME_COPY_ENF_VIEW_LINK, "lctrl+lshift+l", "Copy view link", "Game");
579
580 // UI
581 DiagMenu.RegisterBool(SCR_DebugMenuID.DEBUGUI_UI_CLOSE_ALL_MENUS, "", "Close All Menus", "UI");
582 DiagMenu.RegisterBool(SCR_DebugMenuID.DEBUGUI_UI_OPEN_MAIN_MENU, "", "Open Main Menu", "UI");
583 DiagMenu.RegisterBool(SCR_DebugMenuID.DEBUGUI_UI_LOG_UNDER_CURSOR, "", "Log widgets under cursor", "UI");
584
585 //Scripted systems
586 DiagMenu.RegisterMenu(SCR_DebugMenuID.DEBUGUI_SCRIPTS_MENU, "Scripts", "Physics");
587 DiagMenu.RegisterBool(SCR_DebugMenuID.DEBUGUI_SHOW_INTERIOR_BOUNDING_BOX, "", "Show interior bounding box", "Scripts");
588 #endif
589
590 if (!GetWorldEntity() || currentMode != RplMode.Client)
591 {
594 }
595
597
599 m_CoresManager.OnGameStart();
600
602
603#ifndef PLATFORM_CONSOLE
604 if (System.IsCLIParam("listScenarios"))
605 SCR_GameLogHelper.LogScenariosConfPaths();
606
607 m_bHasKeyboard = true;
608
609 if (!FileIO.FileExists("$profile:.save\\settings\\customInputConfigs"))
610 FileIO.MakeDirectory("$profile:.save\\settings\\customInputConfigs");
611#endif
612
613#ifdef PLATFORM_CONSOLE
614 SCR_SettingsManager settingsManager = GetSettingsManager();
615
616 //setup default quality settings for consoles
617 if (settingsManager)
618 {
619 SCR_SettingsManagerVideoModule settingsVideoModule = SCR_SettingsManagerVideoModule.Cast(settingsManager.GetModule(ESettingManagerModuleType.SETTINGS_MANAGER_VIDEO));
620
621 if (settingsVideoModule)
622 {
623 int lastUsedPresetID = -1;
624 BaseContainer videoSettings = GetGame().GetGameUserSettings().GetModule("SCR_VideoSettings");
625 if (videoSettings)
626 {
627 videoSettings.Get("m_iLastUsedPreset", lastUsedPresetID);
628 if (lastUsedPresetID == -1 && System.GetPlatform() == EPlatform.XBOX_SERIES_S)
629 settingsVideoModule.SetConsolePreset(EVideoQualityPreset.SERIES_S_PRESET_PERFORMANCE);
630 else if (lastUsedPresetID == -1 && System.GetPlatform() == EPlatform.XBOX_SERIES_X)
631 settingsVideoModule.SetConsolePreset(EVideoQualityPreset.SERIES_X_PRESET_PERFORMANCE);
632 else if (lastUsedPresetID == -1 && System.GetPlatform() == EPlatform.PS5)
633 settingsVideoModule.SetConsolePreset(EVideoQualityPreset.PS5_PERFORMANCE);
634 else if (lastUsedPresetID == -1 && System.GetPlatform() == EPlatform.PS5_PRO)
635 settingsVideoModule.SetConsolePreset(EVideoQualityPreset.PS5_PRO_PERFORMANCE);
636
637 if (lastUsedPresetID != -1)
638 settingsVideoModule.SetConsolePreset(lastUsedPresetID);
639 }
640 }
641 }
642#endif
643
644 const SCR_AdditionalGameModeSettingsComponent additionalSettingsComp = SCR_AdditionalGameModeSettingsComponent.GetInstance();
645 if (additionalSettingsComp && ((currentMode == RplMode.Listen || currentMode == RplMode.Dedicated) && System.IsCLIParam("enableNightGrain")))
646 additionalSettingsComp.SetNightNoiseEffectState_S(false);
647
648 return true;
649 }
650
651 //------------------------------------------------------------------------------------------------
652 protected static void OnMenuOpen()
653 {
654 MenuManager menuManager = GetGame().GetMenuManager();
655 if (!menuManager || menuManager.IsAnyMenuOpen() || menuManager.IsAnyDialogOpen())
656 return;
657
658 OpenPauseMenu();
659 }
660
661 //------------------------------------------------------------------------------------------------
663 static void OnShowPlayerList()
664 {
665 MenuManager manager = GetGame().GetMenuManager();
666 if (manager.IsAnyMenuOpen() || manager.IsAnyDialogOpen())
667 return;
668
669 OpenPlayerList();
670 }
671
672 //------------------------------------------------------------------------------------------------
674 static void OnShowGroupMenu()
675 {
677 }
678
679 //------------------------------------------------------------------------------------------------
683 static void OpenPauseMenu(bool hideParentMenu = true, bool fadeBackground = false)
684 {
685 MenuBase menu = GetGame().GetMenuManager().OpenMenu(ChimeraMenuPreset.PauseMenu, 0, true, hideParentMenu);
686 if (!fadeBackground)
687 return;
688
689 PauseMenuUI pauseMenu = PauseMenuUI.Cast(menu);
690 if (pauseMenu)
691 pauseMenu.FadeBackground(true, true);
692 }
693
694 //------------------------------------------------------------------------------------------------
697 static SCR_PlayerListMenu OpenPlayerList()
698 {
699 MenuManager menuManager = GetGame().GetMenuManager();
700 if (menuManager.IsAnyDialogOpen())
701 return null; // We don't want to open this menu behind any dialogs.
702
703 MenuBase menu = menuManager.FindMenuByPreset(ChimeraMenuPreset.PlayerListMenu);
704 if (!menu)
705 menu = menuManager.OpenMenu(ChimeraMenuPreset.PlayerListMenu);
706
707 return SCR_PlayerListMenu.Cast(menu);
708 }
709
710 //------------------------------------------------------------------------------------------------
713 static SCR_GroupMenu OpenGroupMenu()
714 {
715 SCR_GroupsManagerComponent groupManager = SCR_GroupsManagerComponent.GetInstance();
716 if (!groupManager || !groupManager.IsGroupMenuAllowed())
717 return null;
718
719 SCR_Faction playerFaction;
720 SCR_FactionManager factionManager = SCR_FactionManager.Cast(GetGame().GetFactionManager());
721 if (factionManager)
722 playerFaction = SCR_Faction.Cast(factionManager.GetLocalPlayerFaction());
723
724 if (!playerFaction)
725 return null;
726
727 MenuManager menuManager = GetGame().GetMenuManager();
728 if (menuManager.IsAnyDialogOpen())
729 return null; // We don't want to open this menu behind any dialogs.
730
731 MenuBase playerMenu = menuManager.FindMenuByPreset(ChimeraMenuPreset.PlayerListMenu);
732 if (playerMenu)
733 return null;
734
735 MenuBase menu = menuManager.FindMenuByPreset(ChimeraMenuPreset.GroupMenu);
736 if (!menu)
737 GetGame().GetMenuManager().OpenMenu(ChimeraMenuPreset.GroupMenu, 0, false, false);
738 else
739 GetGame().GetMenuManager().CloseMenu(menu);
740
741 return SCR_GroupMenu.Cast(menu);
742 }
743
744 //------------------------------------------------------------------------------------------------
745 override void OnGameEnd()
746 {
749 GetGame().GetMenuManager().CloseAllMenus();
750
752
754 if (gameMode)
755 gameMode.OnGameEnd();
756
758 m_CoresManager.OnGameEnd();
759 }
760
761 override protected void OnBeforeWorldCleanup()
762 {
764 m_CoresManager.OnBeforeWorldCleanup();
765 }
766
767 //------------------------------------------------------------------------------------------------
769 {
771 }
772
773 //------------------------------------------------------------------------------------------------
777 override void OnInputDeviceUserChangedEvent(EInputDeviceType oldDevice, EInputDeviceType newDevice)
778 {
779 m_OnInputDeviceUserChangedInvoker.Invoke(oldDevice, newDevice);
780 }
781
782 //------------------------------------------------------------------------------------------------
783 override void OnInputDeviceIsGamepadEvent(bool isGamepad)
784 {
785 m_OnInputDeviceIsGamepadInvoker.Invoke(isGamepad);
786 if (!m_bHasKeyboard && !isGamepad)
787 m_bHasKeyboard = true;
788 }
789
790 //------------------------------------------------------------------------------------------------
791 override void OnWorldSimulatePhysics(float timeSlice)
792 {
793 m_OnWorldSimulatePhysicsInvoker.Invoke(timeSlice);
794 }
795
796 //------------------------------------------------------------------------------------------------
797 override event void OnWindowResize(int w, int h, bool windowed)
798 {
799 m_OnWindowResizeInvoker.Invoke(w, h, windowed);
800 }
801
802 //------------------------------------------------------------------------------------------------
805 {
806 InputManager inputManager = GetInputManager();
807 inputManager.AddActionListener("ShowScoreboard", EActionTrigger.DOWN, OnShowPlayerList);
808 inputManager.AddActionListener("ShowGroupMenu", EActionTrigger.DOWN, OnShowGroupMenu);
809 inputManager.AddActionListener(UIConstants.MENU_ACTION_OPEN, EActionTrigger.DOWN, OnMenuOpen);
810
811 #ifdef WORKBENCH
812 inputManager.AddActionListener(UIConstants.MENU_ACTION_OPEN_WB, EActionTrigger.DOWN, OnMenuOpen);
813 #endif
814 }
815
816 //------------------------------------------------------------------------------------------------
819 {
820 InputManager inputManager = GetInputManager();
821 inputManager.RemoveActionListener("ShowScoreboard", EActionTrigger.DOWN, OnShowPlayerList);
822 inputManager.RemoveActionListener("ShowGroupMenu", EActionTrigger.DOWN, OnShowGroupMenu);
823 inputManager.RemoveActionListener(UIConstants.MENU_ACTION_OPEN, EActionTrigger.DOWN, OnMenuOpen);
824
825 #ifdef WORKBENCH
826 inputManager.RemoveActionListener(UIConstants.MENU_ACTION_OPEN_WB, EActionTrigger.DOWN, OnMenuOpen);
827 #endif
828 }
829
830 #ifdef ENABLE_DIAG
831 private ref QueryTargetDiag m_pQueryTargetDiag = new QueryTargetDiag();
832
833 //------------------------------------------------------------------------------------------------
834 private bool GetQueryTargetInfo(IEntity ent, out string name, out string tree)
835 {
836 if (!ent)
837 return false;
838
839 EntityPrefabData prefabData = ent.GetPrefabData();
840 if (!prefabData)
841 return false;
842
843 name = prefabData.GetPrefabName();
844 tree = "";
845
846 BaseContainer cont = prefabData.GetPrefab();
847 while (cont)
848 {
849 string contName = cont.GetName();
850 if (!contName.IsEmpty())
851 {
852 tree += contName;
853 if (!tree.IsEmpty())
854 tree += "\n";
855
856 if (name.IsEmpty())
857 name = contName;
858 }
859
860 cont = cont.GetAncestor();
861 }
862
863 return true;
864 }
865 #endif
866
867 //------------------------------------------------------------------------------------------------
868 override void OnUpdate(BaseWorld world, float timeslice)
869 {
870 super.OnUpdate(world, timeslice);
871
872 m_Callqueue.Tick(timeslice);
873
874 // Setup in-game context
875 if (!GetMenuManager().IsAnyMenuOpen())
876 {
877 GetInputManager().ActivateContext("IngameContext", 1);
878 }
879
880 // If we're in the main menu and there are errors on the error stack
881 // process them one by one
883 {
884 if (!m_aErrorStack.IsEmpty())
885 {
887 }
888 }
889
890 GetInputManager().SetDebug(DiagMenu.GetValue(SCR_DebugMenuID.DEBUGUI_INPUT_MANAGER));
891
892 // Check clipboard link diag
893 #ifdef ENABLE_DIAG
894 bool bGetEnfLinkToClipboard = DiagMenu.GetBool(SCR_DebugMenuID.DEBUGUI_GAME_COPY_ENF_VIEW_LINK);
895 if (bGetEnfLinkToClipboard)
896 {
897 // Out to clip
898 vector cameraTransform[4];
899 world.GetCurrentCamera(cameraTransform);
900 System.ExportToClipboard(GetWorldEditorLink(cameraTransform));
901 // Reset
902 DiagMenu.SetValue(SCR_DebugMenuID.DEBUGUI_GAME_COPY_ENF_VIEW_LINK, 0);
903 }
904
905 if (DiagMenu.GetBool(SCR_DebugMenuID.DEBUGUI_GAME_CURSOR_TARGET_PREFAB))
906 {
907 CameraManager cameraManager = GetGame().GetCameraManager();
908 if (cameraManager)
909 {
910 CameraBase current = cameraManager.CurrentCamera();
911 if (current)
912 {
913 DbgUI.Begin("Cursor target info");
914 IEntity ent = current.GetCursorTarget();
915 if (ent)
916 {
917 // Position
918 vector pos = ent.GetOrigin();
919
920 // Name
921 string name = ent.GetName();
922 string pname;
923 if (name.IsEmpty())
924 pname = "Unnamed entity";
925 else
926 pname = "Name: " + name;
927
928 // Draw text
929 DbgUI.Text(pname);
930
931 string prfab;
932 string ptree;
933 string pepos;
934 if (GetQueryTargetInfo(ent, prfab, ptree))
935 {
936 pepos = "Position: <" + pos[0] + ", " + pos[1] + ", " + pos[2] + ">";
937
938 Physics phys = ent.GetPhysics();
939 if (phys && phys.GetVelocity().Length() > 0)
940 {
941 string pevel = "Velocity: " + phys.GetVelocity().Length();
942 pepos += ", ";
943 pepos += pevel;
944 }
945 DbgUI.Text(pepos);
946
947 DbgUI.Text("Prefab: " + prfab);
948 DbgUI.Text("Prefab Inheritance Tree: " + ptree);
949 }
950 DbgUI.Spacer(32);
951 string infoText = string.Format("%1\n%2\nPrefab: \"%3\"\nPrefab Inheritance Tree: \"%4\"", pname, pepos, prfab, ptree);
952
953 if (DbgUI.Button("Copy to clipboard"))
954 {
955 System.ExportToClipboard(infoText);
956 }
957
958 // Draw ddbox
959 vector mins, maxs;
960 ent.GetWorldBounds(mins, maxs);
961 Shape boundingFill = Shape.Create(ShapeType.BBOX, ARGB(5, 0, 255, 0), ShapeFlags.ONCE | ShapeFlags.NOZBUFFER | ShapeFlags.TRANSP, mins, maxs);
962 Shape boundingWire = Shape.Create(ShapeType.BBOX, ARGB(200, 0, 255, 255), ShapeFlags.ONCE | ShapeFlags.NOZBUFFER | ShapeFlags.WIREFRAME | ShapeFlags.TRANSP, mins, maxs);
963
964 DebugTextWorldSpace.Create(current.GetWorld(), infoText, DebugTextFlags.FACE_CAMERA | DebugTextFlags.CENTER | DebugTextFlags.ONCE, pos[0], maxs[1] + 0.5, pos[2], 8, ARGB(255, 0, 255, 255), ARGB(64, 0, 0, 0));
965 }
966 DbgUI.End();
967 }
968 }
969 }
970
971 if (DiagMenu.GetBool(SCR_DebugMenuID.DEBUGUI_GAME_BOUNDS_OVERLAP_PREFAB))
972 {
973 CameraManager cameraManager = GetGame().GetCameraManager();
974 if (cameraManager)
975 {
976 CameraBase current = cameraManager.CurrentCamera();
977 if (current)
978 {
979 DbgUI.Begin("Bounds overlap target info");
980 vector cameraMat[4];
981 current.GetWorldTransform(cameraMat);
982
983 m_pQueryTargetDiag.Prepare();
984 m_pQueryTargetDiag.DoQuery(current.GetWorld(), cameraMat[3], cameraMat[3] + 3.0 * cameraMat[2]);
985 IEntity ent = m_pQueryTargetDiag.GetClosestEntity(cameraMat[3]);
986 if (ent)
987 {
988 // Position
989 vector pos = ent.GetOrigin();
990
991 // Name
992 string name = ent.GetName();
993 string pname;
994 if (name.IsEmpty())
995 pname = "Unnamed entity";
996 else
997 pname = "Name: " + name;
998
999 // Draw text
1000 DbgUI.Text(pname);
1001
1002 string prfab;
1003 string ptree;
1004 string pepos;
1005 if (GetQueryTargetInfo(ent, prfab, ptree))
1006 {
1007 pepos = "Position: <" + pos[0] + ", " + pos[1] + ", " + pos[2] + ">";
1008
1009 Physics phys = ent.GetPhysics();
1010 if (phys && phys.GetVelocity().Length() > 0)
1011 {
1012 string pevel = "Velocity: " + phys.GetVelocity().Length();
1013 pepos += ", ";
1014 pepos += pevel;
1015 }
1016 DbgUI.Text(pepos);
1017
1018 DbgUI.Text("Prefab: " + prfab);
1019 DbgUI.Text("Prefab Inheritance Tree: " + ptree);
1020 }
1021 DbgUI.Spacer(32);
1022 string infoText = string.Format("%1\n%2\nPrefab: \"%3\"\nPrefab Inheritance Tree: \"%4\"", pname, pepos, prfab, ptree);
1023 if (DbgUI.Button("Copy to clipboard"))
1024 {
1025 System.ExportToClipboard(infoText);
1026 }
1027
1028 // Draw ddbox
1029 vector mins, maxs;
1030 ent.GetWorldBounds(mins, maxs);
1031 Shape boundingFill = Shape.Create(ShapeType.BBOX, ARGB(5, 0, 255, 0), ShapeFlags.ONCE | ShapeFlags.NOZBUFFER | ShapeFlags.TRANSP, mins, maxs);
1032 Shape boundingWire = Shape.Create(ShapeType.BBOX, ARGB(200, 0, 255, 255), ShapeFlags.ONCE | ShapeFlags.NOZBUFFER | ShapeFlags.WIREFRAME | ShapeFlags.TRANSP, mins, maxs);
1033
1034 DebugTextWorldSpace.Create(current.GetWorld(), infoText, DebugTextFlags.FACE_CAMERA | DebugTextFlags.CENTER | DebugTextFlags.ONCE, pos[0], maxs[1] + 0.5, pos[2], 8, ARGB(255, 0, 255, 255), ARGB(64, 0, 0, 0));
1035 }
1036 DbgUI.End();
1037 }
1038 }
1039 }
1040
1041 // Close all menus
1042 if (DiagMenu.GetBool(SCR_DebugMenuID.DEBUGUI_UI_CLOSE_ALL_MENUS))
1043 {
1044 DiagMenu.SetValue(SCR_DebugMenuID.DEBUGUI_UI_CLOSE_ALL_MENUS, 0);
1045 GetGame().GetMenuManager().CloseAllMenus();
1046 }
1047
1048 // Open main menu
1049 if (DiagMenu.GetBool(SCR_DebugMenuID.DEBUGUI_UI_OPEN_MAIN_MENU))
1050 {
1051 DiagMenu.SetValue(SCR_DebugMenuID.DEBUGUI_UI_OPEN_MAIN_MENU, 0);
1052 GetGame().GetMenuManager().OpenMenu(ChimeraMenuPreset.MainMenu);
1053 }
1054
1055 if (DiagMenu.GetBool(SCR_DebugMenuID.DEBUGUI_UI_LOG_UNDER_CURSOR))
1056 {
1057 DiagMenu.SetValue(SCR_DebugMenuID.DEBUGUI_UI_LOG_UNDER_CURSOR, 0);
1058
1059 array<Widget> widgets = {};
1060 int mouseX, mouseY;
1061 WidgetManager.GetMousePos(mouseX, mouseY);
1062 WidgetManager.TraceWidgets(mouseX, mouseY, GetGame().GetWorkspace(), widgets);
1063 int count = widgets.Count();
1064 Print(string.Format("Widgets under cursor (x = %1, y = %2): %3", mouseX, mouseY, count), LogLevel.NORMAL);
1065 for (int i; i < count; i++)
1066 {
1067 Print(" " + SCR_WidgetTools.GetHierarchyLog(widgets[i]), LogLevel.NORMAL);
1068 }
1069 }
1070
1071 #endif
1072
1074 m_CoresManager.OnUpdate(timeslice);
1075 }
1076
1077 //------------------------------------------------------------------------------------------------
1080 {
1081 if (m_HUDManager == hud)
1082 return;
1083
1084 m_HUDManager = hud;
1085
1086 m_OnHUDManagerChanged.Invoke();
1087 }
1088
1089 //------------------------------------------------------------------------------------------------
1094 {
1095 // Ignore calls outside of ChimeraWorld (e.g., ResourceBrowser)
1096 if (!instance || !ChimeraWorld.CastFrom(instance.GetWorld()))
1097 return;
1098
1100 {
1101 Print("Trying to register a SCR_LoadoutManager, but one is already registered!", LogLevel.ERROR);
1102 Print(string.Format(" oldEntity: %1", m_pLoadoutManager), LogLevel.ERROR);
1103 Print(string.Format(" newEntity: %1", instance), LogLevel.ERROR);
1104 return;
1105 }
1106
1107 m_pLoadoutManager = instance;
1108 if (!m_pLoadoutManager)
1109 return;
1110
1111 SCR_FactionManager factionMgr = SCR_FactionManager.Cast(GetFactionManager());
1112 if (factionMgr)
1113 factionMgr.UpdateCustomLoadoutSupportState(m_pLoadoutManager);
1114 }
1115
1116 //------------------------------------------------------------------------------------------------
1121 {
1122 // Ignore calls outside of ChimeraWorld (e.g., ResourceBrowser)
1123 if (instance && !ChimeraWorld.CastFrom(instance.GetWorld()))
1124 return;
1125
1126 if (!m_pLoadoutManager)
1127 {
1128 Print("Trying to unregister a SCR_LoadoutManager, but none is registered!", LogLevel.ERROR);
1129 return;
1130 }
1131
1132 if (!instance)
1133 {
1134 Print("Trying to unregister an invalid SCR_LoadoutManager!", LogLevel.ERROR);
1135 return;
1136 }
1137
1138 if (m_pLoadoutManager != instance)
1139 {
1140 Print("Trying to unregister a SCR_LoadoutManager, but different one is registered!", LogLevel.ERROR);
1141 return;
1142 }
1143
1144 Print("SCR_LoadoutManager unregistered successfully, released instance: " + instance, LogLevel.VERBOSE);
1145 // Release reference
1146 m_pLoadoutManager = null;
1147 }
1148
1149 //------------------------------------------------------------------------------------------------
1155
1156 #ifdef ENABLE_DIAG
1157 //------------------------------------------------------------------------------------------------
1160 static string GetWorldEditorLink(vector transformation[4])
1161 {
1162 // Fetch position
1163 vector position = transformation[3];
1164
1165 // Fetch angles
1166 vector angles = Math3D.MatrixToAngles(transformation);
1167
1168 // We want to substring only /worlds/...
1169 // to prevent exposing local folders, etc.
1170 string fullLink = GetGame().GetWorldFile();
1171 string fullLinkLower = fullLink;
1172 fullLinkLower.ToLower(); // In case another casing of the folder is used
1173 int begin = fullLinkLower.IndexOf("worlds/");
1174 string worldPath = fullLink.Substring(begin, fullLink.Length() - begin);
1175
1176 // Create link
1177 string link = string.Format(
1178 "enfusion://WorldEditor/%1;%2,%3,%4;%5,%6,%7",
1179 worldPath,
1180 position[0],
1181 position[1],
1182 position[2],
1183 angles[1],
1184 angles[0],
1185 angles[2]);
1186
1187 // Print it to console
1188 return link;
1189 }
1190 #endif
1191
1192 //------------------------------------------------------------------------------------------------
1193 override protected ref Managed GetPlayerDataStats(int playerID)
1194 {
1196 return m_DataCollectorComponent.GetPlayerDataStats(playerID);
1197
1198 return null;
1199 }
1200
1201 //------------------------------------------------------------------------------------------------
1202 override protected ref Managed GetSessionDataStats()
1203 {
1205 return m_DataCollectorComponent.GetSessionDataStats();
1206
1207 return null;
1208 }
1209
1210 //------------------------------------------------------------------------------------------------
1211 override string GetMissionName()
1212 {
1213 SCR_MissionHeader header = SCR_MissionHeader.Cast(GetMissionHeader());
1214 if (header)
1215 return header.m_sName;
1216 else
1217 return "";
1218 }
1219
1220 //------------------------------------------------------------------------------------------------
1221 override void PlayGameConfig(ResourceName sResource, string addonsList)
1222 {
1223 Print(string.Format("PlayGameConfig {Resource: %1; Addons: %2}", sResource, addonsList), LogLevel.NORMAL);
1224
1225 if (sResource.Empty)
1226 {
1227 Print(string.Format("PlayGameConfig: Empty resource passed!"), LogLevel.NORMAL);
1228 return;
1229 }
1230
1231 if (GameStateTransitions.RequestScenarioChangeTransition(sResource, string.Empty, addonsList))
1232 GetGame().GetMenuManager().CloseAllMenus();
1233 else
1234 Print(string.Format("Failed to start scenario."), LogLevel.ERROR);
1235 }
1236
1237 //------------------------------------------------------------------------------------------------
1238 override void HostGameConfig()
1239 {
1240 bool success = GameStateTransitions.RequestPublicServerTransition(null);
1241
1242 if (success)
1243 GetGame().GetMenuManager().CloseAllMenus();
1244 else
1245 Print("Failed to host config", LogLevel.ERROR);
1246 }
1247
1248 //------------------------------------------------------------------------------------------------
1251 override Managed ReadGameConfig(string sResource)
1252 {
1253 return MissionHeader.ReadMissionHeader(sResource);
1254 }
1255
1256 //------------------------------------------------------------------------------------------------
1259 override array<ResourceName> GetDefaultGameConfigs()
1260 {
1261 const ResourceName config = "{CB4130E7FBE99D74}Configs/Workshop/DefaultScenarios.conf";
1262 Resource resource = BaseContainerTools.LoadContainer(config);
1263 if (!resource)
1264 return null;
1265
1266 BaseContainer entries = resource.GetResource().ToBaseContainer();
1267 if (!entries)
1268 return null;
1269
1270 array<ResourceName> resources = {};
1271
1272 entries.Get("m_aDefaultScenarios", resources);
1273
1274 return resources;
1275 }
1276
1277 //------------------------------------------------------------------------------------------------
1281 protected void InsertNewScenario(ResourceName scenario, inout array<ResourceName> resources)
1282 {
1283 foreach (ResourceName r : resources)
1284 {
1285 if (scenario == r)
1286 return;
1287 }
1288
1289 resources.Insert(scenario);
1290 }
1291
1292 //------------------------------------------------------------------------------------------------
1295 protected static bool CheckMissionHeader(MissionWorkshopItem mission)
1296 {
1297 SCR_MissionHeader header = SCR_MissionHeader.Cast(mission.GetHeader());
1298
1299 if (!header)
1300 {
1301 Print(string.Format("Mission header doesn't exist or is not of SCR_MissionHeader class: %1", mission.Name()), LogLevel.ERROR);
1302 return false;
1303 }
1304
1305 string worldPath = header.GetWorldPath();
1306 if (worldPath.IsEmpty())
1307 {
1308 Print(string.Format("Mission world path is incorrect: %1", mission.Name()), LogLevel.ERROR);
1309 return false;
1310 }
1311
1312 return true;
1313 }
1314
1315 //------------------------------------------------------------------------------------------------
1317 static SCR_2DPIPSightsComponent GetCurrentPIPSights()
1318 {
1319 IEntity controlledEntity = SCR_PlayerController.GetLocalControlledEntity();
1320 if (!controlledEntity)
1321 return null;
1322
1323 ChimeraCharacter character = ChimeraCharacter.Cast(controlledEntity);
1324 if (!character)
1325 return null;
1326
1327 BaseWeaponManagerComponent weaponManager = character.GetCharacterController().GetWeaponManagerComponent();
1328 if (!weaponManager)
1329 return null;
1330
1331 BaseSightsComponent currentSights = weaponManager.GetCurrentSights();
1332 if (!currentSights)
1333 return null;
1334
1335 SCR_2DPIPSightsComponent pip = SCR_2DPIPSightsComponent.Cast(currentSights);
1336 if (!pip)
1337 return null;
1338
1339 return pip;
1340 }
1341
1342 //------------------------------------------------------------------------------------------------
1347 static bool IsScreenPointInPIPSights(vector screenPosition, SCR_2DPIPSightsComponent sightsComponent)
1348 {
1349 if (!sightsComponent)
1350 return false;
1351
1352 return sightsComponent.IsScreenPositionInSights(screenPosition);
1353 }
1354
1355 //-------------------------------------------------------------------------------------------
1358 {
1359 #ifdef PLATFORM_CONSOLE
1360 return true;
1361 #else
1362 return false;
1363 #endif
1364 }
1365
1366 //-------------------------------------------------------------------------------------------
1369 override void OnGamepadConnectionStatus(bool isConnected)
1370 {
1371 #ifndef AUTOTEST
1373 {
1374 if (!isConnected)
1376 else
1378 }
1379 #endif
1380 }
1381
1382 override void OnUserSignedOut()
1383 {
1384 GetGame().GetMenuManager().OpenMenu(ChimeraMenuPreset.MainMenu);
1385 }
1386}
1387
1388ArmaReforgerScripted g_ARGame;
1389
1390//------------------------------------------------------------------------------------------------
1392{
1393 g_ARGame = new ArmaReforgerScripted;
1394 return g_ARGame;
1395}
1396
1397//------------------------------------------------------------------------------------------------
1398ArmaReforgerScripted GetGame()
1399{
1400 return g_ARGame;
1401}
1402
1403#ifdef ENABLE_DIAG
1404class QueryTargetDiag
1405{
1406 private ref array<IEntity> m_aQueriedTargetEntities = {};
1407
1408 //------------------------------------------------------------------------------------------------
1410 // Prepares for collection
1411 void Prepare()
1412 {
1413 m_aQueriedTargetEntities.Clear();
1414 }
1415
1416 //------------------------------------------------------------------------------------------------
1421 // Collects nearby entities
1422 void DoQuery(BaseWorld world, vector from, vector to)
1423 {
1424 world.QueryEntitiesByLine(from, to, QueryTargetEntity);
1425 }
1426
1427 // Internal query callback
1428 private bool QueryTargetEntity(IEntity ent)
1429 {
1430 if (CameraBase.Cast(ent))
1431 return true;
1432
1433 m_aQueriedTargetEntities.Insert(ent);
1434 return true;
1435 }
1436
1438 IEntity GetFirstEntity()
1439 {
1440 if (m_aQueriedTargetEntities.Count() > 0)
1441 return m_aQueriedTargetEntities[0];
1442
1443 return null;
1444 }
1445
1446 //------------------------------------------------------------------------------------------------
1449 // Returns closest entity relative to point
1450 IEntity GetClosestEntity(vector relativeTo)
1451 {
1452 IEntity closest = null;
1453 float sqDistance = float.MAX;
1454 foreach (IEntity ent : m_aQueriedTargetEntities)
1455 {
1456 float currentSqDist = vector.DistanceSq(ent.GetOrigin(), relativeTo);
1457 if (currentSqDist < sqDistance)
1458 {
1459 closest = ent;
1460 sqDistance = currentSqDist;
1461 }
1462 }
1463
1464 return closest;
1465 }
1466}
1467#endif
BattlEyeInitError
BattlEyeKickReason
ChimeraMenuPreset
Menu presets.
DataError
Definition DataError.c:8
SCR_DebugMenuID
This enum contains all IDs for DiagMenu entries added in script.
Definition DebugMenuID.c:4
ref ScriptInvokerVoid m_OnHUDManagerChanged
Definition game.c:68
EGameFlags m_eGameFlags
Game Flags specific for current game mode, or for the game mode which is going to be played when it i...
Definition game.c:36
Game CreateGame()
Definition game.c:1391
SCR_ResourceGrid GetResourceGrid()
Definition game.c:117
ScriptedChatEntity m_ChatEntity
Definition game.c:40
bool GetHasKeyboard()
Definition game.c:210
SCR_SettingsManager GetSettingsManager()
Definition game.c:190
IEntity SpawnEntityPrefabEx(ResourceName prefab, bool randomizeEditableVariant, BaseWorld world=null, EntitySpawnParams params=null)
Definition game.c:90
ref ScriptInvoker m_OnWorldSimulatePhysicsInvoker
Definition game.c:66
void UnregisterBuildingDestructionManager(notnull SCR_BuildingDestructionManagerComponent manager)
Definition game.c:152
override void OnCinematicStart()
Definition game.c:276
void ~ArmaReforgerScripted()
Definition game.c:78
void RegisterLoadoutManager(SCR_LoadoutManager instance)
Definition game.c:1093
ref SCR_Stack< SCR_GameErrorMessage > m_aErrorStack
Stack of queued error messages. All messages are popped one by one as user closes them and only in th...
Definition game.c:61
ScriptInvokerVoid GetOnHUDManagerChanged()
Definition game.c:103
SCR_LoadoutManager GetLoadoutManager()
Definition game.c:183
bool GetGameStarted()
Definition game.c:477
ScriptInvoker OnUserSettingsChangedInvoker()
Definition game.c:224
override void OnUserSignedOut()
Definition game.c:1382
ref ScriptInvoker m_OnInputDeviceUserChangedInvoker
Definition game.c:64
ref ScriptInvoker m_OnInputDeviceIsGamepadInvoker
Definition game.c:65
bool IsPlatformGameConsole()
Definition game.c:1357
ArmaReforgerScripted GetGame()
Definition game.c:1398
void SetHUDManager(SCR_HUDManagerComponent hud)
Definition game.c:1079
ScriptInvoker OnWindowResizeInvoker()
Definition game.c:252
ArmaReforgerScripted g_ARGame
Definition game.c:1388
bool AreGameFlagsObtained()
Definition game.c:508
SCR_DataCollectorComponent GetDataCollector()
Definition game.c:110
ref ScriptInvoker m_OnMissionSetInvoker
Definition game.c:54
ref ScriptInvoker Event_OnObtainedGameFlags
Definition game.c:38
bool m_bAreGameFlagsObtained
Definition game.c:37
override void OnGameInstallComplete()
Definition game.c:288
SCR_HUDManagerComponent GetHUDManager()
Definition game.c:1151
ref SCR_ResourceGrid m_ResourceGrid
Definition game.c:73
bool GetFullKickReason(KickCauseCode kickCode, out KickCauseGroup2 groupInt, out int reasonInt, out string group, out string reason)
Definition game.c:354
SCR_ResourceSystemSubscriptionManager GetResourceSystemSubscriptionManager()
Definition game.c:127
ref ScriptInvoker< int, int, bool > m_OnWindowResizeInvoker
Definition game.c:67
override void OnCinematicEnd()
Definition game.c:282
void RegisterBuildingDestructionManager(notnull SCR_BuildingDestructionManagerComponent manager)
Definition game.c:162
ref SCR_ProfaneFilter m_ProfanityFilter
Definition game.c:43
void AddActionListeners()
Definition game.c:804
bool AreGameFlagsSet(EGameFlags checkGameFlags)
Definition game.c:517
ScriptInvoker GetOnObtainedGameFlagsInvoker()
Definition game.c:524
EGameFlags GetGameFlags()
Definition game.c:484
SCR_DataCollectorComponent m_DataCollectorComponent
Object responsible for tracking and connecting to the database for Career Profile.
Definition game.c:52
void InsertNewScenario(ResourceName scenario, inout array< ResourceName > resources)
Definition game.c:1281
ScriptInvoker OnWorldSimulatePhysicsInvoker()
Definition game.c:245
void SetGameFlags(EGameFlags newGameFlags, bool shouldInvoke)
Definition game.c:492
SCR_HUDManagerComponent m_HUDManager
Definition game.c:39
bool m_bIsMainMenuOpen
Definition game.c:57
ref RplSessionErrorHandler m_SessionErrorHandler
Definition game.c:55
void AddRejoinAttempt()
Definition game.c:407
SCR_LoadoutManager m_pLoadoutManager
Object responsible for managing and providing game modes with list of available loadouts.
Definition game.c:49
void ShowNextErrorDialog()
Definition game.c:449
ScriptInvoker OnInputDeviceIsGamepadInvoker()
Definition game.c:238
void RegisterDataCollector(SCR_DataCollectorComponent instance)
Definition game.c:138
override void OnCinematicBlending(float blendFactor, vector cameraPosition)
Definition game.c:294
ref SCR_GameCoresManager m_CoresManager
Definition game.c:41
SCR_BuildingDestructionManagerComponent m_BuildingDestructionManager
Definition game.c:44
ScriptInvoker OnInputDeviceUserChangedInvoker()
Definition game.c:231
void UnregisterLoadoutManager(SCR_LoadoutManager instance)
Definition game.c:1120
EGameFlags
GameMode Game Flags represented by bit mask.
Definition game.c:17
@ Metabolism
Definition game.c:18
@ SpawnVehicles
Definition game.c:19
@ SpawnAI
Definition game.c:20
@ Last
Definition game.c:21
ref SCR_SettingsManager m_SettingsManager
Definition game.c:42
ref SCR_ResourceSystemSubscriptionManager m_ResourceSystemSubscriptionManager
Definition game.c:74
SCR_BuildingDestructionManagerComponent GetBuildingDestructionManager()
Definition game.c:175
SCR_ProfaneFilter GetProfanityFilter()
Definition game.c:200
void InvokeGameFlags()
Definition game.c:530
bool m_bHasKeyboard
Definition game.c:46
SCR_SpawnerAIGroupManagerComponent m_SpawnerAIGroupManager
Definition game.c:45
enum EGameFlags CONFIG_CORES_PATH
Enum of DiagMenu id values, generated by Game.
ref ScriptInvoker m_OnChangeUserSettingsInvoker
Definition game.c:63
ref ScriptInvoker< bool > m_OnGameInstallComplete
Definition game.c:69
EDiagMenuGameLib
Enum of DiagMenu id values, generated by GameLib.
Definition constants.c:5
KickCauseGroup
ref array< string > angles
RplKickCauseGroup
RplMode
Mode of replication.
Definition RplMode.c:9
ref ScriptCallQueue m_Callqueue
ScriptCallQueue GetCallqueue()
Returns CallQueue of this AI. It gets updated from EvaluateBehavior, so that it's synchronous with ot...
void SCR_AdditionalGameModeSettingsComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
SCR_BaseGameMode GetGameMode()
void OpenGroupMenu()
vector position
void SCR_FactionManager(IEntitySource src, IEntity parent)
void RemoveActionListeners()
void SCR_GroupsManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
void SCR_LoadoutManager(IEntitySource src, IEntity parent)
override void OnUpdate()
override void OnMenuOpen()
ScriptInvokerBase< ScriptInvokerVoidMethod > ScriptInvokerVoid
ESettingManagerModuleType
enum EVehicleType IEntity
ref Managed GetPlayerDataStats(int playerID)
Called when the player data is requested.
void OnKickedFromGame(KickCauseCode kickCode)
Called after player was kicked from game back to main menu, providing reason for the kick.
void OnBeforeWorldCleanup()
Called when the current world is about to be unloaded. Can be used to disable any event listeners tha...
string GetMissionName()
Called when DS downloads required addons and is ready to run a world FIXME: I'm not named properly!
ref Managed GetSessionDataStats()
Called when the session data is requested.
void ShowErrorMessage(string msg)
Shows dialog with a provided string.
void OnMissionSet(MissionHeader mission)
Called when a mission header is set (to both a valid one or to null as well).
Definition DbgUI.c:66
Diagnostic and developer menu system.
Definition DiagMenu.c:18
void SetMessage(string text)
Definition DialogUI.c:159
void SetTitle(string text)
Definition DialogUI.c:143
Definition Game.c:8
event void OnWorldPostProcess(World world)
Event called once loading of all entities of the world have been finished. (still within the loading)...
event void HostGameConfig()
Called after reload to host a modded scenario.
proto external GenericWorldEntity GetWorldEntity()
Returns path of world file loaded.
event void OnGamepadConnectionStatus(bool isConnected)
Event which is called on Gamepad Connection/Disconnection.
proto external IEntity SpawnEntityPrefab(notnull Resource templateResource, BaseWorld world=null, EntitySpawnParams params=null)
event Managed ReadGameConfig(string sResource)
event void OnWindowResize(int w, int h, bool windowed)
Event which is called when window size of fullscreen state changed.
sealed MenuManager GetMenuManager()
Definition Game.c:15
event void OnInputDeviceIsGamepadEvent(bool isGamepad)
Event which is called when input device binded to user changes between gamepad and keyboard/mouse,...
event GetMenuPreset()
Definition Game.c:133
event bool OnGameStart()
Event which is called right before game starts (all entities are created and initialized)....
Definition Game.c:158
event ref array< ResourceName > GetDefaultGameConfigs()
sealed InputManager GetInputManager()
Definition Game.c:14
event void OnGameEnd()
Event which is called right before game end.
event void OnInputDeviceUserChangedEvent(EInputDeviceType oldDevice, EInputDeviceType newDevice)
Event which is called when input device binded to user changed.
sealed WorkspaceWidget GetWorkspace()
Definition Game.c:16
event void OnUserSettingsChangedEvent()
Event which is called when user change settings.
event void OnWorldSimulatePhysics(float timeSlice)
Event which is called before each fixed step of the physics simulation.
event void PlayGameConfig(ResourceName sResource, string addonsList)
proto external bool InPlayMode()
event LoadingAnim CreateLoadingAnim(WorkspaceWidget workspaceWidget)
event void OnAfterInit(BaseWorld world)
Called after full initialization of Game instance.
GameSessionStorage is used to store data for whole lifetime of game executable run....
proto external vector GetOrigin()
proto external Physics GetPhysics()
proto external void GetWorldBounds(out vector mins, out vector maxs)
proto external EntityPrefabData GetPrefabData()
proto external string GetName()
Input management system for user interactions.
proto external bool IsAnyMenuOpen()
proto external MenuBase FindMenuByPreset(ScriptMenuPresetEnum preset)
Finds first menu/dialog with given preset index, or nullptr when there is no such menu opened.
proto external MenuBase OpenDialog(ScriptMenuPresetEnum preset, int priority=DialogPriority.INFORMATIVE, int iUserData=0, bool unique=false)
proto external bool IsAnyDialogOpen()
proto external MenuBase OpenMenu(ScriptMenuPresetEnum preset, int userId=0, bool unique=false, bool hideParentMenu=true)
Object holding reference to resource. In destructor release the resource.
Definition Resource.c:25
override event void OnWorldPostProcess(World world)
static ResourceName GetRandomVariant(ResourceName prefab)
static SCR_GameCoresManager CreateCoresManager()
Wrapper for error messages.
Dialog displayed when the gamepad is removed.
static void CloseGamepadRemovalDialog()
static SCR_GamepadRemovalUI OpenGamepadRemovalDialog()
static void CreateKickErrorDialog(string msg, string group, string details="")
Set message for error dialog and create it.
static IEntity GetLocalControlledEntity()
Handles filtering profanities in texts.
SCR_SettingsManagerModuleBase GetModule(ESettingManagerModuleType moduleType)
ScriptCallQueue Class provide "lazy" calls - when we don't want to execute function immediately but l...
Definition tools.c:53
Instance of created debug visualizer.
Definition Shape.c:14
Definition World.c:16
void EntitySpawnParams()
Definition gameLib.c:130
proto external bool Prepare(ResourceName animation, float startTime, float speed, bool loop)
Prepare this component for playing, provide an animation, start time, playing speed and loop flag.
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
ShapeType
Definition ShapeType.c:13
DebugTextFlags
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
ShapeFlags
Definition ShapeFlags.c:13
@ SCRIPT
Set by script.
KickCauseGroup2
Extends KickCauseGroup by adding game-specific groups.
PlatformKickReason
EActionTrigger
ESaveGameType
RplError
Definition RplError.c:13
EPlatform
Definition EPlatform.c:13
proto int ARGB(int a, int r, int g, int b)
ScriptInvokerBase< func > ScriptInvoker
Definition tools.c:134