Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_PauseGameTimeEditorComponent.c
Go to the documentation of this file.
1 [ComponentEditorProps(category: "GameScripted/Editor", description: "Game simulation manager. Works only with SCR_EditorManagerEntity!", icon: "WBData/ComponentEditorProps/componentEditor.png")]
3 {
4 };
5 
9 {
10  [Attribute("1", desc: "When enabled, the editor will be paused when opened.")]
11  protected bool m_bPauseOnOpen;
12 
13  protected ChimeraWorld m_World;
14 
18  void TogglePause()
19  {
20  SetPause(!m_World.IsGameTimePaused());
21  }
26  void SetPause(bool pause)
27  {
28  //--- Unpausing game, create a rewind point
29  if (!pause)
30  {
31  SCR_RewindComponent rewindManager = SCR_RewindComponent.GetInstance();
32  if (rewindManager && !rewindManager.HasRewindPoint())
33  rewindManager.CreateRewindPoint();
34  }
35 
36  m_World.PauseGameTime(pause);
37  }
41  bool IsPaused()
42  {
43  return m_World.IsGameTimePaused();
44  }
45 
50  void SetPauseOnOpen(bool pause)
51  {
52  m_bPauseOnOpen = pause;
53  }
57  bool IsPauseOnOpen()
58  {
59  return m_bPauseOnOpen;
60  }
61 
62  protected void OnSaved(ESaveType type, string fileName)
63  {
64  if (type == ESaveType.USER)
65  SetPause(true);
66  }
67 
68  override protected void EOnEditorOpen()
69  {
70  GetGame().GetSaveManager().GetOnSaved().Insert(OnSaved);
71 
72  if (m_bPauseOnOpen)
73  {
74  //--- Pause game time when the editor is opened without a rewind point (only after a delay, to give player camera chance to iniliazed after rewinding)
75  SCR_RewindComponent rewindManager = SCR_RewindComponent.GetInstance();
76  if (rewindManager && !rewindManager.HasRewindPoint())
77  GetGame().GetCallqueue().CallLater(SetPause, 1, false, true);
78  }
79  }
80  override protected void EOnEditorClose()
81  {
82  GetGame().GetSaveManager().GetOnSaved().Remove(OnSaved);
83 
84  //--- Always unpause the game when leaving the editor
85  SetPause(false);
86  }
87  override protected void EOnEditorInit()
88  {
89  m_World = GetGame().GetWorld();
90 
91  //--- Don't pause on open when disabled by CLI param in the dev version
92  if (GetGame().IsDev() && System.IsCLIParam("editorDoNotPauseOnOpen"))
93  m_bPauseOnOpen = false;
94  }
95 }
ComponentEditorProps
SCR_FragmentEntityClass ComponentEditorProps
ChimeraWorld
Definition: ChimeraWorld.c:12
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
SCR_BaseEditorComponent
Definition: SCR_BaseEditorComponent.c:119
ESaveType
ESaveType
Definition: ESaveType.c:1
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_PauseGameTimeEditorComponentClass
Definition: SCR_PauseGameTimeEditorComponent.c:2
SCR_PauseGameTimeEditorComponent
Definition: SCR_PauseGameTimeEditorComponent.c:8
m_World
protected BaseWorld m_World
Definition: SCR_PreviewEntityEditorUIComponent.c:46
SCR_BaseEditorComponentClass
Definition: SCR_BaseEditorComponent.c:2
type
EDamageType type
Definition: SCR_DestructibleTreeV2.c:32
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180