DayZ 1.24
Loading...
Searching...
No Matches
PluginDiagMenuClient.c
Go to the documentation of this file.
1// For modding, see PluginDiagMenuModding.c
2// !!! MODDING DISCLAIMER: These are debug functionality files, if you are thinking about modding the vanilla ones, do so at your own risk
3// These files will not be maintained with the thought of "what if a modder modded this" (Excluding the modding functionality of course)
4// Which is why the modding functionality was developed with the thought of the modded ones having their own isolated safe space
5
7{
8#ifdef DIAG_DEVELOPER
9 static int m_SystemsMask;
10
11 // Cheats
12 bool m_ModifiersEnabled = true;
15
16 // Misc
17 float m_Playtime;
22
23 override void OnInit()
24 {
25 super.OnInit();
26
28 }
29
30 protected void BindCallbacks()
31 {
32 //---------------------------------------------------------------
33 // LEVEL 2 - Script > Crafting
34 //---------------------------------------------------------------
38
39 //---------------------------------------------------------------
40 // LEVEL 2 - Script > Vehicles
41 //---------------------------------------------------------------
43 DiagMenu.BindCallback(DiagMenuIDs.VEHICLE_DUMP_CRASH_DATA, CBDumpCrashData);
44
45 //---------------------------------------------------------------
46 // LEVEL 2 - Script > Cheats
47 //---------------------------------------------------------------
56 DiagMenu.BindCallback(DiagMenuIDs.CHEATS_CREATE_HIT, CBCreateHit);
57 DiagMenu.BindCallback(DiagMenuIDs.CHEATS_CREATE_HIT_LIGHT, CBCreateHitLight);
58
59 //---------------------------------------------------------------
60 // LEVEL 2 - Script > Player Agents
61 //---------------------------------------------------------------
63
64 //---------------------------------------------------------------
65 // LEVEL 2 - Script > Soft Skills
66 //---------------------------------------------------------------
70 DiagMenu.BindCallback(DiagMenuIDs.SOFT_SKILLS_SPECIALTY_VALUE, CBSoftSkillsSpecialtyValue);
71
72 //---------------------------------------------------------------
73 // LEVEL 2 - Script > Lifespan
74 //---------------------------------------------------------------
77
78 //---------------------------------------------------------------
79 // LEVEL 2 - Script > Misc
80 //---------------------------------------------------------------
81 DiagMenu.BindCallback(DiagMenuIDs.MISC_DISABLE_PERSONAL_LIGHT, CBMiscPersonalLight);
82 DiagMenu.BindCallback(DiagMenuIDs.MISC_ITEM_DEBUG_ACTIONS, CBMiscItemDebugActions); // Is enabled by default now
85
86 //---------------------------------------------------------------
87 // LEVEL 2 - Script > Misc -> Environment
88 //---------------------------------------------------------------
90 DiagMenu.BindCallback(DiagMenuIDs.MISC_ENVIRONMENT_LOGGING_DRYWET, CBMiscEnvironmentLoggingDryWet);
91
92 //---------------------------------------------------------------
93 // LEVEL 2 - Script > Misc
94 //---------------------------------------------------------------
99 DiagMenu.BindCallback(DiagMenuIDs.MISC_UNIVERSAL_TEMPERATURE_SOURCES, CBMiscUniversalTemperatureSources);
102 DiagMenu.BindCallback(DiagMenuIDs.MISC_GO_UNCONSCIOUS_DELAYED, CBMiscGoUnconsciousDelayed);
104
105 //---------------------------------------------------------------
106 // LEVEL 3 - Script > Misc > Hair Hiding
107 //---------------------------------------------------------------
108 DiagMenu.BindCallback(DiagMenuIDs.MISC_HAIR_LEVEL_HIDE, CBMiscHairHide);
110
111 //---------------------------------------------------------------
112 // LEVEL 2 - Script > Misc
113 //---------------------------------------------------------------
117 DiagMenu.BindCallback(DiagMenuIDs.MISC_SHOW_PLUG_ARROWS, CBMiscPlugArrows);
119
120 //---------------------------------------------------------------
121 // LEVEL 3 - Script > Misc > Hit Indication
122 //---------------------------------------------------------------
123 DiagMenu.BindCallback(DiagMenuIDs.MISC_HIT_INDICATION_DEBUG, CBMiscHitIndication);
124 DiagMenu.BindCallback(DiagMenuIDs.MISC_HIT_INDICATION_SPAWN_HIT, CBMiscHitIndicationSpawnHit);
125 DiagMenu.BindCallback(DiagMenuIDs.MISC_HIT_INDICATION_MODE, CBMiscHitIndication);
126 DiagMenu.BindCallback(DiagMenuIDs.MISC_HIT_INDICATION_TYPE, CBMiscHitIndication);
127 DiagMenu.BindCallback(DiagMenuIDs.MISC_HIT_INDICATION_DURATION, CBMiscHitIndication);
128 DiagMenu.BindCallback(DiagMenuIDs.MISC_HIT_INDICATION_BREAKPOINT, CBMiscHitIndication);
129 DiagMenu.BindCallback(DiagMenuIDs.MISC_HIT_INDICATION_DISTANCE, CBMiscHitIndication);
130 DiagMenu.BindCallback(DiagMenuIDs.MISC_HIT_INDICATION_ROTATION, CBMiscHitIndication);
131 DiagMenu.BindCallback(DiagMenuIDs.MISC_HIT_INDICATION_SCATTER, CBMiscHitIndication);
132 DiagMenu.BindCallback(DiagMenuIDs.MISC_HIT_INDICATION_DISABLE_PPE, CBMiscHitIndication);
133
134 //---------------------------------------------------------------
135 // LEVEL 2 - Script > Misc
136 //---------------------------------------------------------------
138 DiagMenu.BindCallback(DiagMenuIDs.MISC_DEBUG_MONITOR, CBDebugMonitor);
139
140 //---------------------------------------------------------------
141 // LEVEL 2 - Script > Simulate script
142 //---------------------------------------------------------------
145 DiagMenu.BindCallback(DiagMenuIDs.SIMULATE_DIVISION_BY_ZERO, CBSimulateDivisionByZero);
147
148 //---------------------------------------------------------------
149 // LEVEL 2 - Script > Weapon
150 //---------------------------------------------------------------
156
157 //---------------------------------------------------------------
158 // LEVEL 2 - Script > Bleeding
159 //---------------------------------------------------------------
161 DiagMenu.BindCallback(DiagMenuIDs.BLEEDING_DISABLE_BLOOD_LOSS, CBBleedingDisableBloodLoss);
163 DiagMenu.BindCallback(DiagMenuIDs.BLEEDING_ACTIVATE_ALL_SOURCES, CBBleedingActivateAllSources);
164 DiagMenu.BindCallback(DiagMenuIDs.BLEEDING_ACTIVATE_SOURCE_LEVEL, CBBleedingActivateSourceLevel);
166
167 //---------------------------------------------------------------
168 // LEVEL 3 - Script > Bleeding > Bleeding Indication
169 //---------------------------------------------------------------
171 DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_USEVALUEOVERRIDES, CBBBleedingIndicators);
172 DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_RANDOMROTATION, CBBBleedingIndicators);
173 DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_SEQUENCE_DURATION, CBBBleedingIndicators);
174 DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_BASEDURATION, CBBBleedingIndicators);
175 DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_MINDELAY, CBBBleedingIndicators);
176 DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_MAXDELAY, CBBBleedingIndicators);
177 DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_PROGRESSTHRESHOLD, CBBBleedingIndicators);
178 DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_STARTSIZE, CBBBleedingIndicators);
179 DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_ENDSIZE, CBBBleedingIndicators);
180 DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_RNDSCALEMIN, CBBBleedingIndicators);
181 DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_RNDSCALEMAX, CBBBleedingIndicators);
182 DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_SCATTER, CBBBleedingIndicators);
183 DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_SLIDEDISTANCE, CBBBleedingIndicators);
184
185 //---------------------------------------------------------------
186 // LEVEL 4 - Script > Bleeding > Bleeding Indication > Color Debug
187 //---------------------------------------------------------------
188 DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_COLOR_ENABLEDESATURATION, CBBBleedingIndicators);
189 DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_COLOR_DESATURATIONEND, CBBBleedingIndicators);
190 DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_COLOR_R, CBBBleedingIndicators);
191 DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_COLOR_G, CBBBleedingIndicators);
192 DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_COLOR_B, CBBBleedingIndicators);
193 DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_COLOR_A_START, CBBBleedingIndicators);
194 DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_COLOR_A_END, CBBBleedingIndicators);
195
196 //---------------------------------------------------------------
197 // LEVEL 2 - Script > Logs
198 //---------------------------------------------------------------
206
207 //---------------------------------------------------------------
208 // LEVEL 3 - Script > Logs > InventoryLogs
209 //---------------------------------------------------------------
211 DiagMenu.BindCallback(DiagMenuIDs.LOGS_INVENTORY_RESERVATION, CBLogsInventoryReservation);
213
214 //---------------------------------------------------------------
215 // LEVEL 2 - Script > Triggers
216 //---------------------------------------------------------------
218
219 //---------------------------------------------------------------
220 // LEVEL 2 - Script > Base Building
221 //---------------------------------------------------------------
224
225 //---------------------------------------------------------------
226 // LEVEL 2 - Script > Finishers
227 //---------------------------------------------------------------
229
230 //---------------------------------------------------------------
231 // LEVEL 2 - Script > Cinematic Camera Tools
232 //---------------------------------------------------------------
233 DiagMenu.BindCallback(DiagMenuIDs.CAMERATOOLS_ENABLE_REMOTE_CAMERA, CBCameraToolsEnableRemoteCamera);
234 }
235
236 //---------------------------------------------
238 {
239 super.OnRPC(player, rpc_type, ctx);
240
241 switch (rpc_type)
242 {
243 case ERPCs.DIAG_MISC_ENVIRONMENT_DEBUG_DATA:
244 {
245 if (!m_EnvDebugData)
247
248 ctx.Read(m_EnvDebugData);
249 break;
250 }
251
252 case ERPCs.DIAG_MISC_FALLDAMAGE_DEBUG_DATA:
253 {
256
258 break;
259 }
260
261 case ERPCs.DIAG_VEHICLES_DUMP_CRASH_DATA_CONTENTS:
262 {
264
265 if (ctx.Read(par))
266 CrashDebugData.DumpDataArray(par.param1);
267 break;
268 }
269 }
270 }
271
272 //---------------------------------------------
273 override void OnUpdate(float delta_time)
274 {
275 super.OnUpdate(delta_time);
276
277 //---------------------------------------------
278 // every system can handle their own actions locally(within the system itself),
279 // this section is for systems which don't have client side representation,
280 // or don't have their own tick, or for whatever other reason you prefer to put the logic here
281 // PUT ONLY METHOD CALLS HERE, NO CODE !!
282 // PUT ONLY METHOD CALLS HERE, NO CODE !!
283 //---------------------------------------------
284
288 }
289
290 //---------------------------------------------
291 void CheckTimeAccel()
292 {
293 if (!FeatureTimeAccel.m_CurrentTimeAccel)
295
296 if (GetGame() && GetGame().GetPlayer())
297 {
299
300 if (!FeatureTimeAccel.AreTimeAccelParamsSame(param, FeatureTimeAccel.m_CurrentTimeAccel))
301 {
302 int timeAccelBig = param.param2;
303 float timeAccelSmall = param.param2 - timeAccelBig;
304 FeatureTimeAccel.CopyTimeAccelClipboard(param.param1, timeAccelBig, timeAccelSmall, param.param3);
305 FeatureTimeAccel.SendTimeAccel(GetGame().GetPlayer(), param);
306 FeatureTimeAccel.m_CurrentTimeAccel = param;
307 }
308 }
309
310 }
311
312 //---------------------------------------------
313 static void CBCraftingGenerate(bool enabled, int id)
314 {
315 PluginRecipesManager pluginRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
316 DiagButtonAction(enabled, id, ScriptCaller.Create(pluginRecipesManager.CallbackGenerateCache));
317 }
318
319 //---------------------------------------------
320 static void CBCraftingInstant(bool enabled)
321 {
322 PluginRecipesManager pluginRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
323 DiagToggleRPC(enabled, pluginRecipesManager.IsEnableDebugCrafting(), ERPCs.DIAG_CRAFTING_INSTANT);
324 }
325
326 //---------------------------------------------
327 static void CBCraftingDump(bool enabled, int id)
328 {
329 PluginRecipesManager pluginRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
330 DiagButtonAction(enabled, id, ScriptCaller.Create(pluginRecipesManager.GenerateHumanReadableRecipeList));
331 }
332
333 //---------------------------------------------
334 static void CBCheatsModifiers(bool enabled)
335 {
337 DiagToggleRPCServer(enabled, pluginDiag.m_ModifiersEnabled, ERPCs.DIAG_CHEATS_MODIFIERS);
338 }
339
340 //---------------------------------------------
341 static void CBCheatsKillPlayer(bool enabled, int id)
342 {
343 DiagButtonRPC(enabled, id, ERPCs.DIAG_CHEATS_KILL_PLAYER, true);
344 }
345
346 //---------------------------------------------
347 static void CBCheatsInvincibility(int value)
348 {
350 DiagToggleRPCServer(value, pluginDiag.m_IsInvincible, ERPCs.DIAG_CHEATS_INVINCIBILITY);
351 }
352
353 //---------------------------------------------
354 static void CBCheatsStaminaDisable(bool enabled)
355 {
357 if (player)
358 player.SetStaminaDisabled(enabled);
359
361 DiagToggleRPCServer(enabled, pluginDiag.m_StaminaDisabled, ERPCs.DIAG_CHEATS_DISABLE_STAMINA);
362 }
363
364 //---------------------------------------------
365 static void CBCheatsResetPlayer(bool enabled, int id)
366 {
368 if (player)
369 player.ResetPlayer(false);
370 DiagButtonRPC(enabled, id, ERPCs.DIAG_CHEATS_RESET_PLAYER, true);
371 }
372
373 //---------------------------------------------
374 static void CBCheatsResetPlayerMax(bool enabled, int id)
375 {
377 if (player)
378 player.ResetPlayer(true);
379 DiagButtonRPC(enabled, id, ERPCs.DIAG_CHEATS_RESET_PLAYER_MAX, true);
380 }
381
382 //---------------------------------------------
383 static void CBCheatsInventoryAccess(bool enabled)
384 {
385 DiagToggleRPCServer(enabled, PlayerBase.DEBUG_INVENTORY_ACCESS, ERPCs.DIAG_CHEATS_INVENTORY_ACCESS);
386 }
387
388 //---------------------------------------------
389 static void CBCheatsFixItems(bool enabled, int id)
390 {
391 DiagButtonRPC(enabled, id, ERPCs.DIAG_CHEATS_ITEMS_FIX, true);
392 }
393
394 static void CBCreateHit(bool enabled, int id)
395 {
396 DiagButtonRPC(enabled, id, ERPCs.DIAG_CHEATS_CREATE_HIT, true);
397 }
398
399 static void CBCreateHitLight(bool enabled, int id)
400 {
401 DiagButtonRPC(enabled, id, ERPCs.DIAG_CHEATS_CREATE_HIT_LIGHT, true);
402 }
403
404 //---------------------------------------------
405 static void CBPlayerAgentsInjectActions(bool enabled)
406 {
408 }
409
410 //---------------------------------------------
411 static void CBSoftSkillsShowDebug(bool enabled)
412 {
413 SoftSkillsManager ssMngr = GetPlayer().GetSoftSkillsManager();
414 DiagToggleRPCAction(enabled, ScriptCaller.Create(ssMngr.CreateDebugWindow), ssMngr.IsDebug(), ERPCs.DIAG_SOFT_SKILLS_SHOW_DEBUG);
415 }
416
417 //---------------------------------------------
418 static void CBSoftSkillsToggleState(bool enabled)
419 {
420 SoftSkillsManager ssMngr = GetPlayer().GetSoftSkillsManager();
421 DiagToggleRPC(enabled, ssMngr.GetSoftSkillsState(), ERPCs.DIAG_SOFT_SKILLS_TOGGLE_STATE);
422 }
423
424 //---------------------------------------------
425 static void CBSoftSkillsToggleModel(bool enabled)
426 {
427 SoftSkillsManager ssMngr = GetPlayer().GetSoftSkillsManager();
428 DiagToggleRPC(enabled, ssMngr.IsLinear(), ERPCs.DIAG_SOFT_SKILLS_TOGGLE_MODEL);
429 }
430
431 //---------------------------------------------
432 static void CBSoftSkillsSpecialtyValue(float value)
433 {
434 SoftSkillsManager ssMngr = GetPlayer().GetSoftSkillsManager();
435 DiagToggleRPC(value, ssMngr.GetSpecialtyLevel(), ERPCs.DIAG_SOFT_SKILLS_SPECIALTY_VALUE);
436 }
437
438 //---------------------------------------------
439 static void CBLifespanBloodyHands(bool enabled)
440 {
442 if (player)
443 DiagToggleRPCServer(enabled, player.HasBloodyHands(), ERPCs.DIAG_LIFESPAN_BLOODY_HANDS);
444 }
445
446 //---------------------------------------------
447 static void CBLifespanPlaytimeUpdate(float value)
448 {
450 DiagToggleRPCServer(value * 60, pluginDiag.m_Playtime, ERPCs.DIAG_LIFESPAN_PLAYTIME_UPDATE);
451 }
452
453 //---------------------------------------------
454 static void CBMiscPersonalLight(bool enabled)
455 {
456 PlayerBaseClient.m_PersonalLightDisabledByDebug = enabled;
457 PlayerBaseClient.UpdatePersonalLight();
458 }
459
460 //---------------------------------------------
461 static void CBMiscItemDebugActions(bool enabled)
462 {
463 DiagDebugAction(DebugActionType.GENERIC_ACTIONS, enabled);
464 }
465
466 //---------------------------------------------
467 static void CBMiscLogPlayerStats(bool enabled)
468 {
470 DiagToggleRPC(enabled, pluginDiag.m_LogPlayerStats, ERPCs.DIAG_MISC_LOG_PLAYER_STATS);
471 }
472
473 //---------------------------------------------
474 static void CBMiscForceHintIndex(int index)
475 {
476 UiHintPanel.m_ForcedIndex = index;
477 }
478
479 //---------------------------------------------
480 static void CBMiscPermanentCrossHair(bool enabled)
481 {
483 crosshair.SwitchPermanentCrossHair(enabled);
484 }
485
486 //---------------------------------------------
488 {
489 if (DiagMenu.GetBool(DiagMenuIDs.MISC_VEHICLE_GETOUT_BOX))
490 {
492 {
493 m_VehicleFreeAreaBox.Destroy();
495 }
496
497 HumanCommandVehicle hcv = GetGame().GetPlayer().GetCommand_Vehicle();
498 if (!hcv)
499 return;
500
501 m_VehicleFreeAreaBox = hcv.GetTransport().DebugFreeAreaAtDoor(hcv.GetVehicleSeat());
502 }
503 else if (m_VehicleFreeAreaBox)
504 {
505 m_VehicleFreeAreaBox.Destroy();
507 }
508 }
509
510 //---------------------------------------------
511 static void CBMiscToggleHud(bool enabled)
512 {
513 Mission mission = GetGame().GetMission();
515 if (enabled)
517 else
519 }
520
521 //---------------------------------------------
522 static void CBMiscEnvironmentDebug(bool enabled)
523 {
524 SendDiagRPC(enabled, ERPCs.DIAG_MISC_ENVIRONMENT_DEBUG);
525 }
526
528 {
529 if (DiagMenu.GetBool(DiagMenuIDs.MISC_ENVIRONMENT_DEBUG) && m_EnvDebugData)
530 Environment.DisplayEnvDebugPlayerInfo(true, m_EnvDebugData);
531 else if (m_EnvDebugData)
533 }
534
536 {
537 SendDiagRPC(enabled, ERPCs.DIAG_MISC_ENVIRONMENT_LOGGING_DRYWET);
538 }
539
540 static void CBMiscFallDamageDebug(bool enabled)
541 {
542 SendDiagRPC(enabled, ERPCs.DIAG_MISC_FALLDAMAGE_DEBUG);
543 }
544
546 {
547 if (DiagMenu.GetBool(DiagMenuIDs.MISC_FALLDAMAGE_DEBUG) && m_FallDamageDebugData)
548 DayZPlayerImplementFallDamage.DisplayFallDamageDebugInfo(true, m_FallDamageDebugData);
549 else if (m_FallDamageDebugData)
551 }
552
553 //---------------------------------------------
554 static void CBMiscDisplayPlayerInfo(int value)
555 {
557 prpdc.RequestPlayerInfo(PlayerBase.Cast(GetGame().GetPlayer()), value);
558 }
559
560 //---------------------------------------------
562 {
564 client.RequestUniversalTemperatureSources(PlayerBase.Cast(GetGame().GetPlayer()), enabled);
565 }
566
567 //---------------------------------------------
568 static void CBMiscBulletImpact(bool enabled, int id)
569 {
574 }
575
576 //---------------------------------------------
577 static void CBMiscGoUnconscious(bool enabled, int id)
578 {
579 DiagButtonRPC(enabled, id, ERPCs.DIAG_MISC_GO_UNCONSCIOUS, true);
580 }
581
582 //---------------------------------------------
583 static void CBMiscGoUnconsciousDelayed(bool enabled, int id)
584 {
585 DiagButtonRPC(enabled, id, ERPCs.DIAG_MISC_GO_UNCONSCIOUS_DELAYED, true);
586 }
587
588 //---------------------------------------------
589 static void CBMiscQuickRestrain(bool enabled)
590 {
592 DiagToggleRPC(enabled, player.IsQuickRestrain(), ERPCs.DIAG_MISC_QUICK_RESTRAIN);
593 }
594
595 //---------------------------------------------
596 static void CBMiscHairHide(bool enabled, int id)
597 {
598 int value = DiagMenu.GetRangeValue(DiagMenuIDs.MISC_HAIR_LEVEL);
599 DiagButtonRPCIntInt(enabled, id, value, enabled, ERPCs.DIAG_MISC_HAIR_LEVEL_HIDE, true);
600 }
601
602 //---------------------------------------------
603 static void CBMiscHairHideAll(bool enabled)
604 {
607
608 SendDiagRPC(CachedObjectsParams.PARAM2_INT_INT, ERPCs.DIAG_MISC_HAIR_LEVEL_HIDE, true);
609 }
610
611 //---------------------------------------------
612 static void CBMiscCamShake(bool enabled, int id)
613 {
614 DayZPlayerCamera cam = GetGame().GetPlayer().GetCurrentCamera();
615 DiagButtonAction(enabled, id, ScriptCaller.Create(cam.SpawnDiagCameraShake));
616 }
617
618 //---------------------------------------------
619 static void CBMiscQuickFishing(bool enabled)
620 {
622 DiagToggleRPC(enabled, player.IsQuickFishing(), ERPCs.DIAG_MISC_QUICK_FISHING);
623 }
624
625 //---------------------------------------------
626 static void CBMiscShockImpact(bool enabled, int id)
627 {
629 }
630
631 static void ShockImpact()
632 {
633 static float intensity;
634 intensity += 0.25;
635 intensity = Math.WrapFloat(intensity, 0.25, 1);
636
638 player.SpawnShockEffect(intensity);
639 }
640
641 //---------------------------------------------
642 static void CBMiscPlugArrows(bool enabled)
643 {
644 GetGame().EnableEMPlugs(enabled);
645 }
646
647 //---------------------------------------------
648 static void CBMiscTargetableByAI(bool enabled, int id)
649 {
651 if (player)
652 DiagToggleRPC(enabled, player.m_CanBeTargetedDebug, ERPCs.DIAG_MISC_TARGETABLE_BY_AI);
653 }
654
655 //---------------------------------------------
656 static void CBMiscHitIndication()
657 {
659
660 if (DiagMenu.GetBool(DiagMenuIDs.MISC_HIT_INDICATION_DEBUG))
661 {
662 HitDirectionEffectBase.m_Mode = DiagMenu.GetValue(DiagMenuIDs.MISC_HIT_INDICATION_MODE);
663 HitDirectionEffectBase.m_ID = DiagMenu.GetValue(DiagMenuIDs.MISC_HIT_INDICATION_TYPE);
669
670 if (player)
671 player.SetHitPPEEnabled(!DiagMenu.GetBool(DiagMenuIDs.MISC_HIT_INDICATION_DISABLE_PPE));
672 }
673 else
674 {
676 if (player)
678 }
679 }
680
681 //---------------------------------------------
682 static void CBMiscHitIndicationSpawnHit(bool enabled, int id)
683 {
684 DiagButtonAction(enabled, id, ScriptCaller.Create(SpawnHitDirEffect));
685 }
686
687 static void SpawnHitDirEffect()
688 {
690 GetGame().GetMission().GetHud().SpawnHitDirEffect(player, DiagMenu.GetRangeValue(DiagMenuIDs.MISC_HIT_INDICATION_SPAWN_HIT_DIRECTION), 1.0);
691 }
692
693 //---------------------------------------------
694 static void CBDebugMonitor(bool enabled, int id)
695 {
696 SendDiagRPC(enabled, ERPCs.DIAG_MISC_DEBUG_MONITOR, true);
697
698 if (enabled)
699 GetGame().GetMission().CreateDebugMonitor();
700 else
701 GetGame().GetMission().HideDebugMonitor();
702 }
703
704 //---------------------------------------------
705 static void CBMiscFreezeEntity(bool enabled, int id)
706 {
708 }
709
710 static void FreezeEntity()
711 {
713 if (PluginSceneManager.GetInstance() && PluginSceneManager.GetInstance().IsOpened())
714 {
715 // Scene Editor
716 SceneObject scene_obj = PluginSceneManager.GetInstance().GetSelectedSceneObject();
717
718 if (scene_obj)
719 entity = scene_obj.GetObject();
720 }
721 else
722 {
723 // FreeDebugCamera
724 FreeDebugCamera camera = FreeDebugCamera.GetInstance();
725 entity = EntityAI.Cast(camera.GetCrosshairObject());
726 }
727
728 if (entity)
729 entity.DisableSimulation(!entity.GetIsSimulationDisabled());
730 }
731
732 //---------------------------------------------
733 static void CBVehicleDebugOutput(int value)
734 {
735
736 int bitValue = 0;
737 if (value == 1)//"Basic"
738 bitValue = EVehicleDebugOutputType.DAMAGE_APPLIED;
739 if (value == 2)//"Extended"
740 bitValue = EVehicleDebugOutputType.DAMAGE_APPLIED | EVehicleDebugOutputType.DAMAGE_CONSIDERED;
741 else if (value == 3)//"Contact"
743 else if (value == 4)//"Basic" + "Contact"
745 SendDiagRPC(bitValue, ERPCs.DIAG_VEHICLE_DEBUG_OUTPUT, true);
746 }
747
748 //---------------------------------------------
749 static void CBDumpCrashData(bool value)
750 {
751 if (value)
752 {
753 SendDiagRPC(true, ERPCs.DIAG_VEHICLES_DUMP_CRASH_DATA_REQUEST, true);
754 DiagMenu.SetValue(DiagMenuIDs.VEHICLE_DUMP_CRASH_DATA, 0);
755 }
756 //DiagButtonRPC(value, DiagMenuIDs.VEHICLE_DUMP_CRASH_DATA, ERPCs.DIAG_VEHICLES_DUMP_CRASH_DATA_REQUEST, true);
757
758 }
759
760 //---------------------------------------------
761 static void SimulateMode(bool enabled, int id, int rpc)
762 {
763 int value = DiagMenu.GetRangeValue(DiagMenuIDs.SIMULATE_MODE);
764
765 switch (value)
766 {
767 case 0:
768 {
769 DiagButtonRPC(enabled, id, rpc, true);
770 break;
771 }
772 case 1:
773 {
775 break;
776 }
777 case 2:
778 {
779 DiagButtonRPC(enabled, id, rpc, true);
781 break;
782 }
783 }
784 }
785
786 //---------------------------------------------
787 static void CBSimulateInfiniteLoop(bool enabled, int id)
788 {
789 SimulateMode(enabled, id, ERPCs.DIAG_SIMULATE_INFINITE_LOOP);
790 }
791
792 //---------------------------------------------
793 static void CBSimulateNullPointer(bool enabled, int id)
794 {
795 SimulateMode(enabled, id, ERPCs.DIAG_SIMULATE_NULL_POINTER);
796 }
797
798 //---------------------------------------------
799 static void CBSimulateDivisionByZero(bool enabled, int id)
800 {
801 SimulateMode(enabled, id, ERPCs.DIAG_SIMULATE_DIVISION_BY_ZERO);
802 }
803
804 //---------------------------------------------
805 static void CBSimulateErrorFunction(bool enabled, int id)
806 {
807 SimulateMode(enabled, id, ERPCs.DIAG_SIMULATE_ERROR_FUNCTION);
808 }
809
810 //---------------------------------------------
811 static void CBWeaponParticles(bool enabled)
812 {
814 }
815
816 //---------------------------------------------
817 static void CBWeaponDebug(bool enabled)
818 {
820 DiagToggleAction(enabled, ScriptCaller.Create(player.ShowWeaponDebug), player.IsWeaponDebugEnabled());
821 }
822
823 //---------------------------------------------
824 static void CBWeaponAimNoise(bool enabled)
825 {
827 if (player)
828 {
829 DayZPlayerImplementAiming aimModel = player.GetAimingModel();
830 DiagToggleAction(enabled, ScriptCaller.Create(aimModel.SetAimNoiseAllowed), aimModel.IsAimNoiseAllowed());
831 }
832 }
833
834 //---------------------------------------------
835 static void CBWeaponRecoil(bool enabled)
836 {
838 if (player)
839 {
840 DayZPlayerImplementAiming aimModel = player.GetAimingModel();
841 DiagToggleRPC(enabled, aimModel.IsProceduralRecoilEnabled(), ERPCs.DIAG_WEAPON_RECOIL);
842 }
843 }
844
845 //---------------------------------------------
846 static void CBWeaponUnlimitedAmmo(bool enabled)
847 {
848 DiagDebugAction(DebugActionType.UNLIMITED_AMMO, enabled);
849 }
850
851 //---------------------------------------------
852 static void CBWeaponBurstVersion(int value)
853 {
855 WeaponManager wpnMngr = player.GetWeaponManager();
856 DiagToggleRPC(value, wpnMngr.GetBurstOption(), ERPCs.DIAG_WEAPON_BURST_VERSION);
857 }
858
859 //---------------------------------------------
860 static void CBBleedingSources(bool enabled)
861 {
863 player.GetBleedingManagerRemote().SetDiag(enabled);
864 }
865
866 //---------------------------------------------
867 static void CBBleedingDisableBloodLoss(bool enabled)
868 {
869 SendDiagRPC(enabled, ERPCs.DIAG_BLEEDING_DISABLE_BLOOD_LOSS, true);
870 }
871
872 //---------------------------------------------
873 static void CBBleedingActivateSource(int value)
874 {
875 SendDiagRPC(value, ERPCs.DIAG_BLEEDING_ACTIVATE_SOURCE, true);
876 }
877
878 //---------------------------------------------
879 static void CBBleedingActivateAllSources(bool enabled, int id)
880 {
881 DiagButtonRPC(enabled, id, ERPCs.DIAG_BLEEDING_ACTIVATE_ALL_SOURCES, true);
882 }
883
884 //---------------------------------------------
885 static void CBBleedingActivateSourceLevel(int value)
886 {
888 BleedingSourcesManagerBase mgr = player.GetBleedingManagerRemote();
889
890 int idx = 100; //invalid index, just deletes all
891 if (value != 0)
892 {
893 string bone = ""; //lower-case!
894 switch (value)
895 {
896 case 1: //PlayerConstants.BLEEDING_SOURCE_FLOW_MODIFIER_LOW
897 bone = "lefttoebase";
898 break;
899
900 case 2: //PlayerConstants.BLEEDING_SOURCE_FLOW_MODIFIER_MEDIUM
901 bone = "leftarm";
902 break;
903
904 case 3: //PlayerConstants.BLEEDING_SOURCE_FLOW_MODIFIER_HIGH
905 bone = "neck";
906 break;
907 }
908
909 int count = mgr.m_BleedingSourceZone.Count();
910
911 for (int i = 0; i < count; ++i)
912 {
913 if (mgr.m_BleedingSourceZone.GetKey(i) == bone)
914 {
915 idx = i;
916 break;
917 }
918 }
919 }
920
922 }
923
924 //---------------------------------------------
925 static void CBBleedingReload(bool enabled, int id)
926 {
928 BleedingSourcesManagerRemote bsMngrRem = player.GetBleedingManagerRemote();
929 DiagButtonAction(enabled, id, ScriptCaller.Create(bsMngrRem.Reload));
930 }
931
932 //---------------------------------------------
933 static void CBBBleedingIndicators()
934 {
935 bool diagEnable = DiagMenu.GetBool(DiagMenuIDs.BLEEDINGINDICATORS);
937 {
940 if (player && player.GetBleedingManagerRemote())
941 player.GetBleedingManagerRemote().Reload();
942 }
943
945
947 {
960
961 DbgBleedingIndicationStaticInfo.m_DbgDropDesaturate = DiagMenu.GetBool(DiagMenuIDs.BLEEDINGINDICATORS_DROP_COLOR_ENABLEDESATURATION);
962 DbgBleedingIndicationStaticInfo.m_DbgDesaturationEnd = DiagMenu.GetRangeValue(DiagMenuIDs.BLEEDINGINDICATORS_DROP_COLOR_DESATURATIONEND);
968 }
969 }
970
971 //---------------------------------------------
972 static void CBLogsActions(bool enabled)
973 {
975 }
976
977 //---------------------------------------------
978 static void CBLogsWeapons(bool enabled)
979 {
981 }
982
983 //---------------------------------------------
984 static void CBLogsSync(bool enabled)
985 {
987 }
988
989 //---------------------------------------------
990 static void CBLogsBaseBuilding(bool enabled)
991 {
993 }
994
995 //---------------------------------------------
996 static void CBLogsSymptoms(bool enabled)
997 {
999 }
1000
1001 //---------------------------------------------
1002 static void CBLogsInventoryMove(bool enabled)
1003 {
1004 DiagToggleRPC(enabled, LogManager.IsInventoryMoveLogEnable(), ERPCs.DIAG_LOGS_INVENTORY_MOVE);
1005 }
1006
1007 //---------------------------------------------
1008 static void CBLogsInventoryReservation(bool enabled)
1009 {
1010 DiagToggleRPC(enabled, LogManager.IsInventoryReservationLogEnable(), ERPCs.DIAG_LOGS_INVENTORY_RESERVATION);
1011 }
1012
1013 //---------------------------------------------
1014 static void CBLogsInventoryHFSM(bool enabled)
1015 {
1016 DiagToggleRPC(enabled, LogManager.IsInventoryHFSMLogEnable(), ERPCs.DIAG_LOGS_INVENTORY_HFSM);
1017 }
1018
1019 //---------------------------------------------
1020 static void CBLogsQuickbar(bool enabled)
1021 {
1023 }
1024
1025 //---------------------------------------------
1026 static void CBLogsBleedingChances(bool enabled)
1027 {
1028 DiagToggleRPC(enabled, LogManager.IsBleedingChancesLogEnable(), ERPCs.DIAG_LOGS_BLEEDING_CHANCES);
1029 }
1030
1031 //---------------------------------------------
1032 static void CBTriggerDebug(bool enabled)
1033 {
1035 }
1036
1037 //---------------------------------------------
1038 static void CBBaseBuildingWood(bool enabled)
1039 {
1040 SendDiagRPC(enabled, ERPCs.DIAG_BASEBUILDING_WOOD, true);
1041 }
1042
1043 //---------------------------------------------
1044 static void CBBaseBuildingGate(bool enabled)
1045 {
1046 SendDiagRPC(enabled, ERPCs.DIAG_BASEBUILDING_GATE, true);
1047 }
1048
1049 //---------------------------------------------
1050 static void CBFinishersFinisherForced(int value)
1051 {
1053 DiagToggleRPC(value - 1, player.GetMeleeCombat().DebugGetForcedFinisherType(), ERPCs.DIAG_FINISHERS_FORCE_FINISHER);
1054 }
1055
1056 //---------------------------------------------
1058 {
1060
1061 if (!player)
1062 return;
1063
1064 if (!enabled && player.m_CameraToolsMenuClient)
1065 player.m_CameraToolsMenuClient.DelayedDestroy();
1066
1068 GetGame().RPCSingleParam(null, ERPCs.DIAG_CAMERATOOLS_CAM_SUBSCRIBE, param, true);
1069 }
1070
1071 //---------------------------------------------
1072 // Misc
1073 //---------------------------------------------
1074 static PlayerBase GetPlayer()
1075 {
1076 if (!GetGame())
1077 return null;
1078
1080
1081 if (DiagMenu.GetBool(DiagMenuIDs.MISC_ACTION_ON_CURSOR))
1082 {
1083 float hitFraction;
1084 vector start = GetGame().GetCurrentCameraPosition();
1085 vector end = start + (GetGame().GetCurrentCameraDirection() * 5.0);
1086
1088 Object hitObj;
1089
1090 PhxInteractionLayers hitMask = 0xFFFFFFFFFF;
1091
1094 }
1095
1096 return player;
1097 }
1098
1099 //---------------------------------------------
1100 // DebugAction
1101 //---------------------------------------------
1102 static void DiagDebugAction(DebugActionType type, bool enable)
1103 {
1104 int mask;
1105 if (enable)
1106 mask = (ItemBase.GetDebugActionsMask() | type);
1107 else
1108 mask = (ItemBase.GetDebugActionsMask() & (~type));
1109
1110 DiagToggleRPCAction(mask, ScriptCaller.Create(ItemBase.SetDebugActionsMask), ItemBase.HasDebugActionsMask(type), ERPCs.DIAG_ITEM_DEBUG_ACTIONS);
1111 }
1112
1113 //---------------------------------------------
1114 // SubscriberClient
1115 //---------------------------------------------
1117 {
1118 int mask;
1119 if (enable)
1120 {
1121 mask = (m_SystemsMask | system);//turn on bit
1122 }
1123 else
1124 {
1125 mask = (m_SystemsMask & (~system));//turn off bit
1126 }
1127
1128 if (mask != m_SystemsMask)
1129 {
1131 GetGame().RPCSingleParam(GetGame().GetPlayer(), ERPCs.DEV_DIAGMENU_SUBSCRIBE, CachedObjectsParams.PARAM1_INT, true, GetGame().GetPlayer().GetIdentity());
1133 }
1134 }
1135
1136
1137 //---------------------------------------------
1138 // Helper diag functions
1139 //---------------------------------------------
1140 static void DiagButtonActionParams(bool enabled, int id, ScriptCaller action, Param params)
1141 {
1142 if (enabled)
1143 {
1144 action.Invoke(params);
1145 DiagMenu.SetValue(id, false);
1146 }
1147 }
1148
1149 //---------------------------------------------
1150 static void DiagButtonAction(bool enabled, int id, ScriptCaller action)
1151 {
1153 }
1154
1155 //---------------------------------------------
1156 static void DiagButtonRPC(bool enabled, int id, int rpc, bool serverOnly = false)
1157 {
1160
1162 }
1163
1164 //---------------------------------------------
1165 static void DiagButtonRPCSelf(bool enabled, int id, int rpc)
1166 {
1169
1171 }
1172
1173 //---------------------------------------------
1174 static void DiagButtonRPCIntInt(bool enabled, int id, int value, int value2, int rpc, bool serverOnly = false)
1175 {
1177
1181
1183 }
1184
1185 //---------------------------------------------
1186 static void DiagToggleRPC(bool value, int current, int rpc)
1187 {
1188 if (value != current)
1189 SendDiagRPC(value, rpc, false);
1190 }
1191
1192 //---------------------------------------------
1193 static void DiagToggleRPC(int value, int current, int rpc)
1194 {
1195 if (value != current)
1196 SendDiagRPC(value, rpc, false);
1197 }
1198
1199 //---------------------------------------------
1200 static void DiagToggleRPC(float value, int current, int rpc)
1201 {
1202 if (value != current)
1203 SendDiagRPC(value, rpc, false);
1204 }
1205
1206 //---------------------------------------------
1207 static void DiagToggleRPCServer(bool value, out bool current, int rpc)
1208 {
1209 if (value != current)
1210 {
1211 current = value;
1212 SendDiagRPC(value, rpc, true);
1213 }
1214 }
1215
1216 //---------------------------------------------
1217 static void DiagToggleRPCServer(int value, out int current, int rpc)
1218 {
1219 if (value != current)
1220 {
1221 current = value;
1222 SendDiagRPC(value, rpc, true);
1223 }
1224 }
1225
1226 //---------------------------------------------
1227 static void DiagToggleRPCServer(float value, out float current, int rpc)
1228 {
1229 if (value != current)
1230 {
1231 current = value;
1232 SendDiagRPC(value, rpc, true);
1233 }
1234 }
1235
1236 //---------------------------------------------
1237 static void DiagToggleRPCAction(int value, ScriptCaller action, int current, int rpc)
1238 {
1239 if (value != current)
1240 {
1242 action.Invoke(value);
1243 }
1244 }
1245
1246 //---------------------------------------------
1247 static void DiagToggleAction(int value, ScriptCaller action, int current)
1248 {
1249 if (value != current)
1250 action.Invoke(value);
1251 }
1252
1253 //---------------------------------------------
1254 static void SendDiagRPCSelf(Param value, int rpc)
1255 {
1257 if (player)
1258 GetGame().RPCSelfSingleParam(player, rpc, value);
1259 }
1260
1261 //---------------------------------------------
1263 {
1264 SendDiagRPCSelf(null, param.param1);
1265 }
1266
1267 //---------------------------------------------
1269 {
1270 SendDiagRPCSelf(param.param2, param.param1);
1271 }
1272
1273 //---------------------------------------------
1274 static void SendDiagRPC(Param value, int rpc, bool serverOnly = false)
1275 {
1277 if (player)
1278 {
1279 PlayerIdentity playerIdentity = player.GetIdentity();
1280 if (GetGame().IsMultiplayer() && playerIdentity)
1281 GetGame().RPCSingleParam(player, rpc, value, true, playerIdentity);
1282
1283 if (!GetGame().IsMultiplayer() || !serverOnly)
1284 GetGame().RPCSelfSingleParam(player, rpc, value);
1285 }
1286 }
1287
1288 //---------------------------------------------
1290 {
1291 SendDiagRPC(null, param.param1, param.param2);
1292 }
1293
1294 //---------------------------------------------
1296 {
1297 SendDiagRPC(param.param3, param.param1, param.param2);
1298 }
1299
1300 //---------------------------------------------
1301 static void SendDiagRPC(int rpc, bool serverOnly = false)
1302 {
1304 }
1305
1306 //---------------------------------------------
1307 static void SendDiagRPC(bool value, int rpc, bool serverOnly = false)
1308 {
1311 }
1312
1313 //---------------------------------------------
1314 static void SendDiagRPC(int value, int rpc, bool serverOnly = false)
1315 {
1318 }
1319
1320 //---------------------------------------------
1321 static void SendDiagRPC(float value, int rpc, bool serverOnly = false)
1322 {
1325 }
1326#endif
1327}
enum EScriptInvokerInsertFlags ScriptCaller()
Designed to hold 1 valid call.
Param3 int
PhxInteractionLayers
Definition DayZPhysics.c:2
void DayZPlayerImplementFallDamage(DayZPlayer pPlayer)
Mission mission
DiagMenuIDs
Definition EDiagMenuIDs.c:2
ERPCs
Definition ERPCs.c:2
PlayerBase GetPlayer()
DebugActionType
PluginBase GetPlugin(typename plugin_type)
void UiHintPanel(Widget parent_widget)
static ref Param1< bool > PARAM1_BOOL
static ref Param1< int > PARAM1_INT
static ref Param2< int, int > PARAM2_INT_INT
static ref Param1< float > PARAM1_FLOAT
static ref Param2< float, float > PARAM2_FLOAT_FLOAT
static bool GetHitIndicationPPEEnabled()
Super root of all classes in Enforce script.
Definition EnScript.c:11
static proto bool RayCastBullet(vector begPos, vector endPos, PhxInteractionLayers layerMask, Object ignoreObj, out Object hitObject, out vector hitPosition, out vector hitNormal, out float hitFraction)
static void CheckValues()
range 0..180, randomized offset of direction to make it less acurate
static float m_DistanceAdjust
range 0..1, a point where the fading starts
void Show(bool show)
Definition gameplay.c:639
static bool IsWeaponLogEnable()
Definition Debug.c:799
static bool IsBaseBuildingLogEnable()
Definition Debug.c:779
static bool IsInventoryReservationLogEnable()
Definition Debug.c:739
static bool IsSymptomLogEnable()
Definition Debug.c:789
static bool IsSyncLogEnable()
Definition Debug.c:759
static bool IsInventoryHFSMLogEnable()
Definition Debug.c:749
static bool IsBleedingChancesLogEnable()
Definition Debug.c:814
static bool IsInventoryMoveLogEnable()
Definition Debug.c:729
static bool IsActionLogEnable()
Definition Debug.c:719
static bool IsQuickbarLogEnable()
Definition Debug.c:769
Definition EnMath.c:7
Mission class.
Definition gameplay.c:668
void RefreshCrosshairVisibility()
Definition gameplay.c:759
Hud GetHud()
Definition gameplay.c:701
void HideCrosshairVisibility()
Definition gameplay.c:761
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
The class that will be instanced (moddable)
Definition gameplay.c:376
void PluginSceneManager()
void OnInit()
void OnRPC(PlayerBase player, int rpc_type, ParamsReadContext ctx)
static bool m_GunParticlesState
Definition gameplay.c:1478
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
class DayZPlayerCameraResult DayZPlayerCamera(DayZPlayer pPlayer, HumanInputController pInput)
Definition dayzplayer.c:56
proto native CGame GetGame()
static proto void SetValue(int id, int value)
Set value at the given script id.
static proto bool GetBool(int id, bool reverse=false)
Get value as bool from the given script id.
class DiagMenu Shape
don't call destructor directly. Use Destroy() instead
static proto bool BindCallback(int id, func callback)
Bind a callback to the given id.
static proto int GetValue(int id)
Get value as int from the given script id.
static proto float GetRangeValue(int id)
Get range value at the given script id.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float WrapFloat(float f, float min, float max)
Returns wrap number to specified interval [min, max[.
proto native void OnUpdate()
Definition tools.c:333