DayZ 1.24
Loading...
Searching...
No Matches
PluginRemotePlayerDebugClient.c File Reference

Go to the source code of this file.

Enumerations

enum  eRemoteDebugType { NONE , DAMAGE_ONLY , ALL }
 

Functions

override void OnInit ()
 
override void OnUpdate (float delta_time)
 
void InitWidgets ()
 
void EnableWidgets (bool enable)
 
void UpdateWidgetsStats ()
 
void UpdateDamageWidget (int index, PlayerBase player)
 
void UpdateDistanceWidget (int index, PlayerBase other_player)
 
void UpdateStatsWidget (int index, RemotePlayerStatDebug rpd)
 
void RequestPlayerInfo (PlayerBase player, int type)
 
void MergeDamage (array< ref RemotePlayerDamageDebug > delta)
 
void DebugDamage (PlayerBase player)
 
void OnRPC (ParamsReadContext ctx)
 

Variables

enum eRemoteDebugType MAX_SIMULTANIOUS_PLAYERS = 10
 
ref array< ref RemotePlayerStatDebugm_PlayerDebugStats = new array<ref RemotePlayerStatDebug>
 
ref map< PlayerBase, ref RemotePlayerDamageDebugm_PlayerDebugDamage = new map<PlayerBase, ref RemotePlayerDamageDebug>
 
ref Widget m_RootWidget [MAX_SIMULTANIOUS_PLAYERS]
 
ref Widget m_RootWidgetDamage [MAX_SIMULTANIOUS_PLAYERS]
 
ref TextListboxWidget m_StatListWidgets [MAX_SIMULTANIOUS_PLAYERS]
 
ref TextListboxWidget m_DamageListWidgets [MAX_SIMULTANIOUS_PLAYERS]
 
ref TextWidget m_DistanceWidget [MAX_SIMULTANIOUS_PLAYERS]
 
eRemoteDebugType m_DebugType
 

Enumeration Type Documentation

◆ eRemoteDebugType

Enumerator
NONE 
DAMAGE_ONLY 
ALL 

Definition at line 1 of file PluginRemotePlayerDebugClient.c.

Function Documentation

◆ DebugDamage()

void DebugDamage ( PlayerBase player)

Definition at line 190 of file PluginRemotePlayerDebugClient.c.

191 {
192 for (int i = 0; i < m_PlayerDebugStats.Count(); i++)
193 {
194 player = m_PlayerDebugStats.Get(i).GetPlayer();
195
196 PrintString("player:" + player.ToString());
197 m_PlayerDebugStats.Get(i).Debug();
198 PrintString("-------------------------------------");
199 }
200
201 for (i = 0; i < m_PlayerDebugDamage.Count(); i++)
202 {
203 PrintString("-------------------------------------");
204 if (m_PlayerDebugDamage.GetElement(i)) m_PlayerDebugDamage.GetElement(i).Debug();
205 PrintString("-------------------------------------");
206 }
207
208 for (i = 0; i < m_PlayerDebugDamage.Count(); i++)
209 {
210 PrintString("------------Debug Damage Start--------------");
213 obj.Debug();
214 PrintString("-------------Debug Damage End-------------");
215 }
216 }
ref map< PlayerBase, ref RemotePlayerDamageDebug > m_PlayerDebugDamage
ref array< ref RemotePlayerStatDebug > m_PlayerDebugStats
void PrintString(string s)
Helper for printing out string expression. Example: PrintString("Hello " + var);.
Definition EnScript.c:344

References RemotePlayerDamageDebug::Debug(), m_PlayerDebugDamage, m_PlayerDebugStats, and PrintString().

◆ EnableWidgets()

void EnableWidgets ( bool enable)

Definition at line 47 of file PluginRemotePlayerDebugClient.c.

48 {
49 for (int i = 0; i < MAX_SIMULTANIOUS_PLAYERS; ++i)
50 {
51 m_RootWidget[i].Show(enable);
53 }
54 }
ref Widget m_RootWidget[MAX_SIMULTANIOUS_PLAYERS]
enum eRemoteDebugType MAX_SIMULTANIOUS_PLAYERS
ref Widget m_RootWidgetDamage[MAX_SIMULTANIOUS_PLAYERS]

References m_RootWidget, m_RootWidgetDamage, and MAX_SIMULTANIOUS_PLAYERS.

Referenced by RequestPlayerInfo().

◆ InitWidgets()

void InitWidgets ( )

Definition at line 35 of file PluginRemotePlayerDebugClient.c.

36 {
37 for (int i = 0; i < MAX_SIMULTANIOUS_PLAYERS; ++i)
38 {
39 m_RootWidget[i] = GetGame().GetWorkspace().CreateWidgets("gui/layouts/debug/day_z_debug_remoteinfo.layout");
40 m_RootWidgetDamage[i] = GetGame().GetWorkspace().CreateWidgets("gui/layouts/debug/day_z_debug_remoteinfo_damage.layout");
42 m_StatListWidgets[i] = TextListboxWidget.Cast(m_RootWidget[i].FindAnyWidget("TextListboxWidget0"));
44 }
45 }
ref TextWidget m_DistanceWidget[MAX_SIMULTANIOUS_PLAYERS]
ref TextListboxWidget m_StatListWidgets[MAX_SIMULTANIOUS_PLAYERS]
ref TextListboxWidget m_DamageListWidgets[MAX_SIMULTANIOUS_PLAYERS]
proto native CGame GetGame()
proto native Widget FindAnyWidget(string pathname)

References FindAnyWidget(), GetGame(), m_DamageListWidgets, m_DistanceWidget, m_RootWidget, m_RootWidgetDamage, m_StatListWidgets, and MAX_SIMULTANIOUS_PLAYERS.

Referenced by OnInit().

◆ MergeDamage()

void MergeDamage ( array< ref RemotePlayerDamageDebug > delta)

Definition at line 164 of file PluginRemotePlayerDebugClient.c.

165 {
167 {
168 PlayerBase playerDelta = valueDelta.GetPlayer();
169
170 if (m_PlayerDebugDamage.Contains(null))
171 {
172 //cleans up garbage
174 }
175
176 if (m_PlayerDebugDamage.Contains(playerDelta))
177 {
180 valueDelta.GetReversed(damageList);
181
182 foreach (DamageData data : damageList)
183 valueLocal.InsertDamageObject(data);
184 }
185 else
187 }
188 }

References m_PlayerDebugDamage.

Referenced by OnRPC().

◆ OnInit()

override void OnInit ( )

Definition at line 21 of file PluginRemotePlayerDebugClient.c.

22 {
23#ifndef NO_GUI
25#endif
26 }

References InitWidgets().

◆ OnRPC()

void OnRPC ( ParamsReadContext ctx)

Definition at line 218 of file PluginRemotePlayerDebugClient.c.

219 {
221
223
224 ctx.Read(player_damage);
226 for (int x = 0; x < player_damage.Count(); x++)
227 {
229 if (value)
230 {
231 player = value.GetPlayer();
232 PrintString("debug damage: " + x.ToString() + "," + player.ToString());
233 value.Debug();
234
235 int xs = 1 + 1;
236 }
237 }
238
239 if (player_damage.Count() > 0) MergeDamage(player_damage);
240 }
Icon x
void MergeDamage(array< ref RemotePlayerDamageDebug > delta)

References m_PlayerDebugStats, MergeDamage(), PrintString(), and x.

◆ OnUpdate()

override void OnUpdate ( float delta_time)

Definition at line 28 of file PluginRemotePlayerDebugClient.c.

29 {
30#ifndef NO_GUI
32#endif
33 }
eRemoteDebugType m_DebugType
void UpdateWidgetsStats()

References m_DebugType, and UpdateWidgetsStats().

◆ RequestPlayerInfo()

void RequestPlayerInfo ( PlayerBase player,
int type )

Definition at line 146 of file PluginRemotePlayerDebugClient.c.

147 {
148#ifdef DIAG_DEVELOPER
149 if (type == 0)
150 EnableWidgets(false);
151 /*
152 else
153 {
154 EnableWidgets(true);
155 }
156 */
157 ScriptRPC rpc = new ScriptRPC();
158 m_DebugType = type;
159 rpc.Write(type);
160 rpc.Send(player, ERPCs.DEV_PLAYER_DEBUG_REQUEST, true, player.GetIdentity());
161#endif
162 }
ERPCs
Definition ERPCs.c:2
void EnableWidgets(bool enable)

References EnableWidgets(), and m_DebugType.

◆ UpdateDamageWidget()

void UpdateDamageWidget ( int index,
PlayerBase player )

Definition at line 96 of file PluginRemotePlayerDebugClient.c.

97 {
99 if (m_PlayerDebugDamage.Contains(player))
100 {
102 value.GetReversed(damage_list);
103
104 m_DamageListWidgets[index].ClearItems();
105 if (damage_list.Count() > 0)
106 {
107 m_DamageListWidgets[index].Show(true);
108 for (int i = 0; i < damage_list.Count(); ++i)
109 {
111 float value_global = data.GetValueGlobal();
112 float value_blood = data.GetValueBlood();
113 float value_shock = data.GetValueShock();
114
115 m_DamageListWidgets[index].AddItem(value_global.ToString(), null, 0, i);
116 m_DamageListWidgets[index].SetItem(i, value_blood.ToString(), null, 1);
117 m_DamageListWidgets[index].SetItem(i, value_shock.ToString(), null, 2);
118 }
119 }
120 else
121 m_DamageListWidgets[index].Show(false);
122 }
123 }

References m_DamageListWidgets, and m_PlayerDebugDamage.

Referenced by UpdateWidgetsStats().

◆ UpdateDistanceWidget()

void UpdateDistanceWidget ( int index,
PlayerBase other_player )

Definition at line 125 of file PluginRemotePlayerDebugClient.c.

126 {
127 float distance = vector.Distance(GetGame().GetCurrentCameraPosition(), other_player.GetPosition());
128 m_DistanceWidget[index].SetText(distance.ToString() + "m");
129 }
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.

References vector::Distance(), GetGame(), and m_DistanceWidget.

Referenced by UpdateWidgetsStats().

◆ UpdateStatsWidget()

void UpdateStatsWidget ( int index,
RemotePlayerStatDebug rpd )

Definition at line 131 of file PluginRemotePlayerDebugClient.c.

132 {
135 rpd.SerializeNames(names, m_DebugType);
136 rpd.SerializeValues(values, m_DebugType);
137 m_StatListWidgets[index].ClearItems();
138
139 for (int i = 0; i < names.Count(); ++i)
140 {
141 m_StatListWidgets[index].AddItem(names.Get(i), null, 0, i);
142 m_StatListWidgets[index].SetItem(i, values.Get(i), null, 1);
143 }
144 }

References m_DebugType, and m_StatListWidgets.

Referenced by UpdateWidgetsStats().

◆ UpdateWidgetsStats()

void UpdateWidgetsStats ( )

Definition at line 56 of file PluginRemotePlayerDebugClient.c.

57 {
58 int i = 0;
59 for (; i < m_PlayerDebugStats.Count(); ++i)
60 {
62 PlayerBase player = rpd.GetPlayer();
63
64 if (player)
65 {
66 vector pos = player.GetPosition();
67 vector screen_pos_stats = GetGame().GetScreenPos(pos + "0 0 0");
68 vector screen_pos_damage = GetGame().GetScreenPos(pos + "0 2 0");
71
72 if (screen_pos_stats[2] > 0 && screen_pos_stats[0] > 0 && screen_pos_stats[1] > 0)
73 {
74 m_RootWidget[i].Show(true);
75 m_RootWidgetDamage[i].Show(true);
79 }
80 else
81 {
82 m_RootWidget[i].Show(false);
83 m_RootWidgetDamage[i].Show(false);
84 }
85
86 }
87 }
88 for (; i < MAX_SIMULTANIOUS_PLAYERS; ++i)
89 {
90 m_RootWidget[i].Show(false);
91 m_RootWidgetDamage[i].Show(false);
92 }
93 }
void UpdateDistanceWidget(int index, PlayerBase other_player)
void UpdateStatsWidget(int index, RemotePlayerStatDebug rpd)
void UpdateDamageWidget(int index, PlayerBase player)
void RemotePlayerStatDebug(PlayerBase player)

References GetGame(), m_PlayerDebugStats, m_RootWidget, m_RootWidgetDamage, MAX_SIMULTANIOUS_PLAYERS, RemotePlayerStatDebug(), UpdateDamageWidget(), UpdateDistanceWidget(), and UpdateStatsWidget().

Referenced by OnUpdate().

Variable Documentation

◆ m_DamageListWidgets

Definition at line 17 of file PluginRemotePlayerDebugClient.c.

Referenced by InitWidgets(), and UpdateDamageWidget().

◆ m_DebugType

eRemoteDebugType m_DebugType

Definition at line 19 of file PluginRemotePlayerDebugClient.c.

Referenced by OnUpdate(), RequestPlayerInfo(), and UpdateStatsWidget().

◆ m_DistanceWidget

◆ m_PlayerDebugDamage

◆ m_PlayerDebugStats

◆ m_RootWidget

◆ m_RootWidgetDamage

ref Widget m_RootWidgetDamage[MAX_SIMULTANIOUS_PLAYERS]

Definition at line 15 of file PluginRemotePlayerDebugClient.c.

Referenced by EnableWidgets(), InitWidgets(), and UpdateWidgetsStats().

◆ m_StatListWidgets

◆ MAX_SIMULTANIOUS_PLAYERS

enum eRemoteDebugType MAX_SIMULTANIOUS_PLAYERS = 10