DayZ 1.24
Loading...
Searching...
No Matches
PluginDayzPlayerDebug_OtherCmds.c
Go to the documentation of this file.
1// *************************************************************************************
2// ! PluginDayzPlayerDebug_OtherCmds
3// *************************************************************************************
4
6{
7 // widgets
9
13
16
20
21 // command handler properties
22 bool m_CH_DeathStart = false;
23 bool m_CH_HitStart = false;
24 bool m_CH_UnconStart = false;
25 bool m_CH_UnconEnd = false;
26
27
28 //---------------------------------------------------
29 // gui stuff
30
36
37
42
43
45 {
46 m_DeathTypeCB = XComboBoxWidget.Cast(m_MainWnd.FindAnyWidget("DeathTypeCB"));
47 m_DeathDirectionEdit = EditBoxWidget.Cast(m_MainWnd.FindAnyWidget("DeathDirectionEdit"));
48 m_DeathStartButton = ButtonWidget.Cast(m_MainWnd.FindAnyWidget("DeathStartButton"));
49
50 m_HitTypeCB = XComboBoxWidget.Cast(m_MainWnd.FindAnyWidget("HitTypeCB"));
51 m_HitStartButton = ButtonWidget.Cast(m_MainWnd.FindAnyWidget("HitStartButton"));
52
53 m_UnconTypeCB = XComboBoxWidget.Cast(m_MainWnd.FindAnyWidget("UnconTypeCB"));
54 m_UnconStartButton = ButtonWidget.Cast(m_MainWnd.FindAnyWidget("UnconStartButton"));
55 m_UnconEndButton = ButtonWidget.Cast(m_MainWnd.FindAnyWidget("UnconEndButton"));
56 }
57
59 {
60 }
61
62 //---------------------------------------------------
63 // window ui clicks
64
66 bool OnClick(Widget w, int x, int y, int button)
67 {
68 if (w == m_DeathStartButton)
69 {
70 Print("PluginPlayerDebug: Death Start");
71 m_CH_DeathStart = true;
72 return true;
73 }
74 else if (w == m_HitStartButton)
75 {
76 Print("PluginPlayerDebug: Uncon Start");
77 m_CH_HitStart = true;
78 return true;
79 }
80 else if (w == m_UnconStartButton)
81 {
82 Print("PluginPlayerDebug: Uncon Start");
83 m_CH_UnconStart = true;
84 return true;
85 }
86 else if (w == m_UnconEndButton)
87 {
88 Print("PluginPlayerDebug: Uncon End");
89 m_CH_UnconEnd = true;
90 return true;
91 }
92
93 return false;
94 }
95
96
97 //---------------------------------------------------
98 // Global handler to handle commands from player
99
101 {
102 if (m_CH_DeathStart)
103 {
104 Death_Start();
105 m_CH_DeathStart = false;
106 }
107 if (m_CH_HitStart)
108 {
109 Hit_Start();
110 m_CH_HitStart = false;
111 }
112 if (m_CH_UnconStart)
113 {
114 Uncon_Start();
115 m_CH_UnconStart = false;
116 }
117 if (m_CH_UnconEnd)
118 {
119 Uncon_End();
120 m_CH_UnconEnd = false;
121 }
122 }
123
124 //---------------------------------------------------
125 // Commands start functions
126
128 {
130 if (!player)
131 return;
132
133 int deathType = m_DeathTypeCB.GetCurrentItem();
134 if (deathType > 0)
135 deathType += 9;
136
137 float deathDirection = m_DeathDirectionEdit.GetText().ToInt();
138
139
141 }
142
144 {
146 if (!player)
147 return;
148
149 float hitDirection = m_DeathDirectionEdit.GetText().ToInt();
150 int hitType = m_HitTypeCB.GetCurrentItem();
151 if (hitType == 0)
152 player.AddCommandModifier_Damage(0, hitDirection);
153 else
154 player.StartCommand_Damage(0, hitDirection);
155 }
156
158 {
160 if (!player)
161 return;
162
163 int type = m_UnconTypeCB.GetCurrentItem();
164
165 player.m_UnconsciousDebug = true;
166 player.StartCommand_Unconscious(type);
167 }
168
170 {
172 if (!player)
173 return;
174
175 player.m_UnconsciousDebug = false;
176 HumanCommandUnconscious hcu = player.GetCommand_Unconscious();
177 if (hcu)
178 hcu.WakeUp();
179 }
180}
Icon x
Icon y
PlayerBase GetPlayer()
bool OnClick(Widget w, int x, int y, int button)
buttons clicks
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.