DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
PluginDayZInfectedDebug.c
Go to the documentation of this file.
1// *************************************************************************************
2// ! PluginDayZInfectedDebugUIHandler
3// *************************************************************************************
4class PluginDayZInfectedDebugUIHandler extends ScriptedWidgetEventHandler
5{
6 override bool OnClick(Widget w, int x, int y, int button)
7 {
8 super.OnClick(w, x, y, button);
9 return m_pPluginInfectedDebug.OnClick(w, x, y, button);
10 }
11
12 override bool OnChange(Widget w, int x, int y, bool finished)
13 {
14 super.OnChange(w, x, y, finished);
15 return m_pPluginInfectedDebug.OnChange(w, x, y, finished);
16 }
17
18 PluginDayZInfectedDebug m_pPluginInfectedDebug;
19}
20
21// *************************************************************************************
22// ! PluginDayZInfectedDebugAttackDesc
23// *************************************************************************************
25{
26 void PluginDayZInfectedDebugAttackDesc(string pName, int pValue)
27 {
28 name = pName;
29 animValue = pValue;
30 }
31
32 string name;
34}
35
36// *************************************************************************************
37// ! PluginDayZInfectedDebug
38// *************************************************************************************
39class PluginDayZInfectedDebug extends PluginBase
40{
42 bool m_HasFocus = false;
43 bool m_IsActive = false;
44
47 ButtonWidget m_SpawnEntityButton;
49 ButtonWidget m_CardFightButton;
53
55 XComboBoxWidget m_StanceCB;
56 XComboBoxWidget m_MindStateCB;
57 EditBoxWidget m_MovementSpeedEB;
58
59 ButtonWidget m_StartTurnButton;
60 XComboBoxWidget m_TurnTypeCB;
61 EditBoxWidget m_TurnDirectionEB;
62
63 XComboBoxWidget m_VaultingCB;
64 ButtonWidget m_StartVaultButton;
65 ButtonWidget m_KnucleOutButton;
66
67 XComboBoxWidget m_CrawlingTypeCB;
69
71 EditBoxWidget m_HitDirEB;
72 XComboBoxWidget m_HitTypeCB;
73 XComboBoxWidget m_HitBodyPartCB;
74 ButtonWidget m_StartHitButton;
75
76 XComboBoxWidget m_DeathTypeCB;
77 ButtonWidget m_StartDeathButton;
78
79 XComboBoxWidget m_AttackTypeCB;
80 XComboBoxWidget m_AttackDirCB;
81 ButtonWidget m_StartAttackButton;
82
85
87 bool m_CH_DoTurn = false;
88 bool m_CH_DoVault = false;
89 bool m_CH_DoKnucleOut = false;
90 bool m_CH_GoToCrawl = false;
91 bool m_CH_DoHit = false;
92 bool m_CH_StartDeath = false;
93 bool m_CH_DoAttack = false;
94
95 ref PluginDayZInfectedDebugUIHandler m_pUIHandler;
97
100
102 {
103 #ifndef NO_GUI
105 #endif
106 }
107
109 {
110 #ifndef NO_GUI
112 #endif
113 }
114
117 {
119 if (m_CurrentMode > 2)
120 {
121 m_CurrentMode = 0;
122 }
123
125 }
126
129 {
130 switch (pMode)
131 {
132 case 0: Hide(); ReleaseFocus(); break;
133 case 1: Show(); ReleaseFocus(); break;
134 case 2: Show(); CaptureFocus(); break;
135 }
136 }
137
140 {
141 if (!m_HasFocus)
142 {
145 m_HasFocus = true;
146 }
147 }
148
151 {
152 if (m_HasFocus)
153 {
156 m_HasFocus = false;
157 }
158 }
159
161 void Show()
162 {
163 ShowWidgets(true);
164 m_IsActive = true;
165
166 GetUApi().ActivateExclude("menu");
168
169 if (!m_TickTimer)
170 {
171 m_TickTimer = new Timer();
172 m_TickTimer.Run(0.1, this, "Tick", NULL, true);
173 }
174 }
175
177 void Hide()
178 {
179 ShowWidgets(false);
180 m_IsActive = false;
181
183
184 m_TickTimer = NULL;
185 }
186
188 void ShowWidgets(bool show)
189 {
190 if(m_MainWnd)
191 {
192 m_MainWnd.Show(show);
193 }
194 }
195
198 {
199 if (!m_pUIHandler)
200 {
201 m_pUIHandler = new PluginDayZInfectedDebugUIHandler();
202 m_pUIHandler.m_pPluginInfectedDebug = this;
203 }
204
205 if (!m_MainWnd)
206 {
207 m_MainWnd = GetGame().GetWorkspace().CreateWidgets("gui/layouts/debug/day_z_infecteddebug.layout");
208 m_MainWnd.SetHandler(m_pUIHandler);
209 m_MainWnd.Show(false);
210 }
211
213 m_SpawnEntityButton = ButtonWidget.Cast( m_MainWnd.FindAnyWidget("SpawnEntityButton") );
214 m_CardMovementButton = ButtonWidget.Cast( m_MainWnd.FindAnyWidget("CardMovementButton") );
215 m_CardFightButton = ButtonWidget.Cast( m_MainWnd.FindAnyWidget("CardFightButton") );
216 m_CardMovementFrame = m_MainWnd.FindAnyWidget("CardMovementFrame");
217 m_CardFightFrame = m_MainWnd.FindAnyWidget("CardFightFrame");
218 m_StatusText = TextWidget.Cast( m_MainWnd.FindAnyWidget("StatusText") );
219
221 m_StanceCB = XComboBoxWidget.Cast( m_MainWnd.FindAnyWidget("StanceCB") );
222 m_MindStateCB = XComboBoxWidget.Cast( m_MainWnd.FindAnyWidget("MindStateCB") );
223 m_MovementSpeedEB = EditBoxWidget.Cast( m_MainWnd.FindAnyWidget("MovementSpeedEB") );
224
225 m_StartTurnButton = ButtonWidget.Cast( m_MainWnd.FindAnyWidget("StartTurnButton") );
226 m_TurnTypeCB = XComboBoxWidget.Cast( m_MainWnd.FindAnyWidget("TurnTypeCB") );
227 m_TurnDirectionEB = EditBoxWidget.Cast( m_MainWnd.FindAnyWidget("TurnDirectionEB") );
228
229 m_VaultingCB = XComboBoxWidget.Cast( m_MainWnd.FindAnyWidget("TurnTypeCB") );
230 m_StartVaultButton = ButtonWidget.Cast( m_MainWnd.FindAnyWidget("StartVaultButton") );
231 m_KnucleOutButton = ButtonWidget.Cast( m_MainWnd.FindAnyWidget("KnucleOutButton") );
232
233 m_CrawlingTypeCB = XComboBoxWidget.Cast( m_MainWnd.FindAnyWidget("TurnTypeCB") );
234 m_StartCrawlingButton = ButtonWidget.Cast( m_MainWnd.FindAnyWidget("StartCrawlingButton") );
235
237 m_HitDirEB = EditBoxWidget.Cast( m_MainWnd.FindAnyWidget("HitDirEB") );
238 m_HitTypeCB = XComboBoxWidget.Cast( m_MainWnd.FindAnyWidget("HitTypeCB") );
239 m_HitBodyPartCB = XComboBoxWidget.Cast( m_MainWnd.FindAnyWidget("HitBodyPartCB") );
240 m_StartHitButton = ButtonWidget.Cast( m_MainWnd.FindAnyWidget("StartHitButton") );
241
242 m_DeathTypeCB = XComboBoxWidget.Cast( m_MainWnd.FindAnyWidget("DeathTypeCB") );
243 m_StartDeathButton = ButtonWidget.Cast( m_MainWnd.FindAnyWidget("StartDeathButton") );
244
245 m_AttackTypeCB = XComboBoxWidget.Cast( m_MainWnd.FindAnyWidget("AttackTypeCB") );
246 m_AttackDirCB = XComboBoxWidget.Cast( m_MainWnd.FindAnyWidget("AttackDirCB") );
247 m_StartAttackButton = ButtonWidget.Cast( m_MainWnd.FindAnyWidget("StartAttackButton") );
248
250 InitAttacks();
251
252 ShowCard(0);
253 }
254
257 {
258 delete m_MainWnd;
259 }
260
262 void ShowCard(int pCard)
263 {
264 m_CardMovementFrame.Show(pCard == 0);
265 m_CardFightFrame.Show(pCard == 1);
266 }
267
269 bool OnClick(Widget w, int x, int y, int button)
270 {
271 if( !m_HasFocus )
272 return false;
273
274 if( w == m_SpawnEntityButton )
275 {
276 ResetValues();
278 return true;
279 }
280 if( w == m_CardMovementButton )
281 {
282 ShowCard(0);
283 return true;
284 }
285 else if( w == m_CardFightButton )
286 {
287 ShowCard(1);
288 return true;
289 }
290 else if( w == m_StartTurnButton )
291 {
292 m_CH_DoTurn = true;
293 return true;
294 }
295 else if( w == m_StartVaultButton )
296 {
297 m_CH_DoVault = true;
298 return true;
299 }
300 else if( w == m_KnucleOutButton )
301 {
302 m_CH_DoKnucleOut = true;
303 return true;
304 }
305 else if( w == m_StartCrawlingButton )
306 {
307 m_CH_GoToCrawl = true;
308 return true;
309 }
310 else if( w == m_StartHitButton )
311 {
312 m_CH_DoHit = true;
313 return true;
314 }
315 else if( w == m_StartDeathButton )
316 {
317 m_CH_StartDeath = true;
318 return true;
319 }
320 else if( w == m_StartAttackButton )
321 {
322 m_CH_DoAttack = true;
323 return true;
324 }
325
326 return false;
327 }
328
330 bool OnChange(Widget w, int x, int y, bool finished)
331 {
332 return false;
333 }
334
337 {
338 }
339
342 {
343 m_ControlledInfected = DayZInfected.Cast(GetGame().CreateObject("ZmbF_JournalistNormal_Blue", GetGame().GetPlayer().GetPosition(), 0, true));
344 m_ControlledInfected.GetAIAgent().SetKeepInIdle(true);
345 }
346
349 {
350 if( infected != m_ControlledInfected )
351 return;
352
353 infected.GetInputController().OverrideMovementSpeed(true, m_MovementSpeedEB.GetText().ToFloat());
354
355 DayZInfectedCommandMove moveCommand = infected.GetCommand_Move();
356 if( moveCommand )
357 {
358 moveCommand.SetStanceVariation(m_StanceCB.GetCurrentItem());
359 moveCommand.SetIdleState(m_MindStateCB.GetCurrentItem());
360 }
361
362 if( m_CH_DoTurn )
363 {
364 moveCommand.StartTurn(m_TurnDirectionEB.GetText().ToFloat(), m_TurnTypeCB.GetCurrentItem());
365 m_CH_DoTurn = false;
366 }
367 if( m_CH_DoVault )
368 {
369 infected.StartCommand_Vault(m_VaultingCB.GetCurrentItem());
370 m_CH_DoVault = false;
371 }
372 if( m_CH_DoKnucleOut )
373 {
374 infected.StartCommand_Vault(-1);
375 m_CH_DoKnucleOut = false;
376 }
377 if( m_CH_GoToCrawl )
378 {
379 infected.StartCommand_Crawl(m_CrawlingTypeCB.GetCurrentItem());
380 m_CH_GoToCrawl = false;
381 }
382 if( m_CH_DoHit )
383 {
384 float hitDir = m_HitDirEB.GetText().ToFloat();
385 int bodyPart = m_HitBodyPartCB.GetCurrentItem();
386 bool heavyHit = m_HitTypeCB.GetCurrentItem() == 1;
387
388 infected.StartCommand_Hit(heavyHit, bodyPart, hitDir);
389
390 m_CH_DoHit = false;
391 }
392 if( m_CH_StartDeath )
393 {
394 int deathType = m_DeathTypeCB.GetCurrentItem();
395 float deathDir = m_HitDirEB.GetText().ToFloat();
396
397 infected.StartCommand_Death(deathType, deathDir);
398
399 m_CH_StartDeath = false;
400 }
401 if( m_CH_DoAttack )
402 {
403 float attackDir = m_AttackDirCB.GetCurrentItem();
404 int attackType = m_AttackDescriptors.Get(m_AttackTypeCB.GetCurrentItem()).animValue;
405
406 infected.StartCommand_Attack(null, attackType, attackDir);
407
408 m_CH_DoAttack = false;
409 }
410 }
411
413 void Tick()
414 {
415 if( !m_ControlledInfected )
416 return;
417
418 }
419
422 {
423 m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Attack Left Light", 0));
424 m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Attack Right Light", 1));
425 m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Attack Left Heavy", 2));
426 m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Attack Right Heavy", 3));
427
428 m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Crawl Attack", 7));
429 //m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Crawl Attack Combo", 8));
430
431 //m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Door Push Attack", 9));
432 //m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Door Head Attack", 10));
433 //m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Door Shoulder Attack", 11));
434 //m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Door LR Attack", 12));
435 //m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Door Kick Attack", 13));
436 //m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Door Charge R", 14));
437 //m_AttackDescriptors.Insert(new PluginDayZInfectedDebugAttackDesc("Door Charge L", 15));
438
439 for( int i = 0; i < m_AttackDescriptors.Count(); ++i )
440 {
441 m_AttackTypeCB.AddItem(m_AttackDescriptors.Get(i).name);
442 }
443 }
444}
445
Icon x
Icon y
bool m_IsActive
PlayerBase GetPlayer()
ref Timer m_TickTimer
string name
class PluginDayZInfectedDebugUIHandler extends ScriptedWidgetEventHandler PluginDayZInfectedDebugAttackDesc(string pName, int pValue)
PluginDayZInfectedDebug m_pPluginInfectedDebug
Widget m_MainWnd
int m_CurrentMode
ref PluginDayzPlayerDebugUIHandler m_pUIHandler
bool m_HasFocus
proto native UAInputAPI GetUApi()
class JsonUndergroundAreaTriggerData GetPosition
proto native Input GetInput()
proto native UIManager GetUIManager()
proto native WorkspaceWidget GetWorkspace()
proto native void ChangeGameFocus(int add, int input_device=-1)
Change game focus number.
ButtonWidget m_KnucleOutButton
ButtonWidget m_CardFightButton
XComboBoxWidget m_StanceCB
movement card
ButtonWidget m_StartTurnButton
void ShowWidgets(bool show)
ButtonWidget m_StartDeathButton
XComboBoxWidget m_HitBodyPartCB
XComboBoxWidget m_TurnTypeCB
EditBoxWidget m_MovementSpeedEB
ButtonWidget m_StartHitButton
ref Timer m_TickTimer
status refresh timer
EditBoxWidget m_HitDirEB
fight card
void ShowCard(int pCard)
void ToggleDebugWindowSetMode(int pMode)
Widget m_MainWnd
main controls
XComboBoxWidget m_AttackDirCB
XComboBoxWidget m_AttackTypeCB
XComboBoxWidget m_HitTypeCB
DayZInfected m_ControlledInfected
controlled instance
XComboBoxWidget m_DeathTypeCB
XComboBoxWidget m_MindStateCB
ButtonWidget m_StartAttackButton
ButtonWidget m_CardMovementButton
XComboBoxWidget m_VaultingCB
ButtonWidget m_StartVaultButton
bool OnClick(Widget w, int x, int y, int button)
buttons clicks
ButtonWidget m_SpawnEntityButton
EditBoxWidget m_TurnDirectionEB
ref PluginDayZInfectedDebugUIHandler m_pUIHandler
void CommandHandler(DayZInfected infected)
XComboBoxWidget m_CrawlingTypeCB
ButtonWidget m_StartCrawlingButton
bool OnChange(Widget w, int x, int y, bool finished)
map: item x vector(index, width, height)
Definition EnWidgets.c:538
override bool OnChange(Widget w, int x, int y, bool finished)
override bool OnClick(Widget w, int x, int y, int button)
PluginDayZInfectedDebug m_pPluginInfectedDebug
proto native void UpdateControls()
proto native void ActivateExclude(string sExcludeName)
void ShowUICursor(bool visible)
Definition UIManager.c:246
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
proto native external Widget CreateWidgets(string layout, Widget parentWidget=NULL, bool immedUpdate=true)
Create widgets from *.layout file.