Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
WorldRunTool.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
3{
4 PC = 0,
5 XB1 = 1,
6 PS4 = 2
7}
8
9
10[WorkbenchPluginAttribute("Run game with current world", "Runs currently opened world with specified parameters and game profile", "", "", {"WorldEditor"},"",0xf144)]
11class WorldRunPlugin: WorkbenchPlugin
13 [Attribute("game.exe", UIWidgets.EditBox)]
14 string Executable;
15 [Attribute("0", UIWidgets.ComboBox, "Configuration", "", enumType: WorldRunConfiguration)]
16 int Configuration;
17
18 [Attribute("-1", UIWidgets.EditBox, "Horizontal coordinate on the screen if running in window mode. Default if -1.")]
19 int X;
20
21 [Attribute("-1", UIWidgets.EditBox, "Vertical coordinate on the screen if running in window mode. Default if -1.")]
22 int Y;
23
24 [Attribute("-1", UIWidgets.EditBox, "Width of the app window if running in window mode. Default if -1.")]
25 int Width;
26
27 [Attribute("-1", UIWidgets.EditBox, "Height of the app window if running in window mode. Default if -1.")]
28 int Height;
29
30 [Attribute("true", UIWidgets.CheckBox, "If true the app will run in window mode.")]
31 bool Windowed;
32
33 [Attribute("true", UIWidgets.CheckBox, "If true the app will run at full speed even when its window doesn't have focus.")]
34 bool ForceUpdate;
35
36 [Attribute("true", UIWidgets.CheckBox, "If true the app won't steal focus from the current active window.")]
37 bool NoFocus;
38
39 [Attribute("true", UIWidgets.CheckBox, "If true, no network-related timeout will result in disconnect. Necessary for debugging. Don't use for anything else.")]
41
42 [Attribute("-1", UIWidgets.EditBox, "Maximum allowed FPS. No limit if -1.")]
43 int MaxFps;
44
45 [Attribute("WorldRunPlugin", UIWidgets.EditBox, "Profile name used for the app.")]
46 string Profile;
47
48 [Attribute("", UIWidgets.EditBox)]
49 string Params;
50
51 override void Run()
52 {
53 string command = Executable + " ";
54
55 if (Configuration == WorldRunConfiguration.XB1)
56 command += "-configuration xbox ";
57 else if (Configuration == WorldRunConfiguration.PS4)
58 command += "-configuration ps4 ";
59
60 WorldEditor mod = Workbench.GetModule(WorldEditor);
61 if (!mod)
62 {
63 Print("World editor module is not available.", LogLevel.ERROR);
64 return;
65 }
66
67 WorldEditorAPI api = mod.GetApi();
68
69 string gproj = Workbench.GetCurrentGameProjectFile();
70
71 if (gproj && command.IndexOf("-gproj") == -1)
72 command += "-gproj " + gproj + " ";
73
74 string world;
75 api.GetWorldPath(world); // It would be better to have API to get relative path to the world
76 if (world)
77 {
78 int worldIndex = world.LastIndexOf("worlds/");
79 if (worldIndex != -1)
80 {
81 world = world.Substring(worldIndex, world.Length() - worldIndex);
82 command += "-world " + world + " ";
83 }
84 }
85 else
86 {
87 Print("World needs to be opened in the World Editor.", LogLevel.ERROR);
88 return;
89 }
90
91 if(Windowed)
92 {
93 command += "-window ";
94 }
95
96 if(X != -1)
97 {
98 command += "-posX " + X + " ";
99 }
100
101 if(Y != -1)
102 {
103 command += "-posY " + Y + " ";
104 }
105
106 if(Width != -1)
107 {
108 command += "-screenWidth " + Width + " ";
109 }
110
111 if(Height != -1)
112 {
113 command += "-screenHeight " + Height + " ";
114 }
115
116 if(MaxFps > 0)
117 {
118 command += "-maxFPS " + MaxFps + " ";
119 }
120
121 if(ForceUpdate)
122 {
123 command += "-forceupdate ";
124 }
125
126 if(NoFocus)
127 {
128 command += "-nofocus ";
129 }
130
132 {
133 command += "-rpl-timeout-disable ";
134 }
135
136 if (Profile)
137 {
138 command += "-profile " + Profile + " ";
139 }
140
141 if (Params)
142 {
143 command += Params + " ";
144 }
145
146
147 Print("Running command: " + command);
148 Workbench.RunCmd(command);
149 }
150
151 override void Configure()
152 {
153 Workbench.ScriptDialog("Configure World run tool", "You can configure execution name, profile and parameters", this);
154 }
155
156 [ButtonAttribute("OK")]
157 void OkButton() {}
158}
159
bool Windowed
Definition PeerConfig.c:75
string Params
Definition PeerConfig.c:97
bool RplDisableTimeout
Definition PeerConfig.c:91
int Height
Definition PeerConfig.c:72
bool ForceUpdate
Definition PeerConfig.c:78
int Width
Definition PeerConfig.c:69
bool NoFocus
Definition PeerConfig.c:81
string Profile
Definition PeerConfig.c:94
override void Run()
class SCR_BackendServiceDisplay PC
override void Configure()
class WorkbenchDialog_AbortRetryIgnore ButtonAttribute("OK", true)
enum WorldRunConfiguration WorkbenchPluginAttribute("Run game with current world", "Runs currently opened world with specified parameters and game profile", "", "", {"WorldEditor"}, "", 0xf144)
XB1
WorldRunConfiguration
Definition WorldRunTool.c:3
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute
@ Y
Definition MouseState.c:18
@ X
Definition MouseState.c:17
@ PS4
Definition EPlatform.c:21