DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
missionBase.c
Go to the documentation of this file.
2{
3 PluginDeveloper m_ModuleDeveloper;
4 PluginKeyBinding m_ModuleKeyBinding
5 PluginAdditionalInfo m_ModuleServerInfo;
6
10
11 ref array<PlayerBase> m_DummyPlayers = new array<PlayerBase>;
12
13 autoptr ObjectSnapCallback m_InventoryDropCallback;
14
16 {
17 SetDispatcher(new DispatcherCaller);
18
20
21 m_WidgetEventHandler = new WidgetEventHandler;
22
23 m_InventoryDropCallback = new EntityPlacementCallback;
24
25 //Debug.DestroyAllShapes();
26
27 //TODO clea up after Gamescom
28 m_ModuleServerInfo = PluginAdditionalInfo.Cast( GetPlugin(PluginAdditionalInfo) );
29 //
31
32 if (GetGame().IsServer())
33 {
34 InitialiseWorldData();
35 }
36 else
37 {
38 GetDayZGame().GetAnalyticsClient().RegisterEvents();
39 m_WorldLighting = new WorldLighting;
40 }
41
42 GetOnInputDeviceConnected().Insert(UpdateInputDevicesAvailability);
43 GetOnInputDeviceDisconnected().Insert(UpdateInputDevicesAvailability);
44
45 // There is a possibility different maps/servers may be using different effects
47 }
48
50 {
52
53 if ( GetGame().IsClient() )
54 {
55 GetDayZGame().GetAnalyticsClient().UnregisterEvents();
56 }
58 }
59
60 override ObjectSnapCallback GetInventoryDropCallback()
61 {
62 return m_InventoryDropCallback;
63 }
64
66 {
67 string worldName = "empty";
68 GetGame().GetWorldName(worldName);
69 worldName.ToLower();
70
71 switch ( worldName )
72 {
73 case "chernarusplus":
74 m_WorldData = new ChernarusPlusData;
75 break;
76
77 case "enoch":
78 m_WorldData = new EnochData;
79 break;
80
81 default:
82 m_WorldData = new ChernarusPlusData;
83 break;
84 }
85 }
86
88 {
89 return m_WorldLighting;
90 }
91
93 {
94 return m_WorldData;
95 }
96
98 {
99 UIScriptedMenu menu = NULL;
100
101 switch (id)
102 {
103 case MENU_MAIN:
104#ifdef PLATFORM_CONSOLE
105 menu = new MainMenuConsole;
106#else
107 menu = new MainMenu;
108#endif
109 break;
110 case MENU_INGAME:
111#ifdef PLATFORM_CONSOLE
112 menu = new InGameMenuXbox;
113#else
114 menu = new InGameMenu;
115#endif
116 break;
117 case MENU_CHARACTER:
118 menu = new CharacterCreationMenu;
119 break;
120 case MENU_OPTIONS:
121 menu = new OptionsMenu;
122 break;
123 case MENU_STARTUP:
124 menu = new StartupMenu;
125 break;
126 case MENU_LOADING:
127 menu = new LoadingMenu;
128 break;
129 case MENU_INVENTORY:
130 menu = new InventoryMenu;
131 break;
132 case MENU_INSPECT:
133 menu = new InspectMenuNew;
134 break;
135 case MENU_EARLYACCESS:
136 menu = new EarlyAccessMenu;
137 break;
139 menu = new ScriptConsole;
140 break;
142 menu = new ScriptConsoleNewPresetDialog;
143 break;
145 menu = new ScriptConsoleRenamePresetDialog;
146 break;
147 case MENU_CHAT_INPUT:
148 menu = new ChatInputMenu;
149 break;
151 menu = new PresetsMenu;
152 break;
153 case MENU_NOTE:
154 menu = new NoteMenu;
155 break;
156 case MENU_MAP:
157 menu = new MapMenu;
158 break;
159 case MENU_BOOK:
160 menu = new BookMenu;
161 break;
163 menu = new SceneEditorMenu;
164 break;
165 case MENU_HELP_SCREEN:
166 menu = new HelpScreen;
167 break;
168 case MENU_GESTURES:
169 menu = new GesturesMenu;
170 break;
171 case MENU_LOGOUT:
172 menu = new LogoutMenu;
173 break;
175 menu = new TitleScreenMenu;
176 break;
178 menu = new ControlsXboxNew;
179 break;
181 menu = new RadialQuickbarMenu;
182 break;
184 menu = new ServerBrowserMenuNew;
185 break;
186 case MENU_LOGIN_QUEUE:
187 menu = new LoginQueueBase;
188 break;
189 case MENU_LOGIN_TIME:
190 menu = new LoginTimeBase;
191 break;
193 menu = new CameraToolsMenu;
194 break;
195 case MENU_VIDEO:
196 menu = new MainMenuVideo;
197 break;
198 case MENU_KEYBINDINGS:
199 menu = new KeybindingsMenu;
200 break;
201 case MENU_TUTORIAL:
202 menu = new TutorialsMenu;
203 break;
204 case MENU_CREDITS:
205 menu = new CreditsMenu;
206 break;
208 menu = new InviteMenu;
209 break;
211 menu = new ItemDropWarningMenu;
212 break;
214 menu = new InputDeviceDisconnectWarningMenu;
215 break;
217 menu = new PlayerRepositionWarningMenu;
218 break;
220 menu = new RespawnDialogue;
221 break;
224 break;
225 case MENU_LOC_ADD:
226 menu = new ScriptConsoleAddLocation;
227 break;
228 }
229
230 if (menu)
231 {
232 menu.SetID(id);
233 }
234
235 return menu;
236 }
237
239 {
240 UIScriptedWindow window = NULL;
241
242 switch (id)
243 {
245 window = new MissionLoader( GUI_WINDOW_MISSION_LOADER );
246 break;
247 }
248
249 return window;
250 }
251
253
255
256 override void OnKeyPress(int key)
257 {
258 super.OnKeyPress(key);
259
260#ifdef DIAG_DEVELOPER
261 if ( PluginKeyBinding.instance )
262 {
263 PluginKeyBinding.instance.OnKeyPress(key);
264 }
265#endif
266 }
267
270
272 {
273 UIScriptedMenu current_menu = GetGame().GetUIManager().GetMenu();
274
275 if ( current_menu )
276 {
277 Widget widget_root = current_menu.GetLayoutRoot();
278
279 if ( widget_root )
280 {
281 m_WidgetsTotal = 0;
282 m_WidgetsInvisible = 0;
283
284 Print( widget_root.GetName() +" ("+ widget_root.GetTypeName() +")");
285
286 DumpWidget(widget_root.GetChildren(), 1);
287
288 Print( "Widgets TOTAL: "+ m_WidgetsTotal.ToString() +" INVISIBLE: "+ m_WidgetsInvisible.ToString() +" VISIBLE: "+ (m_WidgetsTotal - m_WidgetsInvisible).ToString() );
289 }
290 }
291 }
292
293 void DumpWidget(Widget w, int tabs)
294 {
295 if ( !w )
296 {
297 return;
298 }
299
300 m_WidgetsTotal++;
301
302 string tmp;
303 for (int i = 0; i < tabs; i++)
304 {
305 tmp += " ";
306 }
307
308 string invisible = "";
309
310 if ( !w.IsVisibleHierarchy() )
311 {
312 invisible = "[invisible]";
313 m_WidgetsInvisible++;
314 }
315
316 Print( tmp +"- "+ w.GetName() +" ("+ w.GetTypeName() +") "+ invisible );
317
318 bool collapse = false;
319 if ( w.GetChildren() )
320 {
321 collapse = true;
322 Print(tmp +"{");
323 }
324
325 DumpWidget(w.GetChildren(), tabs + 1);
326
327 if ( collapse )
328 {
329 Print(tmp +"}");
330 }
331
332 DumpWidget(w.GetSibling(), tabs);
333 }
334
335 override void OnKeyRelease(int key)
336 {
337 super.OnKeyRelease(key);
338
339 if ( GetGame().IsDebug() )
340 {
341 if ( PluginKeyBinding.instance != NULL )
342 {
343 PluginKeyBinding.instance.OnKeyRelease(key);
344 }
345 }
346 }
347
348 override void OnMouseButtonPress(int button)
349 {
350 super.OnMouseButtonPress(button);
351
352 if ( GetGame().IsDebug() )
353 {
354 if ( PluginKeyBinding.instance != NULL )
355 {
356 PluginKeyBinding.instance.OnMouseButtonPress(button);
357 }
358 }
359 }
360
361 override void OnMouseButtonRelease(int button)
362 {
363 super.OnMouseButtonRelease(button);
364
365 if ( GetGame().IsDebug() )
366 {
367 if ( PluginKeyBinding.instance != NULL )
368 {
369 PluginKeyBinding.instance.OnMouseButtonRelease(button);
370 }
371 }
372 }
373
374 void OnLog(string msg_log)
375 {
376 if ( PluginDeveloper.GetInstance() )
377 {
378 if ( GetGame().IsServer() && !GetGame().IsMultiplayer() )
379 {
380 PluginDeveloper.GetInstance().PrintLogClient(msg_log);
381 }
382 else if ( GetGame().IsMultiplayer() && GetGame().IsClient() )
383 {
384 PluginDeveloper.GetInstance().PrintLogClient(msg_log);
385 }
386 }
387 }
388
390 {
391 for(int i = 0; i < m_DummyPlayers.Count(); i++)
392 {
393 if (m_DummyPlayers.Get(i))
394 {
395 m_DummyPlayers.Get(i).OnTick();
396 }
397 }
398 }
399
400 override void AddDummyPlayerToScheduler(Man player)
401 {
402 m_DummyPlayers.Insert(PlayerBase.Cast( player ));
403 }
404
405#ifdef DIAG_DEVELOPER
406 void UpdateInputDeviceDiag()
407 {
408 DisplayInputDebug(DiagMenu.GetBool(DiagMenuIDs.MISC_INPUT_DEVICE_DISCONNECT_DBG));
409 }
410
411 void DisplayInputDebug(bool show)
412 {
414 DbgUI.Begin("InputDeviceDebug", 60, 60);
415
416 if (show)
417 {
418 DbgUI.Text("Gamepad: " + g_Game.GetInput().IsActiveGamepadSelected());
419 DbgUI.Text("Mouse: " + g_Game.GetInput().IsMouseConnected());
420 DbgUI.Text("Keyboard: " + g_Game.GetInput().IsKeyboardConnected());
421 }
422
423 DbgUI.End();
425 }
426#endif
427}
428
429class MissionDummy extends MissionBase
430{
431}
DayZGame g_Game
Definition DayZGame.c:3654
DayZGame GetDayZGame()
Definition DayZGame.c:3656
void SetDispatcher(Dispatcher dispatcher)
Definition Dispatcher.c:31
DiagMenuIDs
Definition EDiagMenuIDs.c:2
void InventoryMenu()
PluginBase GetPlugin(typename plugin_type)
void PluginManagerInit()
void PluginManagerDelete()
proto void GetWorldName(out string world_name)
proto native UIManager GetUIManager()
Definition DbgUI.c:60
LoginQueue position when using -connect since mission is not created yet.
Definition DayZGame.c:190
LoginTime when using -connect since mission is not created yet.
Definition DayZGame.c:321
override void UpdateInputDevicesAvailability()
override bool IsServer()
ref WorldLighting m_WorldLighting
Definition missionBase.c:9
void DumpWidget(Widget w, int tabs)
override void OnKeyRelease(int key)
override ObjectSnapCallback GetInventoryDropCallback()
Definition missionBase.c:60
override void AddDummyPlayerToScheduler(Man player)
override void OnKeyPress(int key)
override UIScriptedWindow CreateScriptedWindow(int id)
override WorldLighting GetWorldLighting()
Definition missionBase.c:87
override void OnMouseButtonRelease(int button)
PluginDeveloper m_ModuleDeveloper
Definition missionBase.c:3
override void OnMouseButtonPress(int button)
ref WorldData m_WorldData
Definition missionBase.c:8
void InitialiseWorldData()
Definition missionBase.c:65
void UpdateInputDevicesAvailability()
autoptr ObjectSnapCallback m_InventoryDropCallback
Definition missionBase.c:13
void OnLog(string msg_log)
void DumpCurrentUILayout()
override WorldData GetWorldData()
Definition missionBase.c:92
override UIScriptedMenu CreateScriptedMenu(int id)
Definition missionBase.c:97
void UpdateDummyScheduler()
PluginKeyBinding m_ModuleKeyBinding PluginAdditionalInfo m_ModuleServerInfo
Definition missionBase.c:5
ref WidgetEventHandler m_WidgetEventHandler
Definition missionBase.c:7
Manager class for managing Effect (EffectParticle, EffectSound)
static void Cleanup()
Cleanup method to properly clean up the static data.
static void Init()
Definition SoundSetMap.c:6
proto native UIScriptedMenu GetMenu()
Returns most-top open menu.
Keeps information about currently loaded world, like temperature.
Definition WorldData.c:3
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.
static proto native void Begin(string windowTitle, float x=0, float y=0)
static proto void BeginCleanupScope()
static proto native void Text(string label)
static proto native void EndCleanupScope()
static proto native void End()
static proto bool GetBool(int id, bool reverse=false)
Get value as bool from the given script id.
const int MENU_CONNECT_ERROR
Definition constants.c:189
const int MENU_TUTORIAL
Definition constants.c:182
const int MENU_HELP_SCREEN
Definition constants.c:171
const int MENU_TITLE_SCREEN
Definition constants.c:174
const int MENU_KEYBINDINGS
Definition constants.c:181
const int MENU_XBOX_CONTROLS
Definition constants.c:175
const int MENU_SCRIPTCONSOLE
Definition constants.c:163
const int MENU_WARNING_TELEPORT
Definition constants.c:188
const int MENU_LOGOUT
Definition constants.c:173
const int MENU_INSPECT
Definition constants.c:157
const int MENU_LOGIN_TIME
Definition constants.c:185
const int MENU_MAP
Definition constants.c:169
const int MENU_MAIN
Definition constants.c:160
const int MENU_SERVER_BROWSER
Definition constants.c:178
const int MENU_WARNING_ITEMDROP
Definition constants.c:186
const int MENU_STARTUP
Definition constants.c:162
const int MENU_RESPAWN_DIALOGUE
Definition constants.c:187
const int MENU_OPTIONS
Definition constants.c:161
const int MENU_CREDITS
Definition constants.c:183
const int MENU_CAMERA_TOOLS
Definition constants.c:179
const int MENU_CHARACTER
Definition constants.c:152
const int GUI_WINDOW_MISSION_LOADER
Definition constants.c:193
const int MENU_INVITE_TIMER
Definition constants.c:184
const int MENU_GESTURES
Definition constants.c:172
const int MENU_LOGIN_QUEUE
Definition constants.c:177
const int MENU_SCENE_EDITOR
Definition constants.c:155
const int MENU_SCRIPTCONSOLE_DIALOG_PRESET_NAME
Definition constants.c:165
const int MENU_WARNING_INPUTDEVICE_DISCONNECT
Definition constants.c:190
const int MENU_CONTROLS_PRESET
Definition constants.c:167
const int MENU_EARLYACCESS
Definition constants.c:154
const int MENU_SCRIPTCONSOLE_DIALOG_PRESET_RENAME
Definition constants.c:166
const int MENU_INVENTORY
Definition constants.c:158
const int MENU_NOTE
Definition constants.c:168
const int MENU_LOADING
Definition constants.c:159
const int MENU_RADIAL_QUICKBAR
Definition constants.c:176
const int MENU_BOOK
Definition constants.c:170
const int MENU_LOC_ADD
Definition constants.c:150
const int MENU_INGAME
Definition constants.c:156
const int MENU_CHAT_INPUT
Definition constants.c:164
const int MENU_VIDEO
Definition constants.c:180
proto int ToLower()
Changes string to lowercase. Returns length.