DayZ 1.29
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(g_Game.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(GetPluginSafe(PluginRemotePlayerDebugClient));
138 if (SHOW_OTHERS && plugin_remote_client && g_Game.GetPlayer())
139 plugin_remote_client.RequestPlayerInfo(PlayerBase.Cast(g_Game.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 g_Game.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 g_Game.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 (g_Game.GetPlayer())
178 {
180 m_DebugMapWidget.SetMapPos(g_Game.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 g_Game.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(GetPluginSafe(PluginRemotePlayerDebugClient));
230 if (SHOW_OTHERS && plugin_remote_client && g_Game.GetPlayer())
231 {
232 plugin_remote_client.RequestPlayerInfo(PlayerBase.Cast(g_Game.GetPlayer()), 1);
234 }
235
236 PluginRemotePlayerDebugServer plugin_remote_server = PluginRemotePlayerDebugServer.Cast(GetPluginSafe(PluginRemotePlayerDebugServer));
237 if (plugin_remote_server)
238 {
239 SHOW_OTHERS = true;
241 m_PlayerDebugStats = plugin_remote_server.m_PlayerDebugStats;
242 }
243
244 }
245
246 void Teleport(PlayerBase player, vector position)
247 {
248 if (position[1] == 0)
249 position[1] = g_Game.SurfaceY(position[0], position[2]);
250 m_Developer.Teleport(player, position);
251 }
252
254 {
255 bool doTeleport, doSetDir;
256 vector pos, dir;
257 string text = m_TeleportXYZ.GetText();
258 string textDir = m_TeleportHeading.GetText();
259
260 array<float> numbersPos = TextToNumbersArray(text);
261 if (numbersPos.Count() != 0)
262 {
263 if (numbersPos.Count() == 1)
264 {
265 pos = vector.Zero;
266 }
267 else if (numbersPos.Count() == 2)
268 {
269 pos = Vector(numbersPos[0], g_Game.SurfaceY(numbersPos[0], numbersPos[1]), numbersPos[1]);
270 }
271 else if (numbersPos.Count() <= 5)
272 {
273 pos = Vector(numbersPos[0], numbersPos[1], numbersPos[2]);
274 }
275 else if (numbersPos.Count() > 5)
276 {
277 pos = Vector(numbersPos[0], numbersPos[1], numbersPos[2]);
278 dir = Vector(numbersPos[3], numbersPos[4], numbersPos[5]);
279
280 Teleport(player, pos);
281 m_LastEditPos = pos;
282 m_TeleportXYZ.SetText(m_LastEditPos.ToString());
283
284 m_Developer.SetDirection(player, dir);
285 m_LastEditDir = dir;
286 m_TeleportHeading.SetText(m_LastEditDir.ToString());
287
288 return;
289 }
290
291 doTeleport = true;
292 }
293 else
295
296 array<float> numbersDir = TextToNumbersArray(textDir);
297 if (numbersDir.Count() != 0)
298 {
299 if (numbersDir.Count() == 1)
300 {
301 dir = vector.Zero;
302 }
303 else if (numbersDir.Count() == 2)
304 {
305 dir = Vector(numbersDir[0], 0, numbersDir[1]);
306 }
307 else if (numbersDir.Count() <= 5)
308 {
309 dir = Vector(numbersDir[0], numbersDir[1], numbersDir[2]);
310 }
311 else if (numbersDir.Count() > 5)
312 {
313 pos = Vector(numbersDir[0], numbersDir[1], numbersDir[2]);
314 dir = Vector(numbersDir[3], numbersDir[4], numbersDir[5]);
315
316 Teleport(player, pos);
317 m_LastEditPos = pos;
318 m_TeleportXYZ.SetText(m_LastEditPos.ToString());
319
320 m_Developer.SetDirection(player, dir);
321 m_LastEditDir = dir;
322 m_TeleportHeading.SetText(m_LastEditDir.ToString());
323
324 return;
325 }
326
327 doSetDir = true;
328 }
329 else
331
332 if (doTeleport)
333 {
334 Teleport(player, pos);
335 m_LastEditPos = pos;
336 }
337
338 if (doSetDir)
339 {
340 m_Developer.SetDirection(player, dir);
341 m_LastEditDir = dir;
342 }
343 }
344
346 {
347 array<float> numbers = new array<float>();
348 int length = text.Length();
349 int numberStart = -1;
350 int numberLen;
351
352 for (int i = 0; i < length; i++) // find numbers and move them to array
353 {
354 string letter = text.Get(i);
355
356 if (numberStart == -1 && NUMERIC_LETTERS.Contains(letter) && letter != ".") // search for number
357 numberStart = i;
358
359 if (numberStart != -1 && (!NUMERIC_LETTERS.Contains(letter) || (letter == "-" && numberStart != i))) // search for number end
360 {
361 numberLen = i - numberStart;
362 numbers.Insert(text.Substring(numberStart, numberLen).ToFloat());
363 numberStart = -1;
364 }
365 else if (numberStart != -1 && (i + 1 == length)) // last letter
366 {
367 numberLen = i - numberStart + 1;
368 numbers.Insert(text.Substring(numberStart, numberLen).ToFloat());
369 numberStart = -1;
370 }
371 }
372
373 return numbers;
374 }
375
377 {
378 m_PositionsListbox.ClearItems();
379
381 m_ConfigDebugProfile.GetLocationsData(locData,true);
382 m_ConfigDebugProfileFixed.GetLocationsData(locData,false);
383 foreach (LocationParams dta: locData)
384 {
385 string name = dta.param1;
386 if (!dta.param2)
387 {
388 name = "[" + name + "]";
389 }
390 m_PositionsListbox.AddItem(name,dta,0);
391 }
392 }
393
395 {
396 string name;
397 LocationParams prms;
399 if (prms)
400 name =prms.param1;
401 return name;
402 }
404 {
405 LocationParams prms;
407 if (prms)
408 return prms.param3;
409 else
410 return vector.Zero;
411 }
412
414 {
415 if (m_PositionsListbox.GetSelectedRow() != -1)
416 {
417 m_PositionsListbox.GetItemData(m_PositionsListbox.GetSelectedRow(), 0, data);
418 }
419 }
420
422 {
423 LocationParams prms;
425 if (prms)
426 return prms.param2;
427 else
428 return false;
429 }
430
432 {
433 return m_PositionsListbox.GetSelectedRow();
434 }
435
437 {
438 return (m_PositionsListbox.GetSelectedRow() != -1);
439 }
440
442
444 {
445 if (!g_Game.GetPlayer())
446 {
447 return;
448 }
449
450 vector playerPos = g_Game.GetPlayer().GetPosition();
451 SetMapPos(playerPos);
452
453 vector playerDir = g_Game.GetPlayer().GetDirection();
454 SetDir(playerDir);
455 }
456
457 void UpdateTime(bool slider_used)
458 {
459 Param5<int,int,int,int,int> p5 = new Param5<int,int,int,int,int>(0,0,0,0,0);
460 int year, month, day, hour, minute;
461
462 year = m_DateYear.GetText().ToInt();
463 month = m_DateMonth.GetText().ToInt();
464 day = m_DateDay.GetText().ToInt();
465
466 if (slider_used)
467 {
468 int time_minutes = Math.Lerp(0, (24*60) - 1, m_TimeSlider.GetCurrent()/100);
469 hour = time_minutes / 60;
470 minute = time_minutes % 60;
471 }
472 else
473 {
474 hour = m_DateHour.GetText().ToInt();
475 minute = m_DateMinute.GetText().ToInt();
476 }
477
478 p5.param1 = year;
479 p5.param2 = month;
480 p5.param3 = day;
481 p5.param4 = hour;
482 p5.param5 = minute;
483
484 RefreshDateWidgets(year, month, day, hour, minute);
485 g_Game.GetWorld().SetDate(year, month, day, hour, minute);
486
487 g_Game.GetMission().GetOnTimeChanged().Invoke();
488
489 if (g_Game.GetPlayer())
490 {
491 g_Game.GetPlayer().RPCSingleParam(ERPCs.DEV_RPC_SET_TIME, p5, true);
492 }
493 }
494
496 {
497 int x,y;
498 GetMousePos(x,y);
499 vector mousePos, worldPos;
500 mousePos[0] = x;
501 mousePos[1] = y;
502 worldPos = m_DebugMapWidget.ScreenToMap(mousePos);
503 worldPos[1] = g_Game.SurfaceY(worldPos[0], worldPos[2]);
504
505 if (m_MouseCurPos)
506 {
507 m_MouseCurPos.SetText("Mouse: "+ MiscGameplayFunctions.TruncateToS(worldPos[0]) +", "+ MiscGameplayFunctions.TruncateToS(worldPos[1]) +", "+ MiscGameplayFunctions.TruncateToS(worldPos[2]));
508 }
509 if (m_PlayerMouseDiff && g_Game.GetPlayer())
510 {
511 vector playerPos = g_Game.GetPlayer().GetWorldPosition();
512 //playerPos[1] = 0;
513 float dst = (worldPos - playerPos).Length();
514
515 m_PlayerMouseDiff.SetText("Distance: " + MiscGameplayFunctions.TruncateToS(dst));
516 }
517 }
518
520 {
521 m_MapPos = pos;
522 m_PlayerCurPos.SetText("Position: "+ MiscGameplayFunctions.TruncateToS(pos[0]) +", "+ MiscGameplayFunctions.TruncateToS(pos[1]) +", "+ MiscGameplayFunctions.TruncateToS(pos[2]));
523 }
524
526 {
527 m_CameraCurPos.SetText("Camera Position: "+ MiscGameplayFunctions.TruncateToS(pos[0]) +", "+ MiscGameplayFunctions.TruncateToS(pos[1]) +", "+ MiscGameplayFunctions.TruncateToS(pos[2]));
528 }
529
530 void SetDir(vector dir)
531 {
532 m_PlayerCurDir.SetText("Direction: "+ MiscGameplayFunctions.TruncateToS(dir[0]) +", "+ MiscGameplayFunctions.TruncateToS(dir[1]) +", "+ MiscGameplayFunctions.TruncateToS(dir[2]));
533 }
534
536 {
537 m_CameraCurDir.SetText("Camera Direction: "+ MiscGameplayFunctions.TruncateToS(dir[0]) +", "+ MiscGameplayFunctions.TruncateToS(dir[1]) +", "+ MiscGameplayFunctions.TruncateToS(dir[2]));
538 }
539
541 {
542 return m_MapPos;
543 }
544
545 override bool OnMouseButtonDown(Widget w, int x, int y, int button)
546 {
547 super.OnMouseButtonDown(w,x,y,button);
548
549 if (w == m_DebugMapWidget)
550 {
551 if (button == 0)
552 {
553 if (m_FreeDebugCamera && m_FreeDebugCamera.IsActive())
554 {
555 SetMapCameraPos(m_FreeDebugCamera.GetWorldPosition());
556 SetCameraDir(m_FreeDebugCamera.GetDirection());
557 }
558 else
559 {
561 int mouseX, mouseY;
562 GetMousePos(mouseX,mouseY);
563 vector mousePos, worldPos;
564 mousePos[0] = mouseX;
565 mousePos[1] = mouseY;
566 worldPos = m_DebugMapWidget.ScreenToMap(mousePos);
567 worldPos[1] = g_Game.SurfaceY(worldPos[0], worldPos[2]);
568 SetMapPos(worldPos);
569 }
570 }
571 else if (button == 1 && g_Game.GetPlayer())
572 {
573 if (m_FreeDebugCamera && m_FreeDebugCamera.IsActive())
574 SetMapCameraPos(m_FreeDebugCamera.GetWorldPosition());
575 else
576 SetMapPos(g_Game.GetPlayer().GetWorldPosition());
577 }
578 }
579 return true;
580 }
581
582 override bool OnKeyDown(Widget w, int x, int y, int key)
583 {
584 super.OnKeyDown(w, x, y, key);
585 return false;
586 }
587
588 override bool OnChange(Widget w, int x, int y, bool finished)
589 {
590 super.OnChange(w, x, y, finished);
591
592 if (w == m_ShowOthers && g_Game.GetPlayer())
593 {
594 if (g_Game.IsDedicatedServer())
595 {
597 SHOW_OTHERS = true;
598 return true;
599 }
600
601 PluginRemotePlayerDebugClient plugin_remote_client = PluginRemotePlayerDebugClient.Cast(GetPluginSafe(PluginRemotePlayerDebugClient));
602 if (m_ShowOthers.IsChecked())
603 {
604 plugin_remote_client.RequestPlayerInfo(PlayerBase.Cast(g_Game.GetPlayer()), 1);
606 SHOW_OTHERS = true;
607 }
608 else
609 {
610 plugin_remote_client.RequestPlayerInfo(PlayerBase.Cast(g_Game.GetPlayer()), 0);
612 SHOW_OTHERS = false;
613 }
614 return true;
615 }
616 else if (w == m_TimeSlider || w == m_DateDay || w == m_DateYear || w == m_DateMonth || w == m_DateHour || w == m_DateMinute)
617 {
619 return true;
620 }
621
622 return false;
623 }
624
625 override bool OnItemSelected(Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
626 {
627 super.OnItemSelected(w, x, y, row, column, oldRow, oldColumn);
628 if (w == m_PositionsListbox)
629 {
630 if (m_InitialOpen)
631 {
632 m_InitialOpen = false;
633 return true;
634 }
635
636 vector position = GetCurrentLocationPos();
637 m_TeleportXYZ.SetText(position.ToString());
639 {
641 }
642
643 return true;
644 }
645 return false;
646 }
647
648 override bool OnDoubleClick(Widget w, int x, int y, int button)
649 {
650 super.OnDoubleClick(w, x, y, button);
651 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
652
653 if (w == m_DebugMapWidget)
654 {
655 vector screen_to_map = m_DebugMapWidget.ScreenToMap(Vector(x,y, 0));
656 float pos_y_a = g_Game.SurfaceY(screen_to_map[0], screen_to_map[2]);
657 float pos_y_b = g_Game.SurfaceRoadY(screen_to_map[0], screen_to_map[2]);
658 float pos_y = Math.Max(pos_y_a, pos_y_b);
659 screen_to_map[1] = pos_y;
660
661 if (m_FreeDebugCamera && m_FreeDebugCamera.IsActive())
662 {
663 vector camPos = m_FreeDebugCamera.GetPosition();
664 float camPosY = camPos[1];
665 screen_to_map[1] = camPosY;
666 m_FreeDebugCamera.SetPosition(screen_to_map);
667 }
668 else
669 {
670 m_Developer.Teleport(player, screen_to_map);
671 }
672
673 return true;
674 }
675
676 if (w == m_PositionsListbox)
677 {
678 vector position = GetCurrentLocationPos();
679 if (m_FreeDebugCamera && m_FreeDebugCamera.IsActive())
680 {
681 m_FreeDebugCamera.SetPosition(position);
682 }
683 else
684 {
685 Teleport(player, position);
686 }
687 return true;
688 }
689
690 if (w == m_TeleportHeading)
691 {
692 EditBoxWidget.Cast(w).SetText("");
693 return true;
694 }
695
696 if (w == m_TeleportXYZ)
697 {
698 EditBoxWidget.Cast(w).SetText("");
699 return true;
700 }
701 return false;
702 }
703
704 override bool OnClick(Widget w, int x, int y, int button)
705 {
706 super.OnClick(w, x, y, button);
707
708 int i;
709 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
710
711 PluginDeveloper module_dev = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
712
713 if (w == m_PositionsListbox)
714 {
715
716 vector position = GetCurrentLocationPos();
717
719 {
721 }
722
723 return true;
724 }
725 else if (w == m_TeleportButton)
726 {
727 ProcessTeleportText(player);
728 return true;
729 }
730 else if (w == m_ButtonCopyPos)
731 {
732 if (m_IsShiftDown)
733 {
734 g_Game.CopyToClipboard(GetMapPos().ToString(false));
735 return true;
736 }
737
738
739 g_Game.CopyToClipboard(GetMapPos().ToString() + " " + g_Game.GetPlayer().GetDirection().ToString());
740 return true;
741 }
742 else if (w == m_LogsEnabled)
743 {
744 //Log("m_LogsEnabled: "+ToString(m_LogsEnabled.IsChecked()));
745
747 {
748 m_ConfigDebugProfile.SetLogsEnabled(m_LogsEnabled.IsChecked());
750 }
751
752 return true;
753 }
754 else if (w == m_HudDCharStats)
755 {
757 {
758 m_ConfigDebugProfile.SetCharacterStatsVisible(m_HudDCharStats.IsChecked());
759 }
760
761 // Refresh UI by new settings
762 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
763
764 return true;
765 }
766 else if (w == m_HudDCharLevels)
767 {
769 {
770 m_ConfigDebugProfile.SetCharacterLevelsVisible(m_HudDCharLevels.IsChecked());
771 }
772
773 // Refresh UI by new settings
774 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
775
776 return true;
777 }
778 else if (w == m_HudDCharStomach)
779 {
781 {
782 m_ConfigDebugProfile.SetCharacterStomachVisible(m_HudDCharStomach.IsChecked());
783 }
784
785 // Refresh UI by new settings
786 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
787
788 return true;
789 }
790 else if (w == m_HudDVersion)
791 {
793 {
794 m_ConfigDebugProfile.SetVersionVisible(m_HudDVersion.IsChecked());
795 }
796
797 // Refresh UI by new settings
798 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
799
800 return true;
801 }
802 else if (w == m_HudDTemperature)
803 {
805 {
806 m_ConfigDebugProfile.SetTempVisible(m_HudDTemperature.IsChecked());
807 }
808
809 // Refresh UI by new settings
810 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
811
812 return true;
813 }
814 else if (w == m_HudDHealth)
815 {
817 {
818 m_ConfigDebugProfile.SetHealthVisible(m_HudDHealth.IsChecked());
819 }
820
821 // Refresh UI by new settings
822 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
823
824 return true;
825 }
826 else if (w == m_HudDHorticulture)
827 {
829 {
830 m_ConfigDebugProfile.SetHorticultureVisible(m_HudDHorticulture.IsChecked());
831 }
832
833 // Refresh UI by new settings
834 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
835
836 return true;
837 }
838 else if (w == m_HudDCharModifiers)
839 {
841 {
842 m_ConfigDebugProfile.SetCharacterModifiersVisible(m_HudDCharModifiers.IsChecked());
843 }
844
845 // Refresh UI by new settings
846 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
847
848 return true;
849 }
850 else if (w == m_HudDCharAgents)
851 {
853 {
854 m_ConfigDebugProfile.SetCharacterAgentsVisible(m_HudDCharAgents.IsChecked());
855 }
856
857 // Refresh UI by new settings
858 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
859
860 return true;
861 }
862 else if (w == m_HudDCharDebug)
863 {
865 {
866 m_ConfigDebugProfile.SetCharacterDebugVisible(m_HudDCharDebug.IsChecked());
867 }
868
869 // Refresh UI by new settings
870 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
871
872 return true;
873 }
874 else if (w == m_HudDFreeCamCross)
875 {
877 {
878 m_ConfigDebugProfile.SetFreeCameraCrosshairVisible(m_HudDFreeCamCross.IsChecked());
879 }
880
881 // Refresh UI by new settings
882 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
883
884 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).Call(g_Game.GetMission().RefreshCrosshairVisibility);
885
886 return true;
887 }
888
889 else if (w == m_DiagToggleButton)
890 {
891 int toggle_row_index = m_DiagToggleTextListbox.GetSelectedRow();
892 bool toggle_state = g_Game.GetDiagModeEnable(toggle_row_index);
893 g_Game.SetDiagModeEnable(toggle_row_index, !toggle_state);
894 return true;
895 }
896 else if (w == m_DiagDrawButton)
897 {
898 int draw_row_index = m_DiagDrawmodeTextListbox.GetSelectedRow();
899 g_Game.SetDiagDrawMode(draw_row_index);
900 return true;
901 }
902 // TOUCHED THIS
903 else if (w == m_LocationAddButton)
904 {
905 ScriptConsoleAddLocation menu = ScriptConsoleAddLocation.Cast(g_Game.GetUIManager().EnterScriptedMenu(MENU_LOC_ADD, m_ScriptConsole));
906 menu.SetPosition(GetMapPos());
907 return true;
908 }
909 else if (w == m_LocationRemoveButton)
910 {
911 m_ConfigDebugProfile.CustomLocationsRemove(GetCurrentLocationName());
913 return true;
914 }
915 return false;
916 }
917
918 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
919 {
920 super.OnRPCEx(rpc_type, ctx);
921 #ifdef DIAG_DEVELOPER
922 switch (rpc_type)
923 {
924 case ERPCs.DEV_PLAYER_DEBUG_DATA:
925 {
927 break;
928 }
929 }
930 #endif
931 }
932
933 override void Update(float timeslice)
934 {
935 super.Update(timeslice);
936
937 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
938
939 m_DebugMapWidget.ClearUserMarks();
940
941 vector playerPos = vector.Zero;
942 if (player)
943 {
944 playerPos = player.GetWorldPosition();
945 }
946
948 {
949 PluginRemotePlayerDebugServer plugin_remote_server = PluginRemotePlayerDebugServer.Cast(GetPluginSafe(PluginRemotePlayerDebugServer));
950 if (plugin_remote_server)
951 {
952 plugin_remote_server.GatherPlayerInfo();
953
954 if (m_FreeDebugCamera && m_FreeDebugCamera.IsActive())
955 {
956 playerPos = m_FreeDebugCamera.GetWorldPosition();
957 }
958 }
959
961 {
962 if (player && rpd.m_Player != player)
963 {
964 vector dir = rpd.m_Pos - playerPos;
965 dir[1] = 0;
966 string dist = ((int)dir.Length()).ToString();
967 string text = rpd.m_Name + " " +dist + "m";
968 m_DebugMapWidget.AddUserMark(rpd.m_Pos, text, COLOR_BLUE, "\\dz\\gear\\navigation\\data\\map_tree_ca.paa");
969 }
970 }
971 }
972
973 if (player)
974 {
975 m_DebugMapWidget.AddUserMark(playerPos, "You", COLOR_RED, "\\dz\\gear\\navigation\\data\\map_tree_ca.paa");
976 if (playerPos != GetMapPos())
977 m_DebugMapWidget.AddUserMark(GetMapPos(), "Pos", COLOR_BLUE, "\\dz\\gear\\navigation\\data\\map_tree_ca.paa");
978 }
979
980 if (m_FreeDebugCamera && m_FreeDebugCamera.IsActive())
981 {
982 vector cameraPos = m_FreeDebugCamera.GetWorldPosition();
983 m_DebugMapWidget.AddUserMark(cameraPos, "Camera", COLOR_GREEN, "\\dz\\gear\\navigation\\data\\map_tree_ca.paa");
984 }
985
989
990 foreach (MapMarker marker: ScriptConsole.m_MarkedEntities)
991 {
993 }
994 }
995}
Param3 int
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
DayZGame g_Game
Определения DayZGame.c:3942
ERPCs
Определения ERPCs.c:2
proto string ToString()
Icon x
Icon y
Param3< string, bool, vector > LocationParams
Определения PluginConfigDebugProfile.c:25
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:325
PluginBase GetPluginSafe(typename plugin_type)
Определения PluginManager.c:349
void RemotePlayerStatDebug(PlayerBase player)
Определения RemotePlayerStatDebug.c:16
Определения EnWidgets.c:354
static void SetLogsEnabled(bool enable)
Определения 3_Game/DayZ/tools/Debug.c:731
static string GetMarkerTypeFromID(int id)
Определения MapMarkersInfo.c:36
Определения MapMarkersInfo.c:2
Определения gameplay.c:323
Определения EnMath.c:7
Определения PlayerBaseClient.c:2
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:535
int GetCurrentPositionIndex()
Определения ScriptConsoleGeneralTab.c:431
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:648
void SetMapCameraPos(vector pos)
Определения ScriptConsoleGeneralTab.c:525
static float DEBUG_MAP_ZOOM
Определения ScriptConsoleGeneralTab.c:7
bool IsCurrentPositionCustom()
Определения ScriptConsoleGeneralTab.c:421
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:704
CheckBoxWidget m_HudDCharStomach
Определения ScriptConsoleGeneralTab.c:44
CheckBoxWidget m_HudDVersion
Определения ScriptConsoleGeneralTab.c:49
vector GetCurrentLocationPos()
Определения ScriptConsoleGeneralTab.c:403
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:545
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:588
TextWidget m_PlayerCurDir
Определения ScriptConsoleGeneralTab.c:59
SliderWidget m_TimeSlider
Определения ScriptConsoleGeneralTab.c:19
void ProcessTeleportText(PlayerBase player)
Определения ScriptConsoleGeneralTab.c:253
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:530
void Teleport(PlayerBase player, vector position)
Определения ScriptConsoleGeneralTab.c:246
CheckBoxWidget m_HudDCharDebug
Определения ScriptConsoleGeneralTab.c:47
void GetCurrentPositionData(out LocationParams data)
Определения ScriptConsoleGeneralTab.c:413
CheckBoxWidget m_HudDFreeCamCross
Определения ScriptConsoleGeneralTab.c:48
CheckBoxWidget m_HudDTemperature
Определения ScriptConsoleGeneralTab.c:55
void UpdateTime(bool slider_used)
Определения ScriptConsoleGeneralTab.c:457
override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
Определения ScriptConsoleGeneralTab.c:918
string GetCurrentLocationName()
Определения ScriptConsoleGeneralTab.c:394
TextWidget m_MouseCurPos
Определения ScriptConsoleGeneralTab.c:60
TextWidget m_PlayerMouseDiff
Определения ScriptConsoleGeneralTab.c:61
override void Update(float timeslice)
Определения ScriptConsoleGeneralTab.c:933
array< float > TextToNumbersArray(string text)
Определения ScriptConsoleGeneralTab.c:345
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:625
ButtonWidget m_DiagToggleButton
Определения ScriptConsoleGeneralTab.c:39
bool IsCurrentPositionValid()
Определения ScriptConsoleGeneralTab.c:436
override bool OnKeyDown(Widget w, int x, int y, int key)
Определения ScriptConsoleGeneralTab.c:582
void RefreshPlayerPosEditBoxes()
Определения ScriptConsoleGeneralTab.c:443
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:519
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:39
Определения EnWidgets.c:190
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native float Length()
Returns length of vector (magnitude)
static const vector Zero
Определения EnConvert.c:123
proto string ToString(bool beautify=true)
Vector to string.
Определения EnConvert.c:119
Serializer ParamsReadContext
Определения gameplay.c:15
const int COLOR_BLUE
Определения 1_Core/DayZ/constants.c:66
const int COLOR_RED
Определения 1_Core/DayZ/constants.c:64
const int COLOR_GREEN
Определения 1_Core/DayZ/constants.c:65
array< string > TStringArray
Определения EnScript.c:712
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
Определения 3_Game/DayZ/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
Определения 3_Game/DayZ/tools/tools.c:8