Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
scriptconsolegeneraltab.c
Go to the documentation of this file.
2 {
3  static int m_ObjectsScope = 2;
4 
5  protected static float DEBUG_MAP_ZOOM = 1;
6  protected static bool SHOW_OTHERS = 0;
7 
8  protected const string DEFAULT_POS_XYZ = "<1,2,3>";
9  protected vector m_MapPos;
10  protected bool m_PlayerPosRefreshBlocked;
11 
12  protected ref array<ref RemotePlayerStatDebug> m_PlayerDebugStats = new array<ref RemotePlayerStatDebug>;
13 
14  protected MissionGameplay m_MissionGameplay;
15  protected PluginDeveloper m_Developer;
16 
17  protected SliderWidget m_TimeSlider;
18  protected ref Timer m_LateInit = new Timer();
19 
20  protected bool m_UpdatePlayerPositions;
21 
22  //-------------------------------- WIDGETS ---------------------------------------
23  protected EditBoxWidget m_TeleportX;
24  protected EditBoxWidget m_TeleportY;
25  protected EditBoxWidget m_TeleportXYZ;
26  protected EditBoxWidget m_DateYear;
27  protected EditBoxWidget m_DateMonth;
28  protected EditBoxWidget m_DateDay;
29  protected EditBoxWidget m_DateHour;
30  protected EditBoxWidget m_DateMinute;
31 
32  protected ButtonWidget m_LocationAddButton;
33  protected ButtonWidget m_LocationRemoveButton;
34  protected ButtonWidget m_TeleportButton;
35  protected ButtonWidget m_ButtonCopyPos;
36  protected ButtonWidget m_DiagDrawButton;
37  protected ButtonWidget m_DiagToggleButton;
38 
39  protected CheckBoxWidget m_LogsEnabled;
40  protected CheckBoxWidget m_HudDCharStats;
41  protected CheckBoxWidget m_HudDCharLevels;
42  protected CheckBoxWidget m_HudDCharStomach;
43  protected CheckBoxWidget m_HudDCharModifiers;
44  protected CheckBoxWidget m_HudDCharAgents;
45  protected CheckBoxWidget m_HudDCharDebug;
46  protected CheckBoxWidget m_HudDFreeCamCross;
47  protected CheckBoxWidget m_HudDVersion;
48 
49  protected CheckBoxWidget m_ShowOthers;
50 
51  protected CheckBoxWidget m_HudDTemperature;
52  protected MapWidget m_DebugMapWidget;
53 
54  protected TextWidget m_PlayerCurPos;
55  protected TextWidget m_MouseCurPos;
56  protected TextWidget m_PlayerMouseDiff;
57 
58  protected TextListboxWidget m_DiagToggleTextListbox;
59  protected TextListboxWidget m_PositionsListbox;
60  protected TextListboxWidget m_DiagDrawmodeTextListbox;
61  protected TextListboxWidget m_HelpTextListboxWidget;
62  //-----------------------------------------------------------------------------------
63 
64  void ScriptConsoleGeneralTab(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent = null)
65  {
66  m_MissionGameplay = MissionGameplay.Cast(GetGame().GetMission());
67 
68  m_DiagToggleTextListbox = TextListboxWidget.Cast(root.FindAnyWidget("DiagToggle"));
69  m_DiagToggleButton = ButtonWidget.Cast(root.FindAnyWidget("DiagToggleButton"));
70 
71  m_DiagDrawmodeTextListbox = TextListboxWidget.Cast(root.FindAnyWidget("DiagDrawmode"));
72  m_DiagDrawButton = ButtonWidget.Cast(root.FindAnyWidget("DiagDrawButton"));
73 
74  m_DebugMapWidget = MapWidget.Cast(root.FindAnyWidget("MapWidget"));
75 
76  m_PositionsListbox = TextListboxWidget.Cast(root.FindAnyWidget("PositionsList"));
77  m_TeleportButton = ButtonWidget.Cast(root.FindAnyWidget("ButtonTeleport"));
78  m_ButtonCopyPos = ButtonWidget.Cast(root.FindAnyWidget("Button_CopyPos"));
79 
80  m_TeleportX = EditBoxWidget.Cast(root.FindAnyWidget("TeleportX"));
81  m_TeleportY = EditBoxWidget.Cast(root.FindAnyWidget("TeleportY"));
82  m_TeleportXYZ = EditBoxWidget.Cast(root.FindAnyWidget("TeleportXYZ"));
83  m_PlayerCurPos = TextWidget.Cast(root.FindAnyWidget("PlayerPosLabel"));
84  m_PlayerMouseDiff = TextWidget.Cast(root.FindAnyWidget("PlayerMouseDiff"));
85  m_MouseCurPos = TextWidget.Cast(root.FindAnyWidget("MousePosLabel"));
86  m_LogsEnabled = CheckBoxWidget.Cast(root.FindAnyWidget("cbx_LogsEnabled"));
87  m_HudDCharStats = CheckBoxWidget.Cast(root.FindAnyWidget("cbx_CharacterStats"));
88  m_HudDCharLevels = CheckBoxWidget.Cast(root.FindAnyWidget("cbx_CharacterLevels"));
89  m_HudDCharStomach = CheckBoxWidget.Cast(root.FindAnyWidget("cbx_CharacterStomach"));
90  m_HudDCharModifiers = CheckBoxWidget.Cast(root.FindAnyWidget("cbx_CharacterModifiers"));
91  m_HudDCharAgents = CheckBoxWidget.Cast(root.FindAnyWidget("cbx_CharacterAgents"));
92  m_HudDCharDebug = CheckBoxWidget.Cast(root.FindAnyWidget("cbx_CharacterDebug"));
93  m_HudDFreeCamCross = CheckBoxWidget.Cast(root.FindAnyWidget("cbx_FreeCamCross"));
94  m_HudDTemperature = CheckBoxWidget.Cast(root.FindAnyWidget("cbx_Temp"));
95  m_HudDVersion = CheckBoxWidget.Cast(root.FindAnyWidget("cbx_Version"));
96 
97  m_LocationAddButton = ButtonWidget.Cast(root.FindAnyWidget("AddButton"));
98  //m_LocationAddButton.SetHandler(ToolTipEventHandler.GetInstance());
99  m_LocationRemoveButton = ButtonWidget.Cast(root.FindAnyWidget("RemoveButton"));
100 
101  m_TimeSlider = SliderWidget.Cast(root.FindAnyWidget("TimeSlider"));
102  m_DateYear = EditBoxWidget.Cast(root.FindAnyWidget("DateYear"));
103  m_DateMonth = EditBoxWidget.Cast(root.FindAnyWidget("DateMonth"));
104  m_DateDay = EditBoxWidget.Cast(root.FindAnyWidget("DateDay"));
105  m_DateHour = EditBoxWidget.Cast(root.FindAnyWidget("DateHour"));
106  m_DateMinute = EditBoxWidget.Cast(root.FindAnyWidget("DateMinute"));
107 
108 
109  m_ShowOthers = CheckBoxWidget.Cast(root.FindAnyWidget("ShowOthersCheckbox"));
110 
111  m_HelpTextListboxWidget = TextListboxWidget.Cast(root.FindAnyWidget("HelpTextListboxWidget"));
112  m_Developer = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
113 
114  Init();
115  LateInit();
116 
117  }
118 
120  {
121  DEBUG_MAP_ZOOM = m_DebugMapWidget.GetScale();
122 
123  PluginRemotePlayerDebugClient plugin_remote_client = PluginRemotePlayerDebugClient.Cast(GetPlugin(PluginRemotePlayerDebugClient));
124  if (SHOW_OTHERS && plugin_remote_client && GetGame().GetPlayer())
125  plugin_remote_client.RequestPlayerInfo(PlayerBase.Cast(GetGame().GetPlayer()), 0);
126  }
127 
128  protected void Init()
129  {
130 
131 
132 
133  // Update checkbox Character Values
134  m_HudDCharStats.SetChecked(m_ConfigDebugProfile.GetCharacterStatsVisible());
135  m_HudDCharLevels.SetChecked(m_ConfigDebugProfile.GetCharacterLevelsVisible());
136  m_HudDCharStomach.SetChecked(m_ConfigDebugProfile.GetCharacterStomachVisible());
137  m_HudDCharModifiers.SetChecked(m_ConfigDebugProfile.GetCharacterModifiersVisible());
138  m_HudDCharAgents.SetChecked(m_ConfigDebugProfile.GetCharacterAgentsVisible());
139  m_HudDCharDebug.SetChecked(m_ConfigDebugProfile.GetCharacterDebugVisible());
140  m_HudDFreeCamCross.SetChecked(m_ConfigDebugProfile.GetFreeCameraCrosshairVisible());
141  m_HudDVersion.SetChecked(m_ConfigDebugProfile.GetVersionVisible());
142  m_HudDTemperature.SetChecked(m_ConfigDebugProfile.GetTempVisible());
143 
144 
145  m_LogsEnabled.SetChecked(m_ConfigDebugProfile.GetLogsEnabled());
146 
147  TStringArray diag_names = new TStringArray;
148  GetGame().GetDiagModeNames(diag_names);
149  int i;
150  for (i = 0; i < diag_names.Count(); i++)
151  {
152  m_DiagToggleTextListbox.AddItem(diag_names.Get(i), NULL, 0);
153  }
154 
155  GetGame().GetDiagDrawModeNames(diag_names);
156  for (i = 0; i < diag_names.Count(); i++)
157  {
158  m_DiagDrawmodeTextListbox.AddItem(diag_names.Get(i), NULL, 0);
159  }
160  RefreshLocations();
161 
162  UpdateHudDebugSetting();
163 
164  if (GetGame().GetPlayer())
165  {
166  m_DebugMapWidget.SetScale(DEBUG_MAP_ZOOM);
167  m_DebugMapWidget.SetMapPos(GetGame().GetPlayer().GetWorldPosition());
168  }
169  m_TeleportXYZ.SetText(DEFAULT_POS_XYZ);
170 
171  m_LateInit.Run(0.05, this, "LateInit", null, false);
172 
173  int year,month,day,hour,minute;
174  GetGame().GetWorld().GetDate(year,month, day, hour, minute);
175  RefreshDateWidgets(year,month, day, hour, minute);
176  }
177 
178 
179  void RefreshDateWidgets(int year, int month, int day, int hour, int minute)
180  {
181  float time01 = Math.InverseLerp(0,60*24 - 1, (hour * 60) + minute);
182  m_DateYear.SetText(year.ToString());
183  m_DateMonth.SetText(month.ToString());
184  m_DateDay.SetText(day.ToString());
185  m_DateHour.SetText(hour.ToString());
186  m_DateMinute.SetText(minute.ToString());
187  m_TimeSlider.SetCurrent(time01 * 100);
188  }
189 
190  bool IsLocationNameAvailable(string name)
191  {
192  int count = m_PositionsListbox.GetNumItems();
193  for (int i = 0; i < count; i++)
194  {
195  LocationParams data;
196  m_PositionsListbox.GetItemData(i,0,data);
197  if (data.param1 == name)
198  return false;
199  }
200  return true;
201  }
202 
203 
204 
205 
206  void LateInit()
207  {
208  m_ShowOthers.SetChecked(SHOW_OTHERS);
209 
211  {
212  int prevRow = m_ConfigDebugProfile.GetSpawnLocIndex();
213  if (prevRow < m_PositionsListbox.GetNumItems())
214  m_PositionsListbox.SelectRow(prevRow);
215 
216  }
217  PluginRemotePlayerDebugClient plugin_remote_client = PluginRemotePlayerDebugClient.Cast(GetPlugin(PluginRemotePlayerDebugClient));
218  if (SHOW_OTHERS && plugin_remote_client && GetGame().GetPlayer())
219  {
220  plugin_remote_client.RequestPlayerInfo(PlayerBase.Cast(GetGame().GetPlayer()), 1);
221  m_UpdatePlayerPositions = 1;
222  }
223 
224  }
225 
226  void Teleport(PlayerBase player, vector position)
227  {
228  if (position[1] == 0)
229  position[1] = GetGame().SurfaceY(position[0], position[2]);
230  m_Developer.Teleport(player, position);
231  }
232 
233  void RefreshLocations()
234  {
235  m_PositionsListbox.ClearItems();
236 
238  m_ConfigDebugProfile.GetLocationsData(locData,true);
239  m_ConfigDebugProfileFixed.GetLocationsData(locData,false);
240  foreach (LocationParams dta: locData)
241  {
242  string name = dta.param1;
243  if (!dta.param2)
244  {
245  name = "[" + name + "]";
246  }
247  m_PositionsListbox.AddItem(name,dta,0);
248  }
249  }
250 
251 
252  string GetCurrentLocationName()
253  {
254  string name;
255  LocationParams prms;
256  GetCurrentPositionData(prms);
257  if (prms)
258  name =prms.param1;
259  return name;
260  }
261  vector GetCurrentLocationPos()
262  {
263  LocationParams prms;
264  GetCurrentPositionData(prms);
265  if (prms)
266  return prms.param3;
267  else
268  return vector.Zero;
269  }
270 
271  void GetCurrentPositionData(out LocationParams data)
272  {
273  if (m_PositionsListbox.GetSelectedRow() != -1)
274  {
275  m_PositionsListbox.GetItemData(m_PositionsListbox.GetSelectedRow(), 0, data);
276  }
277  }
278 
279  bool IsCurrentPositionCustom()
280  {
281  LocationParams prms;
282  GetCurrentPositionData(prms);
283  if (prms)
284  return prms.param2;
285  else
286  return false;
287  }
288 
289  int GetCurrentPositionIndex()
290  {
291  return m_PositionsListbox.GetSelectedRow();
292  }
293 
294  bool IsCurrentPositionValid()
295  {
296  return (m_PositionsListbox.GetSelectedRow() != -1);
297  }
298 
299  void UpdateHudDebugSetting();
300 
301  void RefreshPlayerPosEditBoxes()
302  {
303  if (!GetGame().GetPlayer())
304  {
305  return;
306  }
307 
308  vector playerPos = GetGame().GetPlayer().GetPosition();
309  SetMapPos(playerPos);
310  }
311 
312  void UpdateTime(bool slider_used)
313  {
314  Param5<int,int,int,int,int> p5 = new Param5<int,int,int,int,int>(0,0,0,0,0);
315  int year, month, day, hour, minute;
316 
317  year = m_DateYear.GetText().ToInt();
318  month = m_DateMonth.GetText().ToInt();
319  day = m_DateDay.GetText().ToInt();
320 
321  if (slider_used)
322  {
323  int time_minutes = Math.Lerp(0, (24*60) - 1, m_TimeSlider.GetCurrent()/100);
324  hour = time_minutes / 60;
325  minute = time_minutes % 60;
326  }
327  else
328  {
329  hour = m_DateHour.GetText().ToInt();
330  minute = m_DateMinute.GetText().ToInt();
331  }
332 
333  p5.param1 = year;
334  p5.param2 = month;
335  p5.param3 = day;
336  p5.param4 = hour;
337  p5.param5 = minute;
338 
339  RefreshDateWidgets(year, month, day, hour, minute);
340  GetGame().GetWorld().SetDate(year, month, day, hour, minute);
341 
342  if (GetGame().GetPlayer())
343  {
344  GetGame().GetPlayer().RPCSingleParam(ERPCs.DEV_RPC_SET_TIME, p5, true);
345  }
346  }
347 
348 
349  void UpdateMousePos()
350  {
351  int x,y;
352  GetMousePos(x,y);
353  vector mousePos, worldPos;
354  mousePos[0] = x;
355  mousePos[1] = y;
356  worldPos = m_DebugMapWidget.ScreenToMap(mousePos);
357  worldPos[1] = GetGame().SurfaceY(worldPos[0], worldPos[2]);
358 
359  if (m_MouseCurPos)
360  {
361  m_MouseCurPos.SetText("Mouse: "+ MiscGameplayFunctions.TruncateToS(worldPos[0]) +", "+ MiscGameplayFunctions.TruncateToS(worldPos[1]) +", "+ MiscGameplayFunctions.TruncateToS(worldPos[2]));
362  }
363  if (m_PlayerMouseDiff && GetGame().GetPlayer())
364  {
365  vector playerPos = GetGame().GetPlayer().GetWorldPosition();
366  //playerPos[1] = 0;
367  float dst = (worldPos - playerPos).Length();
368 
369  m_PlayerMouseDiff.SetText("Distance: " + MiscGameplayFunctions.TruncateToS(dst));
370  }
371  }
372 
373 
374  void SetMapPos(vector pos)
375  {
376  m_MapPos = pos;
377  m_PlayerCurPos.SetText("Pos: "+ MiscGameplayFunctions.TruncateToS(pos[0]) +", "+ MiscGameplayFunctions.TruncateToS(pos[1]) +", "+ MiscGameplayFunctions.TruncateToS(pos[2]));
378  }
379 
380  vector GetMapPos()
381  {
382  return m_MapPos;
383  }
384 
385  override bool OnMouseButtonDown(Widget w, int x, int y, int button)
386  {
387  super.OnMouseButtonDown(w,x,y,button);
388 
389  if (w == m_DebugMapWidget)
390  {
391  if (button == 0)
392  {
393  m_PlayerPosRefreshBlocked = true;
394  int mouseX, mouseY;
395  GetMousePos(mouseX,mouseY);
396  vector mousePos, worldPos;
397  mousePos[0] = mouseX;
398  mousePos[1] = mouseY;
399  worldPos = m_DebugMapWidget.ScreenToMap(mousePos);
400  worldPos[1] = GetGame().SurfaceY(worldPos[0], worldPos[2]);
401 
402  SetMapPos(worldPos);
403  }
404  else if (button == 1 && GetGame().GetPlayer())
405  {
406  SetMapPos(GetGame().GetPlayer().GetWorldPosition());
407  }
408  }
409  return true;
410  }
411 
412 
413  override bool OnKeyDown(Widget w, int x, int y, int key)
414  {
415  super.OnKeyDown(w, x, y, key);
416  return false;
417  }
418 
419  override bool OnChange(Widget w, int x, int y, bool finished)
420  {
421  super.OnChange(w, x, y, finished);
422 
423  if (w == m_ShowOthers && GetGame().GetPlayer())
424  {
425  PluginRemotePlayerDebugClient plugin_remote_client = PluginRemotePlayerDebugClient.Cast(GetPlugin(PluginRemotePlayerDebugClient));
426  if (m_ShowOthers.IsChecked())
427  {
428  plugin_remote_client.RequestPlayerInfo(PlayerBase.Cast(GetGame().GetPlayer()), 1);
429  m_UpdatePlayerPositions = 1;
430  SHOW_OTHERS = true;
431  }
432  else
433  {
434  plugin_remote_client.RequestPlayerInfo(PlayerBase.Cast(GetGame().GetPlayer()), 0);
435  m_UpdatePlayerPositions = 0;
436  SHOW_OTHERS = false;
437  }
438  return true;
439  }
440  else if (w == m_TimeSlider || w == m_DateDay || w == m_DateYear || w == m_DateMonth || w == m_DateHour || w == m_DateMinute)
441  {
442  UpdateTime(w == m_TimeSlider);
443  return true;
444  }
445  return false;
446  }
447 
448  override bool OnItemSelected(Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
449  {
450  super.OnItemSelected(w, x, y, row, column, oldRow, oldColumn);
451  if (w == m_PositionsListbox)
452  {
453  vector position = GetCurrentLocationPos();
454  m_TeleportX.SetText(position[0].ToString());
455  m_TeleportY.SetText(position[2].ToString());
456  m_TeleportXYZ.SetText(position.ToString());
457  if (IsCurrentPositionValid())
458  {
459  m_ConfigDebugProfile.SetSpawnLocIndex(GetCurrentPositionIndex());
460  }
461 
462  return true;
463  }
464  return false;
465  }
466 
467  override bool OnDoubleClick(Widget w, int x, int y, int button)
468  {
469  super.OnDoubleClick(w, x, y, button);
470  PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
471 
472  if (w == m_DebugMapWidget)
473  {
474  vector screen_to_map = m_DebugMapWidget.ScreenToMap(Vector(x,y, 0));
475  float pos_y_a = GetGame().SurfaceY(screen_to_map[0], screen_to_map[2]);
476  float pos_y_b = GetGame().SurfaceRoadY(screen_to_map[0], screen_to_map[2]);
477  float pos_y = Math.Max(pos_y_a, pos_y_b);
478  screen_to_map[1] = pos_y;
479  m_Developer.Teleport(player, screen_to_map);
480  return true;
481  }
482 
483  if (w == m_PositionsListbox)
484  {
485  vector position = GetCurrentLocationPos();
486  Teleport(player, position);
487  return true;
488  }
489 
490  if (w == m_TeleportXYZ)
491  {
492  EditBoxWidget.Cast(w).SetText("");
493  return true;
494  }
495  return false;
496  }
497 
498  override bool OnClick(Widget w, int x, int y, int button)
499  {
500  super.OnClick(w, x, y, button);
501 
502  int i;
503  PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
504 
505  PluginDeveloper module_dev = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
506 
507  if (w == m_PositionsListbox)
508  {
509 
510  vector position = GetCurrentLocationPos();
511 
512  m_TeleportX.SetText(position[0].ToString());
513  m_TeleportY.SetText(position[2].ToString());
514 
515  if (IsCurrentPositionValid())
516  {
517  m_ConfigDebugProfile.SetSpawnLocIndex(GetCurrentPositionIndex());
518  }
519 
520  return true;
521  }
522  else if (w == m_TeleportButton)
523  {
524  float pos_x = m_TeleportX.GetText().ToFloat();
525  float pos_z = m_TeleportY.GetText().ToFloat();
526  float pos_y = GetGame().SurfaceY(pos_x, pos_z);
527  vector v = Vector(pos_x, pos_y, pos_z);
528  if (m_TeleportXYZ.GetText() != "" && m_TeleportXYZ.GetText() != DEFAULT_POS_XYZ)
529  {
530  string pos = m_TeleportXYZ.GetText();
531  v = pos.BeautifiedToVector();
532  }
533  Teleport(player, v);
534  return true;
535  }
536  else if (w == m_ButtonCopyPos)
537  {
538  GetGame().CopyToClipboard(GetMapPos().ToString());
539  return true;
540  }
541  else if (w == m_LogsEnabled)
542  {
543  //Log("m_LogsEnabled: "+ToString(m_LogsEnabled.IsChecked()));
544 
546  {
547  m_ConfigDebugProfile.SetLogsEnabled(m_LogsEnabled.IsChecked());
548  LogManager.SetLogsEnabled(m_LogsEnabled.IsChecked());
549  }
550 
551  return true;
552  }
553  else if (w == m_HudDCharStats)
554  {
556  {
557  m_ConfigDebugProfile.SetCharacterStatsVisible(m_HudDCharStats.IsChecked());
558  }
559 
560  // Refresh UI by new settings
561  m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
562 
563  return true;
564  }
565  else if (w == m_HudDCharLevels)
566  {
568  {
569  m_ConfigDebugProfile.SetCharacterLevelsVisible(m_HudDCharLevels.IsChecked());
570  }
571 
572  // Refresh UI by new settings
573  m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
574 
575  return true;
576  }
577  else if (w == m_HudDCharStomach)
578  {
580  {
581  m_ConfigDebugProfile.SetCharacterStomachVisible(m_HudDCharStomach.IsChecked());
582  }
583 
584  // Refresh UI by new settings
585  m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
586 
587  return true;
588  }
589  else if (w == m_HudDVersion)
590  {
592  {
593  m_ConfigDebugProfile.SetVersionVisible(m_HudDVersion.IsChecked());
594  }
595 
596  // Refresh UI by new settings
597  m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
598 
599  return true;
600  }
601  else if (w == m_HudDTemperature)
602  {
604  {
605  m_ConfigDebugProfile.SetTempVisible(m_HudDTemperature.IsChecked());
606  }
607 
608  // Refresh UI by new settings
609  m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
610 
611  return true;
612  }
613  else if (w == m_HudDCharModifiers)
614  {
616  {
617  m_ConfigDebugProfile.SetCharacterModifiersVisible(m_HudDCharModifiers.IsChecked());
618  }
619 
620  // Refresh UI by new settings
621  m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
622 
623  return true;
624  }
625  else if (w == m_HudDCharAgents)
626  {
628  {
629  m_ConfigDebugProfile.SetCharacterAgentsVisible(m_HudDCharAgents.IsChecked());
630  }
631 
632  // Refresh UI by new settings
633  m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
634 
635  return true;
636  }
637  else if (w == m_HudDCharDebug)
638  {
640  {
641  m_ConfigDebugProfile.SetCharacterDebugVisible(m_HudDCharDebug.IsChecked());
642  }
643 
644  // Refresh UI by new settings
645  m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
646 
647  return true;
648  }
649  else if (w == m_HudDFreeCamCross)
650  {
652  {
653  m_ConfigDebugProfile.SetFreeCameraCrosshairVisible(m_HudDFreeCamCross.IsChecked());
654  }
655 
656  // Refresh UI by new settings
657  m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
658 
659  GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Call(GetGame().GetMission().RefreshCrosshairVisibility);
660 
661  return true;
662  }
663 
664  else if (w == m_DiagToggleButton)
665  {
666  int toggle_row_index = m_DiagToggleTextListbox.GetSelectedRow();
667  bool toggle_state = GetGame().GetDiagModeEnable(toggle_row_index);
668  GetGame().SetDiagModeEnable(toggle_row_index, !toggle_state);
669  return true;
670  }
671  else if (w == m_DiagDrawButton)
672  {
673  int draw_row_index = m_DiagDrawmodeTextListbox.GetSelectedRow();
674  GetGame().SetDiagDrawMode(draw_row_index);
675  return true;
676  }
677  // TOUCHED THIS
678  else if (w == m_LocationAddButton)
679  {
680  ScriptConsoleAddLocation menu = ScriptConsoleAddLocation.Cast(g_Game.GetUIManager().EnterScriptedMenu(MENU_LOC_ADD, m_ScriptConsole));
681  menu.SetPosition(GetMapPos());
682  return true;
683  }
684  else if (w == m_LocationRemoveButton)
685  {
686  m_ConfigDebugProfile.CustomLocationsRemove(GetCurrentLocationName());
687  RefreshLocations();
688  return true;
689  }
690  return false;
691  }
692 
693  override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
694  {
695  super.OnRPCEx(rpc_type, ctx);
696  #ifdef DIAG_DEVELOPER
697  switch (rpc_type)
698  {
699  case ERPCs.DEV_PLAYER_DEBUG_DATA:
700  {
701  ctx.Read(m_PlayerDebugStats);
702  break;
703  }
704  }
705  #endif
706  }
707 
708  override void Update(float timeslice)
709  {
710  super.Update(timeslice);
711 
712  PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
713 
714  m_DebugMapWidget.ClearUserMarks();
715 
716  if (m_UpdatePlayerPositions)
717  {
719  {
720  if (rpd.m_Player != player)
721  {
722  vector dir = rpd.m_Pos - player.GetWorldPosition();
723  dir[1] = 0;
724  string dist = ((int)dir.Length()).ToString();
725  string text = rpd.m_Name + " " +dist +"m.";
726  m_DebugMapWidget.AddUserMark(rpd.m_Pos, text , COLOR_BLUE,"\\dz\\gear\\navigation\\data\\map_tree_ca.paa");
727  }
728  }
729  }
730  if (player)
731  {
732  vector playerPos = player.GetWorldPosition();
733  m_DebugMapWidget.AddUserMark(playerPos,"You", COLOR_RED,"\\dz\\gear\\navigation\\data\\map_tree_ca.paa");
734  if (playerPos != GetMapPos())
735  m_DebugMapWidget.AddUserMark(GetMapPos(),"Pos", COLOR_BLUE,"\\dz\\gear\\navigation\\data\\map_tree_ca.paa");
736  }
737  UpdateMousePos();
738  if (!m_PlayerPosRefreshBlocked)
739  RefreshPlayerPosEditBoxes();
740 
741 
742  foreach (MapMarker marker: ScriptConsole.m_MarkedEntities)
743  {
744  m_DebugMapWidget.AddUserMark(marker.GetMarkerPos(),marker.GetMarkerText(), marker.GetMarkerColor(), MapMarkerTypes.GetMarkerTypeFromID(marker.GetMarkerIcon()));
745  }
746  }
747 }
GetGame
proto native CGame GetGame()
CALL_CATEGORY_SYSTEM
const int CALL_CATEGORY_SYSTEM
Definition: tools.c:8
MENU_LOC_ADD
const int MENU_LOC_ADD
Definition: constants.c:162
LogManager
Definition: debug.c:734
MapWidget
Definition: gameplay.c:321
RefreshCrosshairVisibility
void RefreshCrosshairVisibility()
Definition: huddebug.c:238
TStringArray
array< string > TStringArray
Definition: enscript.c:685
GetMousePos
proto void GetMousePos(out int x, out int y)
EditBoxWidget
Definition: enwidgets.c:353
MapMarkerTypes
Definition: mapmarkersinfo.c:1
y
Icon y
Param3
Definition: entityai.c:95
ToString
proto string ToString()
GetPlugin
PluginBase GetPlugin(typename plugin_type)
Definition: pluginmanager.c:316
Serializer
Serialization general interface. Serializer API works with:
Definition: serializer.c:55
PlayerBase
Definition: playerbaseclient.c:1
vector
Definition: enconvert.c:105
TextWidget
Definition: enwidgets.c:219
ScriptConsoleGeneralTab
Definition: scriptconsolegeneraltab.c:1
g_Game
DayZGame g_Game
Definition: dayzgame.c:3727
COLOR_RED
const int COLOR_RED
Definition: constants.c:64
array< ref RemotePlayerStatDebug >
name
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
x
Icon x
MapMarker
Definition: inventoryitem.c:1154
int
Param3 int
GetPlayer
protected void GetPlayer()
Definition: crosshairselector.c:127
m_ConfigDebugProfile
PluginConfigDebugProfile m_ConfigDebugProfile
Definition: pluginitemdiagnostic.c:58
ERPCs
ERPCs
Definition: erpcs.c:1
Timer
Definition: dayzplayerimplement.c:62
Widget
Definition: enwidgets.c:189
ScriptConsoleTabBase
Definition: scriptconsoletabbase.c:1
RemotePlayerStatDebug
void RemotePlayerStatDebug(PlayerBase player)
Definition: remoteplayerstatdebug.c:16
Math
Definition: enmath.c:6
m_PlayerDebugStats
ref array< ref RemotePlayerStatDebug > m_PlayerDebugStats
Definition: pluginremoteplayerdebugclient.c:11
COLOR_BLUE
const int COLOR_BLUE
Definition: constants.c:66
Vector
proto native vector Vector(float x, float y, float z)
Vector constructor from components.