DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ScriptConsoleGeneralTab.c
См. документацию.
2{
3 static int m_ObjectsScope = 2;
4 static protected vector m_LastEditPos = vector.Zero;
5 static protected vector m_LastEditDir = vector.Zero;
6
7 protected static float DEBUG_MAP_ZOOM = 1;
8 protected static bool SHOW_OTHERS = 0;
9
10 protected const string NUMERIC_LETTERS = "0123456789.-";
11 protected vector m_MapPos;
13
15
16 protected MissionGameplay m_MissionGameplay;
17 protected PluginDeveloper m_Developer;
18
19 protected SliderWidget m_TimeSlider;
20 protected ref Timer m_LateInit = new Timer();
21
23 protected bool m_InitialOpen = true;
24
25 //-------------------------------- WIDGETS ---------------------------------------
33
34 protected ButtonWidget m_LocationAddButton;
35 protected ButtonWidget m_LocationRemoveButton;
36 protected ButtonWidget m_TeleportButton;
37 protected ButtonWidget m_ButtonCopyPos;
38 protected ButtonWidget m_DiagDrawButton;
39 protected ButtonWidget m_DiagToggleButton;
40
41 protected CheckBoxWidget m_LogsEnabled;
42 protected CheckBoxWidget m_HudDCharStats;
43 protected CheckBoxWidget m_HudDCharLevels;
44 protected CheckBoxWidget m_HudDCharStomach;
45 protected CheckBoxWidget m_HudDCharModifiers;
46 protected CheckBoxWidget m_HudDCharAgents;
47 protected CheckBoxWidget m_HudDCharDebug;
48 protected CheckBoxWidget m_HudDFreeCamCross;
49 protected CheckBoxWidget m_HudDVersion;
50 protected CheckBoxWidget m_HudDHealth;
51 protected CheckBoxWidget m_HudDHorticulture;
52
53 protected CheckBoxWidget m_ShowOthers;
54
55 protected CheckBoxWidget m_HudDTemperature;
57
64
65 protected TextListboxWidget m_DiagToggleTextListbox;
66 protected TextListboxWidget m_PositionsListbox;
67 protected TextListboxWidget m_DiagDrawmodeTextListbox;
68 protected TextListboxWidget m_HelpTextListboxWidget;
69
70 protected FreeDebugCamera m_FreeDebugCamera;
71
72 //-----------------------------------------------------------------------------------
73
74 void ScriptConsoleGeneralTab(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent = null)
75 {
76 m_MissionGameplay = MissionGameplay.Cast(GetGame().GetMission());
77
78 m_DiagToggleTextListbox = TextListboxWidget.Cast(root.FindAnyWidget("DiagToggle"));
79 m_DiagToggleButton = ButtonWidget.Cast(root.FindAnyWidget("DiagToggleButton"));
80
81 m_DiagDrawmodeTextListbox = TextListboxWidget.Cast(root.FindAnyWidget("DiagDrawmode"));
82 m_DiagDrawButton = ButtonWidget.Cast(root.FindAnyWidget("DiagDrawButton"));
83
84 m_DebugMapWidget = MapWidget.Cast(root.FindAnyWidget("MapWidget"));
85
86 m_PositionsListbox = TextListboxWidget.Cast(root.FindAnyWidget("PositionsList"));
87 m_TeleportButton = ButtonWidget.Cast(root.FindAnyWidget("ButtonTeleport"));
88 m_ButtonCopyPos = ButtonWidget.Cast(root.FindAnyWidget("Button_CopyPos"));
89
90 m_TeleportHeading = EditBoxWidget.Cast(root.FindAnyWidget("TeleportHeading"));
91 m_TeleportXYZ = EditBoxWidget.Cast(root.FindAnyWidget("TeleportXYZ"));
92 m_PlayerCurPos = TextWidget.Cast(root.FindAnyWidget("PlayerPosLabel"));
93 m_PlayerCurDir = TextWidget.Cast(root.FindAnyWidget("PlayerDirLabel"));
94 m_PlayerMouseDiff = TextWidget.Cast(root.FindAnyWidget("PlayerMouseDiff"));
95 m_MouseCurPos = TextWidget.Cast(root.FindAnyWidget("MousePosLabel"));
96 m_CameraCurPos = TextWidget.Cast(root.FindAnyWidget("CameraPosLabel"));
97 m_CameraCurDir = TextWidget.Cast(root.FindAnyWidget("CameraDirLabel"));
98 m_LogsEnabled = CheckBoxWidget.Cast(root.FindAnyWidget("cbx_LogsEnabled"));
99 m_HudDCharStats = CheckBoxWidget.Cast(root.FindAnyWidget("cbx_CharacterStats"));
100 m_HudDCharLevels = CheckBoxWidget.Cast(root.FindAnyWidget("cbx_CharacterLevels"));
101 m_HudDCharStomach = CheckBoxWidget.Cast(root.FindAnyWidget("cbx_CharacterStomach"));
102 m_HudDCharModifiers = CheckBoxWidget.Cast(root.FindAnyWidget("cbx_CharacterModifiers"));
103 m_HudDCharAgents = CheckBoxWidget.Cast(root.FindAnyWidget("cbx_CharacterAgents"));
104 m_HudDCharDebug = CheckBoxWidget.Cast(root.FindAnyWidget("cbx_CharacterDebug"));
105 m_HudDFreeCamCross = CheckBoxWidget.Cast(root.FindAnyWidget("cbx_FreeCamCross"));
106 m_HudDTemperature = CheckBoxWidget.Cast(root.FindAnyWidget("cbx_Temp"));
107 m_HudDVersion = CheckBoxWidget.Cast(root.FindAnyWidget("cbx_Version"));
108 m_HudDHealth = CheckBoxWidget.Cast(root.FindAnyWidget("cbx_Health"));
109 m_HudDHorticulture = CheckBoxWidget.Cast(root.FindAnyWidget("cbx_Horticulture"));
110
111 m_LocationAddButton = ButtonWidget.Cast(root.FindAnyWidget("AddButton"));
112 //m_LocationAddButton.SetHandler(ToolTipEventHandler.GetInstance());
113 m_LocationRemoveButton = ButtonWidget.Cast(root.FindAnyWidget("RemoveButton"));
114
115 m_TimeSlider = SliderWidget.Cast(root.FindAnyWidget("TimeSlider"));
116 m_DateYear = EditBoxWidget.Cast(root.FindAnyWidget("DateYear"));
117 m_DateMonth = EditBoxWidget.Cast(root.FindAnyWidget("DateMonth"));
118 m_DateDay = EditBoxWidget.Cast(root.FindAnyWidget("DateDay"));
119 m_DateHour = EditBoxWidget.Cast(root.FindAnyWidget("DateHour"));
120 m_DateMinute = EditBoxWidget.Cast(root.FindAnyWidget("DateMinute"));
121
122
123 m_ShowOthers = CheckBoxWidget.Cast(root.FindAnyWidget("ShowOthersCheckbox"));
124
125 m_HelpTextListboxWidget = TextListboxWidget.Cast(root.FindAnyWidget("HelpTextListboxWidget"));
126 m_Developer = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
127 m_FreeDebugCamera = FreeDebugCamera.GetInstance();
128
129 Init();
130 LateInit();
131 }
132
134 {
135 DEBUG_MAP_ZOOM = m_DebugMapWidget.GetScale();
136
137 PluginRemotePlayerDebugClient plugin_remote_client = PluginRemotePlayerDebugClient.Cast(GetPlugin(PluginRemotePlayerDebugClient));
138 if (SHOW_OTHERS && plugin_remote_client && GetGame().GetPlayer())
139 plugin_remote_client.RequestPlayerInfo(PlayerBase.Cast(GetGame().GetPlayer()), 0);
140 }
141
142 protected void Init()
143 {
144 // Update checkbox Character Values
145 m_HudDCharStats.SetChecked(m_ConfigDebugProfile.GetCharacterStatsVisible());
146 m_HudDCharLevels.SetChecked(m_ConfigDebugProfile.GetCharacterLevelsVisible());
147 m_HudDCharStomach.SetChecked(m_ConfigDebugProfile.GetCharacterStomachVisible());
148 m_HudDCharModifiers.SetChecked(m_ConfigDebugProfile.GetCharacterModifiersVisible());
149 m_HudDCharAgents.SetChecked(m_ConfigDebugProfile.GetCharacterAgentsVisible());
150 m_HudDCharDebug.SetChecked(m_ConfigDebugProfile.GetCharacterDebugVisible());
151 m_HudDFreeCamCross.SetChecked(m_ConfigDebugProfile.GetFreeCameraCrosshairVisible());
152 m_HudDVersion.SetChecked(m_ConfigDebugProfile.GetVersionVisible());
153 m_HudDTemperature.SetChecked(m_ConfigDebugProfile.GetTempVisible());
154 m_HudDHealth.SetChecked(m_ConfigDebugProfile.GetHealthVisible());
155 m_HudDHorticulture.SetChecked(m_ConfigDebugProfile.GetHorticultureVisible());
156
157
158 m_LogsEnabled.SetChecked(m_ConfigDebugProfile.GetLogsEnabled());
159
160 TStringArray diag_names = new TStringArray;
161 GetGame().GetDiagModeNames(diag_names);
162 int i;
163 for (i = 0; i < diag_names.Count(); i++)
164 {
165 m_DiagToggleTextListbox.AddItem(diag_names.Get(i), NULL, 0);
166 }
167
168 GetGame().GetDiagDrawModeNames(diag_names);
169 for (i = 0; i < diag_names.Count(); i++)
170 {
171 m_DiagDrawmodeTextListbox.AddItem(diag_names.Get(i), NULL, 0);
172 }
174
176
177 if (GetGame().GetPlayer())
178 {
180 m_DebugMapWidget.SetMapPos(GetGame().GetPlayer().GetWorldPosition());
181 }
183 m_TeleportXYZ.SetText(m_LastEditPos.ToString(true));
185 m_TeleportHeading.SetText(m_LastEditDir.ToString(true));
186
187 m_LateInit.Run(0.05, this, "LateInit", null, false);
188
189 int year,month,day,hour,minute;
190 GetGame().GetWorld().GetDate(year,month, day, hour, minute);
191 RefreshDateWidgets(year,month, day, hour, minute);
192 }
193
194 void RefreshDateWidgets(int year, int month, int day, int hour, int minute)
195 {
196 float time01 = Math.InverseLerp(0,60*24 - 1, (hour * 60) + minute);
197 m_DateYear.SetText(year.ToString());
198 m_DateMonth.SetText(month.ToString());
199 m_DateDay.SetText(day.ToString());
200 m_DateHour.SetText(hour.ToString());
201 m_DateMinute.SetText(minute.ToString());
202 m_TimeSlider.SetCurrent(time01 * 100);
203 }
204
206 {
207 int count = m_PositionsListbox.GetNumItems();
208 for (int i = 0; i < count; i++)
209 {
210 LocationParams data;
211 m_PositionsListbox.GetItemData(i,0,data);
212 if (data.param1 == name)
213 return false;
214 }
215 return true;
216 }
217
218 void LateInit()
219 {
220 m_ShowOthers.SetChecked(SHOW_OTHERS);
221
223 {
224 int prevRow = m_ConfigDebugProfile.GetSpawnLocIndex();
225 if (prevRow < m_PositionsListbox.GetNumItems())
226 m_PositionsListbox.SelectRow(prevRow);
227
228 }
229 PluginRemotePlayerDebugClient plugin_remote_client = PluginRemotePlayerDebugClient.Cast(GetPlugin(PluginRemotePlayerDebugClient));
230 if (SHOW_OTHERS && plugin_remote_client && GetGame().GetPlayer())
231 {
232 plugin_remote_client.RequestPlayerInfo(PlayerBase.Cast(GetGame().GetPlayer()), 1);
234 }
235
236 }
237
238 void Teleport(PlayerBase player, vector position)
239 {
240 if (position[1] == 0)
241 position[1] = GetGame().SurfaceY(position[0], position[2]);
242 m_Developer.Teleport(player, position);
243 }
244
246 {
247 bool doTeleport, doSetDir;
248 vector pos, dir;
249 string text = m_TeleportXYZ.GetText();
250 string textDir = m_TeleportHeading.GetText();
251
252 array<float> numbersPos = TextToNumbersArray(text);
253 if (numbersPos.Count() != 0)
254 {
255 if (numbersPos.Count() == 1)
256 {
257 pos = vector.Zero;
258 }
259 else if (numbersPos.Count() == 2)
260 {
261 pos = Vector(numbersPos[0], GetGame().SurfaceY(numbersPos[0], numbersPos[1]), numbersPos[1]);
262 }
263 else if (numbersPos.Count() <= 5)
264 {
265 pos = Vector(numbersPos[0], numbersPos[1], numbersPos[2]);
266 }
267 else if (numbersPos.Count() > 5)
268 {
269 pos = Vector(numbersPos[0], numbersPos[1], numbersPos[2]);
270 dir = Vector(numbersPos[3], numbersPos[4], numbersPos[5]);
271
272 Teleport(player, pos);
273 m_LastEditPos = pos;
274 m_TeleportXYZ.SetText(m_LastEditPos.ToString());
275
276 m_Developer.SetDirection(player, dir);
277 m_LastEditDir = dir;
278 m_TeleportHeading.SetText(m_LastEditDir.ToString());
279
280 return;
281 }
282
283 doTeleport = true;
284 }
285 else
287
288 array<float> numbersDir = TextToNumbersArray(textDir);
289 if (numbersDir.Count() != 0)
290 {
291 if (numbersDir.Count() == 1)
292 {
293 dir = vector.Zero;
294 }
295 else if (numbersDir.Count() == 2)
296 {
297 dir = Vector(numbersDir[0], 0, numbersDir[1]);
298 }
299 else if (numbersDir.Count() <= 5)
300 {
301 dir = Vector(numbersDir[0], numbersDir[1], numbersDir[2]);
302 }
303 else if (numbersDir.Count() > 5)
304 {
305 pos = Vector(numbersDir[0], numbersDir[1], numbersDir[2]);
306 dir = Vector(numbersDir[3], numbersDir[4], numbersDir[5]);
307
308 Teleport(player, pos);
309 m_LastEditPos = pos;
310 m_TeleportXYZ.SetText(m_LastEditPos.ToString());
311
312 m_Developer.SetDirection(player, dir);
313 m_LastEditDir = dir;
314 m_TeleportHeading.SetText(m_LastEditDir.ToString());
315
316 return;
317 }
318
319 doSetDir = true;
320 }
321 else
323
324 if (doTeleport)
325 {
326 Teleport(player, pos);
327 m_LastEditPos = pos;
328 }
329
330 if (doSetDir)
331 {
332 m_Developer.SetDirection(player, dir);
333 m_LastEditDir = dir;
334 }
335 }
336
338 {
339 array<float> numbers = new array<float>();
340 int length = text.Length();
341 int numberStart = -1;
342 int numberLen;
343
344 for (int i = 0; i < length; i++) // find numbers and move them to array
345 {
346 string letter = text.Get(i);
347
348 if (numberStart == -1 && NUMERIC_LETTERS.Contains(letter) && letter != ".") // search for number
349 numberStart = i;
350
351 if (numberStart != -1 && (!NUMERIC_LETTERS.Contains(letter) || (letter == "-" && numberStart != i))) // search for number end
352 {
353 numberLen = i - numberStart;
354 numbers.Insert(text.Substring(numberStart, numberLen).ToFloat());
355 numberStart = -1;
356 }
357 else if (numberStart != -1 && (i + 1 == length)) // last letter
358 {
359 numberLen = i - numberStart + 1;
360 numbers.Insert(text.Substring(numberStart, numberLen).ToFloat());
361 numberStart = -1;
362 }
363 }
364
365 return numbers;
366 }
367
369 {
370 m_PositionsListbox.ClearItems();
371
373 m_ConfigDebugProfile.GetLocationsData(locData,true);
374 m_ConfigDebugProfileFixed.GetLocationsData(locData,false);
375 foreach (LocationParams dta: locData)
376 {
377 string name = dta.param1;
378 if (!dta.param2)
379 {
380 name = "[" + name + "]";
381 }
382 m_PositionsListbox.AddItem(name,dta,0);
383 }
384 }
385
387 {
388 string name;
389 LocationParams prms;
391 if (prms)
392 name =prms.param1;
393 return name;
394 }
396 {
397 LocationParams prms;
399 if (prms)
400 return prms.param3;
401 else
402 return vector.Zero;
403 }
404
406 {
407 if (m_PositionsListbox.GetSelectedRow() != -1)
408 {
409 m_PositionsListbox.GetItemData(m_PositionsListbox.GetSelectedRow(), 0, data);
410 }
411 }
412
414 {
415 LocationParams prms;
417 if (prms)
418 return prms.param2;
419 else
420 return false;
421 }
422
424 {
425 return m_PositionsListbox.GetSelectedRow();
426 }
427
429 {
430 return (m_PositionsListbox.GetSelectedRow() != -1);
431 }
432
434
436 {
437 if (!GetGame().GetPlayer())
438 {
439 return;
440 }
441
442 vector playerPos = GetGame().GetPlayer().GetPosition();
443 SetMapPos(playerPos);
444
445 vector playerDir = GetGame().GetPlayer().GetDirection();
446 SetDir(playerDir);
447 }
448
449 void UpdateTime(bool slider_used)
450 {
451 Param5<int,int,int,int,int> p5 = new Param5<int,int,int,int,int>(0,0,0,0,0);
452 int year, month, day, hour, minute;
453
454 year = m_DateYear.GetText().ToInt();
455 month = m_DateMonth.GetText().ToInt();
456 day = m_DateDay.GetText().ToInt();
457
458 if (slider_used)
459 {
460 int time_minutes = Math.Lerp(0, (24*60) - 1, m_TimeSlider.GetCurrent()/100);
461 hour = time_minutes / 60;
462 minute = time_minutes % 60;
463 }
464 else
465 {
466 hour = m_DateHour.GetText().ToInt();
467 minute = m_DateMinute.GetText().ToInt();
468 }
469
470 p5.param1 = year;
471 p5.param2 = month;
472 p5.param3 = day;
473 p5.param4 = hour;
474 p5.param5 = minute;
475
476 RefreshDateWidgets(year, month, day, hour, minute);
477 GetGame().GetWorld().SetDate(year, month, day, hour, minute);
478
479 g_Game.GetMission().GetOnTimeChanged().Invoke();
480
481 if (GetGame().GetPlayer())
482 {
483 GetGame().GetPlayer().RPCSingleParam(ERPCs.DEV_RPC_SET_TIME, p5, true);
484 }
485 }
486
488 {
489 int x,y;
490 GetMousePos(x,y);
491 vector mousePos, worldPos;
492 mousePos[0] = x;
493 mousePos[1] = y;
494 worldPos = m_DebugMapWidget.ScreenToMap(mousePos);
495 worldPos[1] = GetGame().SurfaceY(worldPos[0], worldPos[2]);
496
497 if (m_MouseCurPos)
498 {
499 m_MouseCurPos.SetText("Mouse: "+ MiscGameplayFunctions.TruncateToS(worldPos[0]) +", "+ MiscGameplayFunctions.TruncateToS(worldPos[1]) +", "+ MiscGameplayFunctions.TruncateToS(worldPos[2]));
500 }
502 {
503 vector playerPos = GetGame().GetPlayer().GetWorldPosition();
504 //playerPos[1] = 0;
505 float dst = (worldPos - playerPos).Length();
506
507 m_PlayerMouseDiff.SetText("Distance: " + MiscGameplayFunctions.TruncateToS(dst));
508 }
509 }
510
512 {
513 m_MapPos = pos;
514 m_PlayerCurPos.SetText("Position: "+ MiscGameplayFunctions.TruncateToS(pos[0]) +", "+ MiscGameplayFunctions.TruncateToS(pos[1]) +", "+ MiscGameplayFunctions.TruncateToS(pos[2]));
515 }
516
518 {
519 m_CameraCurPos.SetText("Camera Position: "+ MiscGameplayFunctions.TruncateToS(pos[0]) +", "+ MiscGameplayFunctions.TruncateToS(pos[1]) +", "+ MiscGameplayFunctions.TruncateToS(pos[2]));
520 }
521
522 void SetDir(vector dir)
523 {
524 m_PlayerCurDir.SetText("Direction: "+ MiscGameplayFunctions.TruncateToS(dir[0]) +", "+ MiscGameplayFunctions.TruncateToS(dir[1]) +", "+ MiscGameplayFunctions.TruncateToS(dir[2]));
525 }
526
528 {
529 m_CameraCurDir.SetText("Camera Direction: "+ MiscGameplayFunctions.TruncateToS(dir[0]) +", "+ MiscGameplayFunctions.TruncateToS(dir[1]) +", "+ MiscGameplayFunctions.TruncateToS(dir[2]));
530 }
531
533 {
534 return m_MapPos;
535 }
536
537 override bool OnMouseButtonDown(Widget w, int x, int y, int button)
538 {
539 super.OnMouseButtonDown(w,x,y,button);
540
541 if (w == m_DebugMapWidget)
542 {
543 if (button == 0)
544 {
545 if (m_FreeDebugCamera && m_FreeDebugCamera.IsActive())
546 {
547 SetMapCameraPos(m_FreeDebugCamera.GetWorldPosition());
548 SetCameraDir(m_FreeDebugCamera.GetDirection());
549 }
550 else
551 {
553 int mouseX, mouseY;
554 GetMousePos(mouseX,mouseY);
555 vector mousePos, worldPos;
556 mousePos[0] = mouseX;
557 mousePos[1] = mouseY;
558 worldPos = m_DebugMapWidget.ScreenToMap(mousePos);
559 worldPos[1] = GetGame().SurfaceY(worldPos[0], worldPos[2]);
560 SetMapPos(worldPos);
561 }
562 }
563 else if (button == 1 && GetGame().GetPlayer())
564 {
565 if (m_FreeDebugCamera && m_FreeDebugCamera.IsActive())
566 SetMapCameraPos(m_FreeDebugCamera.GetWorldPosition());
567 else
568 SetMapPos(GetGame().GetPlayer().GetWorldPosition());
569 }
570 }
571 return true;
572 }
573
574 override bool OnKeyDown(Widget w, int x, int y, int key)
575 {
576 super.OnKeyDown(w, x, y, key);
577 return false;
578 }
579
580 override bool OnChange(Widget w, int x, int y, bool finished)
581 {
582 super.OnChange(w, x, y, finished);
583
584 if (w == m_ShowOthers && GetGame().GetPlayer())
585 {
586 PluginRemotePlayerDebugClient plugin_remote_client = PluginRemotePlayerDebugClient.Cast(GetPlugin(PluginRemotePlayerDebugClient));
587 if (m_ShowOthers.IsChecked())
588 {
589 plugin_remote_client.RequestPlayerInfo(PlayerBase.Cast(GetGame().GetPlayer()), 1);
591 SHOW_OTHERS = true;
592 }
593 else
594 {
595 plugin_remote_client.RequestPlayerInfo(PlayerBase.Cast(GetGame().GetPlayer()), 0);
597 SHOW_OTHERS = false;
598 }
599 return true;
600 }
601 else if (w == m_TimeSlider || w == m_DateDay || w == m_DateYear || w == m_DateMonth || w == m_DateHour || w == m_DateMinute)
602 {
604 return true;
605 }
606
607 return false;
608 }
609
610 override bool OnItemSelected(Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
611 {
612 super.OnItemSelected(w, x, y, row, column, oldRow, oldColumn);
613 if (w == m_PositionsListbox)
614 {
615 if (m_InitialOpen)
616 {
617 m_InitialOpen = false;
618 return true;
619 }
620
621 vector position = GetCurrentLocationPos();
622 m_TeleportXYZ.SetText(position.ToString());
624 {
626 }
627
628 return true;
629 }
630 return false;
631 }
632
633 override bool OnDoubleClick(Widget w, int x, int y, int button)
634 {
635 super.OnDoubleClick(w, x, y, button);
636 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
637
638 if (w == m_DebugMapWidget)
639 {
640 vector screen_to_map = m_DebugMapWidget.ScreenToMap(Vector(x,y, 0));
641 float pos_y_a = GetGame().SurfaceY(screen_to_map[0], screen_to_map[2]);
642 float pos_y_b = GetGame().SurfaceRoadY(screen_to_map[0], screen_to_map[2]);
643 float pos_y = Math.Max(pos_y_a, pos_y_b);
644 screen_to_map[1] = pos_y;
645
646 if (m_FreeDebugCamera && m_FreeDebugCamera.IsActive())
647 {
648 vector camPos = m_FreeDebugCamera.GetPosition();
649 float camPosY = camPos[1];
650 screen_to_map[1] = camPosY;
651 m_FreeDebugCamera.SetPosition(screen_to_map);
652 }
653 else
654 {
655 m_Developer.Teleport(player, screen_to_map);
656 }
657
658 return true;
659 }
660
661 if (w == m_PositionsListbox)
662 {
663 vector position = GetCurrentLocationPos();
664 if (m_FreeDebugCamera && m_FreeDebugCamera.IsActive())
665 {
666 m_FreeDebugCamera.SetPosition(position);
667 }
668 else
669 {
670 Teleport(player, position);
671 }
672 return true;
673 }
674
675 if (w == m_TeleportHeading)
676 {
677 EditBoxWidget.Cast(w).SetText("");
678 return true;
679 }
680
681 if (w == m_TeleportXYZ)
682 {
683 EditBoxWidget.Cast(w).SetText("");
684 return true;
685 }
686 return false;
687 }
688
689 override bool OnClick(Widget w, int x, int y, int button)
690 {
691 super.OnClick(w, x, y, button);
692
693 int i;
694 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
695
696 PluginDeveloper module_dev = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
697
698 if (w == m_PositionsListbox)
699 {
700
701 vector position = GetCurrentLocationPos();
702
704 {
706 }
707
708 return true;
709 }
710 else if (w == m_TeleportButton)
711 {
712 ProcessTeleportText(player);
713 return true;
714 }
715 else if (w == m_ButtonCopyPos)
716 {
717 if (m_IsShiftDown)
718 {
720 return true;
721 }
722
723
724 GetGame().CopyToClipboard(GetMapPos().ToString() + " " + GetGame().GetPlayer().GetDirection().ToString());
725 return true;
726 }
727 else if (w == m_LogsEnabled)
728 {
729 //Log("m_LogsEnabled: "+ToString(m_LogsEnabled.IsChecked()));
730
732 {
733 m_ConfigDebugProfile.SetLogsEnabled(m_LogsEnabled.IsChecked());
735 }
736
737 return true;
738 }
739 else if (w == m_HudDCharStats)
740 {
742 {
743 m_ConfigDebugProfile.SetCharacterStatsVisible(m_HudDCharStats.IsChecked());
744 }
745
746 // Refresh UI by new settings
747 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
748
749 return true;
750 }
751 else if (w == m_HudDCharLevels)
752 {
754 {
755 m_ConfigDebugProfile.SetCharacterLevelsVisible(m_HudDCharLevels.IsChecked());
756 }
757
758 // Refresh UI by new settings
759 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
760
761 return true;
762 }
763 else if (w == m_HudDCharStomach)
764 {
766 {
767 m_ConfigDebugProfile.SetCharacterStomachVisible(m_HudDCharStomach.IsChecked());
768 }
769
770 // Refresh UI by new settings
771 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
772
773 return true;
774 }
775 else if (w == m_HudDVersion)
776 {
778 {
779 m_ConfigDebugProfile.SetVersionVisible(m_HudDVersion.IsChecked());
780 }
781
782 // Refresh UI by new settings
783 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
784
785 return true;
786 }
787 else if (w == m_HudDTemperature)
788 {
790 {
791 m_ConfigDebugProfile.SetTempVisible(m_HudDTemperature.IsChecked());
792 }
793
794 // Refresh UI by new settings
795 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
796
797 return true;
798 }
799 else if (w == m_HudDHealth)
800 {
802 {
803 m_ConfigDebugProfile.SetHealthVisible(m_HudDHealth.IsChecked());
804 }
805
806 // Refresh UI by new settings
807 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
808
809 return true;
810 }
811 else if (w == m_HudDHorticulture)
812 {
814 {
815 m_ConfigDebugProfile.SetHorticultureVisible(m_HudDHorticulture.IsChecked());
816 }
817
818 // Refresh UI by new settings
819 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
820
821 return true;
822 }
823 else if (w == m_HudDCharModifiers)
824 {
826 {
827 m_ConfigDebugProfile.SetCharacterModifiersVisible(m_HudDCharModifiers.IsChecked());
828 }
829
830 // Refresh UI by new settings
831 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
832
833 return true;
834 }
835 else if (w == m_HudDCharAgents)
836 {
838 {
839 m_ConfigDebugProfile.SetCharacterAgentsVisible(m_HudDCharAgents.IsChecked());
840 }
841
842 // Refresh UI by new settings
843 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
844
845 return true;
846 }
847 else if (w == m_HudDCharDebug)
848 {
850 {
851 m_ConfigDebugProfile.SetCharacterDebugVisible(m_HudDCharDebug.IsChecked());
852 }
853
854 // Refresh UI by new settings
855 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
856
857 return true;
858 }
859 else if (w == m_HudDFreeCamCross)
860 {
862 {
863 m_ConfigDebugProfile.SetFreeCameraCrosshairVisible(m_HudDFreeCamCross.IsChecked());
864 }
865
866 // Refresh UI by new settings
867 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
868
870
871 return true;
872 }
873
874 else if (w == m_DiagToggleButton)
875 {
876 int toggle_row_index = m_DiagToggleTextListbox.GetSelectedRow();
877 bool toggle_state = GetGame().GetDiagModeEnable(toggle_row_index);
878 GetGame().SetDiagModeEnable(toggle_row_index, !toggle_state);
879 return true;
880 }
881 else if (w == m_DiagDrawButton)
882 {
883 int draw_row_index = m_DiagDrawmodeTextListbox.GetSelectedRow();
884 GetGame().SetDiagDrawMode(draw_row_index);
885 return true;
886 }
887 // TOUCHED THIS
888 else if (w == m_LocationAddButton)
889 {
890 ScriptConsoleAddLocation menu = ScriptConsoleAddLocation.Cast(g_Game.GetUIManager().EnterScriptedMenu(MENU_LOC_ADD, m_ScriptConsole));
891 menu.SetPosition(GetMapPos());
892 return true;
893 }
894 else if (w == m_LocationRemoveButton)
895 {
896 m_ConfigDebugProfile.CustomLocationsRemove(GetCurrentLocationName());
898 return true;
899 }
900 return false;
901 }
902
903 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
904 {
905 super.OnRPCEx(rpc_type, ctx);
906 #ifdef DIAG_DEVELOPER
907 switch (rpc_type)
908 {
909 case ERPCs.DEV_PLAYER_DEBUG_DATA:
910 {
912 break;
913 }
914 }
915 #endif
916 }
917
918 override void Update(float timeslice)
919 {
920 super.Update(timeslice);
921
922 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
923
924 m_DebugMapWidget.ClearUserMarks();
925
927 {
929 {
930 if (rpd.m_Player != player)
931 {
932 vector dir = rpd.m_Pos - player.GetWorldPosition();
933 dir[1] = 0;
934 string dist = ((int)dir.Length()).ToString();
935 string text = rpd.m_Name + " " +dist +"m.";
936 m_DebugMapWidget.AddUserMark(rpd.m_Pos, text , COLOR_BLUE,"\\dz\\gear\\navigation\\data\\map_tree_ca.paa");
937 }
938 }
939 }
940
941 if (player)
942 {
943 vector playerPos = player.GetWorldPosition();
944 m_DebugMapWidget.AddUserMark(playerPos,"You", COLOR_RED,"\\dz\\gear\\navigation\\data\\map_tree_ca.paa");
945 if (playerPos != GetMapPos())
946 m_DebugMapWidget.AddUserMark(GetMapPos(),"Pos", COLOR_BLUE,"\\dz\\gear\\navigation\\data\\map_tree_ca.paa");
947 }
948
949 if (m_FreeDebugCamera && m_FreeDebugCamera.IsActive())
950 {
951 vector cameraPos = m_FreeDebugCamera.GetWorldPosition();
952 m_DebugMapWidget.AddUserMark(cameraPos,"Camera", COLOR_GREEN,"\\dz\\gear\\navigation\\data\\map_tree_ca.paa");
953 }
954
958
959 foreach (MapMarker marker: ScriptConsole.m_MarkedEntities)
960 {
962 }
963 }
964}
Param3 int
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
DayZGame g_Game
Определения DayZGame.c:3868
ERPCs
Определения ERPCs.c:2
proto string ToString()
void RefreshCrosshairVisibility()
Определения HudDebug.c:251
Icon x
Icon y
PlayerBase GetPlayer()
Определения ModifierBase.c:51
Param3< string, bool, vector > LocationParams
Определения PluginConfigDebugProfile.c:49
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
void RemotePlayerStatDebug(PlayerBase player)
Определения RemotePlayerStatDebug.c:16
proto native void CopyToClipboard(string text)
proto native float SurfaceY(float x, float z)
proto native World GetWorld()
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1187
proto native float SurfaceRoadY(float x, float z, RoadSurfaceDetection rsd=RoadSurfaceDetection.LEGACY)
proto native void GetDiagModeNames(out TStringArray diag_names)
Get list of all debug modes.
proto native DayZPlayer GetPlayer()
proto native void SetDiagModeEnable(int diag_mode, bool enabled)
Set specific debug mode.
proto native void SetDiagDrawMode(int diag_draw_mode)
Set debug draw mode.
proto native bool GetDiagModeEnable(int diag_mode)
Gets state of specific debug mode.
proto native void GetDiagDrawModeNames(out TStringArray diag_names)
Get list of all debug draw modes.
Определения EnWidgets.c:354
static void SetLogsEnabled(bool enable)
Определения Debug.c:633
Определения Debug.c:594
vector GetMarkerPos()
Определения InventoryItem.c:1177
int GetMarkerColor()
Определения InventoryItem.c:1187
string GetMarkerText()
Определения InventoryItem.c:1182
int GetMarkerIcon()
Определения InventoryItem.c:1192
Определения InventoryItem.c:1163
static string GetMarkerTypeFromID(int id)
Определения MapMarkersInfo.c:36
Определения MapMarkersInfo.c:2
Определения gameplay.c:323
Определения EnMath.c:7
Определения PlayerBaseClient.c:2
proto void Call(func fn, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
CheckBoxWidget m_HudDHorticulture
Определения ScriptConsoleGeneralTab.c:51
CheckBoxWidget m_HudDCharLevels
Определения ScriptConsoleGeneralTab.c:43
const string NUMERIC_LETTERS
Определения ScriptConsoleGeneralTab.c:10
CheckBoxWidget m_HudDCharModifiers
Определения ScriptConsoleGeneralTab.c:45
ButtonWidget m_ButtonCopyPos
Определения ScriptConsoleGeneralTab.c:37
TextListboxWidget m_DiagDrawmodeTextListbox
Определения ScriptConsoleGeneralTab.c:67
void ~ScriptConsoleGeneralTab()
Определения ScriptConsoleGeneralTab.c:133
EditBoxWidget m_TeleportXYZ
Определения ScriptConsoleGeneralTab.c:27
TextWidget m_CameraCurPos
Определения ScriptConsoleGeneralTab.c:62
void SetCameraDir(vector dir)
Определения ScriptConsoleGeneralTab.c:527
int GetCurrentPositionIndex()
Определения ScriptConsoleGeneralTab.c:423
EditBoxWidget m_DateMinute
Определения ScriptConsoleGeneralTab.c:32
TextListboxWidget m_DiagToggleTextListbox
Определения ScriptConsoleGeneralTab.c:65
MapWidget m_DebugMapWidget
Определения ScriptConsoleGeneralTab.c:56
TextListboxWidget m_PositionsListbox
Определения ScriptConsoleGeneralTab.c:66
override bool OnDoubleClick(Widget w, int x, int y, int button)
Определения ScriptConsoleGeneralTab.c:633
void SetMapCameraPos(vector pos)
Определения ScriptConsoleGeneralTab.c:517
static float DEBUG_MAP_ZOOM
Определения ScriptConsoleGeneralTab.c:7
bool IsCurrentPositionCustom()
Определения ScriptConsoleGeneralTab.c:413
static bool SHOW_OTHERS
Определения ScriptConsoleGeneralTab.c:8
EditBoxWidget m_DateDay
Определения ScriptConsoleGeneralTab.c:30
bool m_UpdatePlayerPositions
Определения ScriptConsoleGeneralTab.c:22
ref Timer m_LateInit
Определения ScriptConsoleGeneralTab.c:20
FreeDebugCamera m_FreeDebugCamera
Определения ScriptConsoleGeneralTab.c:70
bool m_PlayerPosRefreshBlocked
Определения ScriptConsoleGeneralTab.c:12
override bool OnClick(Widget w, int x, int y, int button)
Определения ScriptConsoleGeneralTab.c:689
CheckBoxWidget m_HudDCharStomach
Определения ScriptConsoleGeneralTab.c:44
CheckBoxWidget m_HudDVersion
Определения ScriptConsoleGeneralTab.c:49
vector GetCurrentLocationPos()
Определения ScriptConsoleGeneralTab.c:395
CheckBoxWidget m_HudDCharStats
Определения ScriptConsoleGeneralTab.c:42
bool IsLocationNameAvailable(string name)
Определения ScriptConsoleGeneralTab.c:205
EditBoxWidget m_TeleportHeading
Определения ScriptConsoleGeneralTab.c:26
TextListboxWidget m_HelpTextListboxWidget
Определения ScriptConsoleGeneralTab.c:68
override bool OnMouseButtonDown(Widget w, int x, int y, int button)
Определения ScriptConsoleGeneralTab.c:537
ButtonWidget m_LocationRemoveButton
Определения ScriptConsoleGeneralTab.c:35
CheckBoxWidget m_ShowOthers
Определения ScriptConsoleGeneralTab.c:53
EditBoxWidget m_DateHour
Определения ScriptConsoleGeneralTab.c:31
ref array< ref RemotePlayerStatDebug > m_PlayerDebugStats
Определения ScriptConsoleGeneralTab.c:14
CheckBoxWidget m_HudDHealth
Определения ScriptConsoleGeneralTab.c:50
TextWidget m_CameraCurDir
Определения ScriptConsoleGeneralTab.c:63
override bool OnChange(Widget w, int x, int y, bool finished)
Определения ScriptConsoleGeneralTab.c:580
TextWidget m_PlayerCurDir
Определения ScriptConsoleGeneralTab.c:59
SliderWidget m_TimeSlider
Определения ScriptConsoleGeneralTab.c:19
void ProcessTeleportText(PlayerBase player)
Определения ScriptConsoleGeneralTab.c:245
TextWidget m_PlayerCurPos
Определения ScriptConsoleGeneralTab.c:58
PluginDeveloper m_Developer
Определения ScriptConsoleGeneralTab.c:17
void ScriptConsoleGeneralTab(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent=null)
Определения ScriptConsoleGeneralTab.c:74
static int m_ObjectsScope
Определения ScriptConsoleGeneralTab.c:3
EditBoxWidget m_DateMonth
Определения ScriptConsoleGeneralTab.c:29
CheckBoxWidget m_LogsEnabled
Определения ScriptConsoleGeneralTab.c:41
void SetDir(vector dir)
Определения ScriptConsoleGeneralTab.c:522
void Teleport(PlayerBase player, vector position)
Определения ScriptConsoleGeneralTab.c:238
CheckBoxWidget m_HudDCharDebug
Определения ScriptConsoleGeneralTab.c:47
void GetCurrentPositionData(out LocationParams data)
Определения ScriptConsoleGeneralTab.c:405
CheckBoxWidget m_HudDFreeCamCross
Определения ScriptConsoleGeneralTab.c:48
CheckBoxWidget m_HudDTemperature
Определения ScriptConsoleGeneralTab.c:55
void UpdateTime(bool slider_used)
Определения ScriptConsoleGeneralTab.c:449
override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
Определения ScriptConsoleGeneralTab.c:903
string GetCurrentLocationName()
Определения ScriptConsoleGeneralTab.c:386
TextWidget m_MouseCurPos
Определения ScriptConsoleGeneralTab.c:60
TextWidget m_PlayerMouseDiff
Определения ScriptConsoleGeneralTab.c:61
override void Update(float timeslice)
Определения ScriptConsoleGeneralTab.c:918
array< float > TextToNumbersArray(string text)
Определения ScriptConsoleGeneralTab.c:337
EditBoxWidget m_DateYear
Определения ScriptConsoleGeneralTab.c:28
override bool OnItemSelected(Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
Определения ScriptConsoleGeneralTab.c:610
ButtonWidget m_DiagToggleButton
Определения ScriptConsoleGeneralTab.c:39
bool IsCurrentPositionValid()
Определения ScriptConsoleGeneralTab.c:428
override bool OnKeyDown(Widget w, int x, int y, int key)
Определения ScriptConsoleGeneralTab.c:574
void RefreshPlayerPosEditBoxes()
Определения ScriptConsoleGeneralTab.c:435
MissionGameplay m_MissionGameplay
Определения ScriptConsoleGeneralTab.c:16
ButtonWidget m_TeleportButton
Определения ScriptConsoleGeneralTab.c:36
void RefreshDateWidgets(int year, int month, int day, int hour, int minute)
Определения ScriptConsoleGeneralTab.c:194
ButtonWidget m_DiagDrawButton
Определения ScriptConsoleGeneralTab.c:38
CheckBoxWidget m_HudDCharAgents
Определения ScriptConsoleGeneralTab.c:46
void SetMapPos(vector pos)
Определения ScriptConsoleGeneralTab.c:511
ButtonWidget m_LocationAddButton
Определения ScriptConsoleGeneralTab.c:34
bool m_IsShiftDown
Определения ScriptConsoleTabBase.c:5
PluginConfigDebugProfile m_ConfigDebugProfile
Определения ScriptConsoleTabBase.c:11
void ScriptConsoleTabBase(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent=null)
Определения ScriptConsoleTabBase.c:14
ScriptConsole m_ScriptConsole
Определения ScriptConsoleTabBase.c:9
PluginConfigDebugProfileFixed m_ConfigDebugProfileFixed
Определения ScriptConsoleTabBase.c:12
proto bool Read(void value_in)
Определения EnWidgets.c:220
Определения DayZPlayerImplement.c:63
Определения EnWidgets.c:190
proto native void SetDate(int year, int month, int day, int hour, int minute)
Sets actual ingame world time.
proto void GetDate(out int year, out int month, out int day, out int hour, out int minute)
Get actual ingame world time.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native float Length()
Returns length of vector (magnitude)
static const vector Zero
Определения EnConvert.c:110
proto string ToString(bool beautify=true)
Vector to string.
Определения EnConvert.c:106
Serializer ParamsReadContext
Определения gameplay.c:15
proto native CGame GetGame()
const int COLOR_BLUE
Определения constants.c:66
const int COLOR_RED
Определения constants.c:64
const int COLOR_GREEN
Определения constants.c:65
array< string > TStringArray
Определения EnScript.c:685
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
const int MENU_LOC_ADD
Определения constants.c:172
proto void GetMousePos(out int x, out int y)
proto native int Length()
Returns length of string.
proto string Get(int index)
Gets n-th character from string.
proto native float ToFloat()
Converts string to float.
proto string Substring(int start, int len)
Substring of 'str' from 'start' position 'len' number of characters.
const int CALL_CATEGORY_SYSTEM
Определения tools.c:8