DayZ 1.24
Loading...
Searching...
No Matches
PluginDayzPlayerDebug_Ctrl.c
Go to the documentation of this file.
1
2
3// *************************************************************************************
4// ! PluginDayzPlayerDebug_Ctrl
5// *************************************************************************************
7{
9
14 //
15
18
19
20 //---------------------------------------------------
21 // gui stuff
22
30
31
36
37
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
47 {
48 }
49
50
51 //---------------------------------------------------
52 // main update
53
54
55 /* void Tick()
56 {
57 DayZPlayer player = DayZPlayer.Cast( GetGame().GetPlayer() );
58 if (!player)
59 {
60 return;
61 }
62
63 if (player)
64 {
65 }
66 } */
67
68
69 //---------------------------------------------------
70 // window ui clicks
71
73 bool OnClick(Widget w, int x, int y, int button)
74 {
75 if (w == m_ForceStance)
76 {
77 Print("Stance changed");
78 m_ApplyStanceChange = m_ForceStance.GetCurrentItem() - 1;
79 return true;
80 }
81 else if (w == m_MovOverrideCheckbox)
82 {
83 Print("Movement override");
85 }
86
87
88 return false;
89 }
90
91 bool OnChange(Widget w, int x, int y, bool finished)
92 {
93 if (w == m_MovSpeedEB || w == m_MovDirEB)
94 {
95 Print("Movement override");
97 return true;
98 }
99
100 return false;
101 }
102
103 //---------------------------------------------------
104 // Global handler to handle commands from player
105
107 {
108 if (m_ApplyStanceChange != -2)
109 {
111 if (!player)
112 return;
113
114 HumanCommandMove cm = player.GetCommand_Move();
115 if (cm)
116 {
117 cm.ForceStance(m_ApplyStanceChange);
119 }
120 }
122 {
124
126 if (!player)
127 return;
128
129 float speed = m_MovSpeedEB.GetText().ToFloat();
130 float dir = m_MovDirEB.GetText().ToFloat();
131 player.GetInputController().OverrideMovementSpeed(m_MovOverrideCheckbox.IsChecked(), speed);
132 player.GetInputController().OverrideMovementAngle(m_MovOverrideCheckbox.IsChecked(), dir);
133 }
134 }
135}
Icon x
Icon y
PlayerBase GetPlayer()
void PluginDayzPlayerDebug_Ctrl(Widget pMainWnd)
bool OnClick(Widget w, int x, int y, int button)
buttons clicks
bool OnChange(Widget w, int x, int y, bool finished)
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.