Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
plugindayzplayerdebug_ctrl.c
Go to the documentation of this file.
1
2
3// *************************************************************************************
4// ! PluginDayzPlayerDebug_Ctrl
5// *************************************************************************************
7{
8 Widget m_MainWnd;
9
10 XComboBoxWidget m_ForceStance;
11 EditBoxWidget m_MovSpeedEB;
12 EditBoxWidget m_MovDirEB;
13 CheckBoxWidget m_MovOverrideCheckbox;
14 //
15
16 int m_ApplyStanceChange;
17 bool m_OverrideMovementChange = false;
18
19
20 //---------------------------------------------------
21 // gui stuff
22
23 void PluginDayzPlayerDebug_Ctrl(Widget pMainWnd)
24 {
25 m_MainWnd = pMainWnd;
26 m_ApplyStanceChange = -2;
27
28 CreateModuleWidgets();
29 }
30
31
33 {
34 DestroyModuleWidgets();
35 }
36
37
38 void CreateModuleWidgets()
39 {
40 m_ForceStance = XComboBoxWidget.Cast( m_MainWnd.FindAnyWidget("StanceV") );
41 m_MovSpeedEB = EditBoxWidget.Cast( m_MainWnd.FindAnyWidget("MovSpeedEB") );
42 m_MovDirEB = EditBoxWidget.Cast( m_MainWnd.FindAnyWidget("MovDirEB") );
43 m_MovOverrideCheckbox = CheckBoxWidget.Cast( m_MainWnd.FindAnyWidget("OverrideMovCheckBox") );
44 }
45
46 void DestroyModuleWidgets()
47 {
48 }
49
50
51
52 //---------------------------------------------------
53 // main update
54
55
56 /* void Tick()
57 {
58 DayZPlayer player = DayZPlayer.Cast( GetGame().GetPlayer() );
59 if (!player)
60 {
61 return;
62 }
63
64 if (player)
65 {
66 }
67 } */
68
69
70 //---------------------------------------------------
71 // window ui clicks
72
74 bool OnClick(Widget w, int x, int y, int button)
75 {
76 if (w == m_ForceStance)
77 {
78 Print("Stance changed");
79 m_ApplyStanceChange = m_ForceStance.GetCurrentItem() - 1;
80 return true;
81 }
82 else if (w == m_MovOverrideCheckbox)
83 {
84 Print("Movement override");
85 m_OverrideMovementChange = true;
86 }
87
88
89 return false;
90 }
91
92 bool OnChange(Widget w, int x, int y, bool finished)
93 {
94 if( w == m_MovSpeedEB || w == m_MovDirEB )
95 {
96 Print("Movement override");
97 m_OverrideMovementChange = true;
98 return true;
99 }
100
101 return false;
102 }
103
104 //---------------------------------------------------
105 // Global handler to handle commands from player
106
107 void CommandHandler()
108 {
109 if (m_ApplyStanceChange != -2)
110 {
111 DayZPlayer player = DayZPlayer.Cast( GetGame().GetPlayer() );
112 if (!player)
113 {
114 return;
115 }
116
117 HumanCommandMove cm = player.GetCommand_Move();
118 if (cm)
119 {
120 cm.ForceStance(m_ApplyStanceChange);
121 m_ApplyStanceChange = -2;
122 }
123 }
124 if (m_OverrideMovementChange)
125 {
126 m_OverrideMovementChange = false;
127
128 player = DayZPlayer.Cast( GetGame().GetPlayer() );
129 if (!player)
130 return;
131
132 float speed = m_MovSpeedEB.GetText().ToFloat();
133 float dir = m_MovDirEB.GetText().ToFloat();
134 player.GetInputController().OverrideMovementSpeed(m_MovOverrideCheckbox.IsChecked(), speed);
135 player.GetInputController().OverrideMovementAngle(m_MovOverrideCheckbox.IsChecked(), dir);
136 }
137 }
138}
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.
Icon x
Icon y
PlayerBase GetPlayer()
Widget m_MainWnd