DayZ 1.24
Loading...
Searching...
No Matches
PluginRemotePlayerDebugClient.c
Go to the documentation of this file.
7
9{
13
20
21 override void OnInit()
22 {
23#ifndef NO_GUI
25#endif
26 }
27
28 override void OnUpdate(float delta_time)
29 {
30#ifndef NO_GUI
32#endif
33 }
34
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 }
46
48 {
49 for (int i = 0; i < MAX_SIMULTANIOUS_PLAYERS; ++i)
50 {
51 m_RootWidget[i].Show(enable);
53 }
54 }
55
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 }
94
95
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 }
124
126 {
127 float distance = vector.Distance(GetGame().GetCurrentCameraPosition(), other_player.GetPosition());
128 m_DistanceWidget[index].SetText(distance.ToString() + "m");
129 }
130
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 }
145
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 }
163
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 }
189
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 }
217
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 }
241}
void OnInit()
Definition AIBehaviour.c:49
void OnRPC(ParamsReadContext ctx)
ERPCs
Definition ERPCs.c:2
Icon x
void UpdateDistanceWidget(int index, PlayerBase other_player)
ref TextWidget m_DistanceWidget[MAX_SIMULTANIOUS_PLAYERS]
eRemoteDebugType m_DebugType
ref map< PlayerBase, ref RemotePlayerDamageDebug > m_PlayerDebugDamage
void EnableWidgets(bool enable)
void DebugDamage(PlayerBase player)
ref TextListboxWidget m_StatListWidgets[MAX_SIMULTANIOUS_PLAYERS]
ref TextListboxWidget m_DamageListWidgets[MAX_SIMULTANIOUS_PLAYERS]
void UpdateStatsWidget(int index, RemotePlayerStatDebug rpd)
void UpdateDamageWidget(int index, PlayerBase player)
void RequestPlayerInfo(PlayerBase player, int type)
ref Widget m_RootWidget[MAX_SIMULTANIOUS_PLAYERS]
void UpdateWidgetsStats()
ref array< ref RemotePlayerStatDebug > m_PlayerDebugStats
enum eRemoteDebugType MAX_SIMULTANIOUS_PLAYERS
void MergeDamage(array< ref RemotePlayerDamageDebug > delta)
ref Widget m_RootWidgetDamage[MAX_SIMULTANIOUS_PLAYERS]
void RemotePlayerStatDebug(PlayerBase player)
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto native CGame GetGame()
void PrintString(string s)
Helper for printing out string expression. Example: PrintString("Hello " + var);.
Definition EnScript.c:344
proto native void OnUpdate()
Definition tools.c:333
proto native Widget FindAnyWidget(string pathname)