Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_EditorPlugin.c
Go to the documentation of this file.
1#ifdef WORKBENCH
2[WorkbenchPluginAttribute(name: "Game Master Settings", icon: "WBData/EntityEditorProps/entityEditor.png", wbModules: { "WorldEditor" })]
3class EditorPlugin : WorldEditorPlugin // TODO: SCR_
4{
5 [Attribute(desc: "When enabled, Game Master camera will start on the position of World Editor camera.", category: "Game Master")]
6 protected bool m_bStartOnWorldEditorCamera;
7
8 [Attribute(desc: "When enabled, Game Master interface will start unpaused.", category: "Game Master")]
9 protected bool m_bStartUnpaused;
10
11 //------------------------------------------------------------------------------------------------
12 protected void Unpause()
13 {
14 SCR_EditorManagerEntity.GetInstance().GetOnOpened().Remove(Unpause);
15 ChimeraWorld world = GetGame().GetWorld();
16 world.PauseGameTime(false);
17 }
18
19 //------------------------------------------------------------------------------------------------
20 protected override void OnGameModeStarted(string worldName, string gameMode, bool playFromCameraPos, vector cameraPosition, vector cameraAngles)
21 {
22 //--- Player is spawned at camera position; initialize, but don't open the editor
23 //--- Disabled, was showing error and editor was initialized either way
24 if (playFromCameraPos)
25 {
27 if (core)
28 core.OnPlayFromCameraPos();
29 }
30
31 if (m_bStartOnWorldEditorCamera)
32 {
34 if (cameraComponent)
35 {
36 //--- Set initial camera position and rotation
37 vector transform[4];
38 Math3D.AnglesToMatrix(Vector(cameraAngles[1], cameraAngles[0], cameraAngles[2]), transform);
39 transform[3] = cameraPosition;
40
41 cameraComponent.SetInitTransform(transform);
42 }
43 }
44
45 if (m_bStartUnpaused)
46 {
47 SCR_PauseGameTimeEditorComponent pauseComponent = SCR_PauseGameTimeEditorComponent.Cast(SCR_PauseGameTimeEditorComponent.GetInstance(SCR_PauseGameTimeEditorComponent));
48 if (pauseComponent)
49 {
50 pauseComponent.SetPauseOnOpen(false);
51
52 SCR_EditorManagerEntity editorManager = pauseComponent.GetManager();
53 if (editorManager.IsOpened())
54 {
55 //--- Editor already opened, unpause the game
56 Unpause();
57 }
58 else if (editorManager.IsInTransition())
59 {
60 //--- Editor is being opened (e.g., when playing from character in editor world), unpause the game once it's opened
61 editorManager.GetOnOpened().Insert(Unpause);
62 }
63 }
64 }
65 }
66
67 //------------------------------------------------------------------------------------------------
68 //--- Play the editor directly
69 //--- Example: -plugin=SCR_EditorPlugin
70 override void RunCommandline()
71 {
72 Workbench.OpenModule(WorldEditor);
73 WorldEditor worldEditor = Workbench.GetModule(WorldEditor);
74 if (!worldEditor)
75 return;
76
77 worldEditor.SetOpenedResource("{25E6D4AEC3F45872}worlds/Editor/Test/TestGameMaster.ent");
78 worldEditor.SwitchToGameMode();
79 }
80
81 //------------------------------------------------------------------------------------------------
82 override void Configure()
83 {
84 Workbench.ScriptDialog("Game Master Settings", "Configuration of Game Master when running in World Editor.", this);
85 }
86
87 //------------------------------------------------------------------------------------------------//! \return
88 [ButtonAttribute("Close")]
89 protected bool ButtonClose()
90 {
91 return false;
92 }
93}
94#endif // WORKBENCH
override void RunCommandline()
Definition FlowmapTool.c:60
GenerateFlowMaps WorkbenchPlugin WorkbenchPluginAttribute("Regenerate river flow-maps", "Generate and save/overwrite river flow-maps", "", "", {"WorldEditor"}, "", 0xf773)
Definition FlowmapTool.c:59
ArmaReforgerScripted GetGame()
Definition game.c:1398
void SCR_EditorManagerEntity(IEntitySource src, IEntity parent)
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
override void Configure()
class WorkbenchDialog_AbortRetryIgnore ButtonAttribute("OK", true)
void SetInitTransform(vector transform[4])
Core component to manage SCR_EditorManagerEntity.
SCR_FieldOfViewSettings Attribute
proto native vector Vector(float x, float y, float z)