DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ConstructionDebugs.c
См. документацию.
1#ifdef DIAG_DEVELOPER
2
3class ConstructionDebug
4{
5 //Context: ConstructionBase.CanDismantlePart
6 protected static string m_DismantlePartName;
7 protected static bool m_DismantleConstructed;
8 protected static bool m_DismantleHasDependents;
9 protected static bool m_DismantleSupportFailed;
10
11 //Context: ActionDismantlePart
12 protected static string m_ActionDismantlePartName;
13 protected static string m_ActionDismantleReason;
14
15 //Context: ActionPartInfo
16 protected static int m_TargetComponentIdx = -1;
17 protected static ref map<int, ref ActionInfoDebugData> m_ActionInfoDebug = new map<int, ref ActionInfoDebugData>();
18
19 //Context: Collision printout data
20 protected static string m_CollidingPartName;
21 protected static ref array<string> m_ValidCollisions = new array<string>();
22
23 //Context: Insidebox printout data
24 protected static string m_InsideboxPartName;
25
26 static void ResetValues()
27 {
28 m_DismantlePartName = "";
29 m_DismantleConstructed = false;
30 m_DismantleHasDependents = false;
31 m_DismantleSupportFailed = false;
32
33 m_ActionDismantlePartName = "";
34 m_ActionDismantleReason = "";
35
36 m_TargetComponentIdx = -1;
37 m_ActionInfoDebug.Clear();
38
39 m_CollidingPartName = "";
40 m_ValidCollisions.Clear();
41
42 m_InsideboxPartName = "";
43 }
44
45 static void SetCanDismantlePartData(ConstructionDismantleDebugData data)
46 {
47 m_DismantlePartName = data.partName;
48 m_DismantleConstructed = data.constructed;
49 m_DismantleHasDependents = data.hasDependents;
50 m_DismantleSupportFailed = !data.supportState;
51 }
52
53 static void ResetDismantlePartData()
54 {
55 m_DismantlePartName = "";
56 }
57
58 static void SetActionDismantleData(ActionDismantleDebugData data)
59 {
60 m_ActionDismantlePartName = data.partName;
61 m_ActionDismantleReason = data.reason;
62 }
63
64 static void ResetActionDismantleData()
65 {
66 m_ActionDismantlePartName = "";
67 }
68
69 static void AddBuildPartInfoData(ActionInfoDebugData data)
70 {
71 UpdateTargetComponentIdx(data.componentIdx);
72
73 m_ActionInfoDebug.Set(data.partName.Hash(), data);
74 }
75
76 static void RemoveBuildPartInfoData(string partName) //?
77 {
78 m_ActionInfoDebug.Remove(partName.Hash());
79 }
80
81 protected static void UpdateTargetComponentIdx(int idx)
82 {
83 if (m_TargetComponentIdx != idx)
84 {
85 m_ActionInfoDebug.Clear();
86 m_TargetComponentIdx = idx;
87 }
88 }
89
90 static void SetCollisionPrintoutData(string partName, notnull array<string> collisions)
91 {
92 m_CollidingPartName = partName;
93 m_ValidCollisions.Copy(collisions);
94 }
95
96 static void ResetCollisionPrintoutData()
97 {
98 m_CollidingPartName = "";
99 m_ValidCollisions.Clear();
100 }
101
102 static void SetInsideboxCheckDebugData(string partName)
103 {
104 m_InsideboxPartName = partName;
105 }
106
107 static void Update()
108 {
109 DrawCanDismantlePart();
110 DrawActionDismantle();
111 DrawBuildPartInfo();
112 DrawCollisionPrintouts();
113 DrawInsideboxPrintouts();
114 }
115
116 protected static void DrawCanDismantlePart()
117 {
118 if (m_DismantlePartName != "")
119 {
120 DbgUI.Begin("CanDismantlePart Generic Debug", 0, 0);
121 {
122 DbgUI.Text("cannot dismantle: " + m_DismantlePartName);
123 if (!m_DismantleConstructed)
124 DbgUI.Text(" not constructed");
125 if (m_DismantleHasDependents)
126 DbgUI.Text(" has dependent part/s");
127 if (m_DismantleSupportFailed)
128 DbgUI.Text(" support check failed");
129 }
130 DbgUI.End();
131 }
132 }
133
134 protected static void DrawActionDismantle()
135 {
136 if (m_ActionDismantlePartName != "")
137 {
138 DbgUI.Begin("ActionDismantlePart Specific Debug", 0, 200);
139 {
140 DbgUI.Text("cannot dismantle: " + m_ActionDismantlePartName);
141 DbgUI.Text("reason: " + m_ActionDismantleReason);
142 }
143 DbgUI.End();
144 }
145 }
146
147 protected static void DrawBuildPartInfo()
148 {
149 DbgUI.Begin("ActionPartInfo Debug", 400, 0);
150 {
151 DbgUI.Text("target component idx: " + m_TargetComponentIdx);
152 DbgUI.Spacer(10);
153
154 foreach (int hash, ref ActionInfoDebugData data : m_ActionInfoDebug)
155 {
156 if (data.failureMask & EConstructionInfoCategories.PART_MISSING_REQUIREMENT)
157 DbgUI.Text(data.partName + " - missing required part/s!");
158 if (data.failureMask & EConstructionInfoCategories.PART_MISSING_SUPPORT)
159 DbgUI.Text(data.partName + " - missing statics support/s!");
160 if (data.failureMask & EConstructionInfoCategories.PART_CONFLICTED)
161 DbgUI.Text(data.partName + " - conflicts with part: " + data.conflictingPart + "!");
162 if (data.failureMask & EConstructionInfoCategories.MATERIALS_PRESENCE)
163 DbgUI.Text(data.partName + " - missing material in slot: " + data.missingSlot + " (qty: " + data.missingQty + ")!");
164 if (data.failureMask & EConstructionInfoCategories.MATERIALS_DAMAGE)
165 DbgUI.Text(data.partName + " - material/s ruined!");
166 if (data.failureMask & EConstructionInfoCategories.TOOL_PRESENCE)
167 DbgUI.Text(data.partName + " - not buildable with: " + data.badToolType + "!");
168 DbgUI.Spacer(10);
169 }
170 }
171 DbgUI.End();
172 }
173
174 protected static void DrawCollisionPrintouts()
175 {
176 if (m_CollidingPartName != "")
177 {
178 DbgUI.Begin("IsCollidingEx Debug", 0, 300);
179 {
180 DbgUI.Text("part " + m_CollidingPartName + " blocked by:");
181 foreach (string name : m_ValidCollisions)
182 {
183 DbgUI.Text(" " + name);
184 }
185 }
186 DbgUI.End();
187 }
188 }
189
190 protected static void DrawInsideboxPrintouts()
191 {
192 if (m_InsideboxPartName != "")
193 {
194 DbgUI.Begin("Insidebox Debug", 800, 0);
195 {
196 DbgUI.Text("insidebox check failed for part: " + m_InsideboxPartName);
197 }
198 DbgUI.End();
199 }
200 }
201}
202
203class ConstructionDismantleDebugData
204{
205 string partName;
206 bool constructed;
207 bool hasDependents;
208 bool supportState;
209}
210
211class ActionDismantleDebugData
212{
213 string partName;
214 string reason;
215}
216
217class ActionInfoDebugData
218{
219 string partName;
220 int failureMask;
221 int componentIdx; //target component idx
222 string conflictingPart;
223 string missingSlot;
224 float missingQty;
225 string badToolType;
226}
227
228//------------------------------
229
230class CharacterStepsDebug
231{
232 protected static string m_BoneName;
233 protected static string m_LastSurfaceType;
234
235 static void Update()
236 {
237 DrawStepPrintouts();
238 }
239
240 static void SetStepData(string boneName, string lastSurfaceName)
241 {
242 m_BoneName = boneName;
243 m_LastSurfaceType = lastSurfaceName;
244 }
245
246 protected static void DrawStepPrintouts()
247 {
248 if (m_BoneName != "")
249 {
250 DbgUI.Begin("PlayerSurface Debug", 10, 10);
251 {
252 DbgUI.Text("Leg: " + m_BoneName);
253 DbgUI.Text("Last surface type: " + m_LastSurfaceType);
254 }
255 DbgUI.End();
256 }
257 }
258}
259
260#endif
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
EConstructionInfoCategories
Определения ConstructionConstants.c:2
map
Определения ControlsXboxNew.c:4
void ResetValues()
Определения ScriptConsoleWeatherTab.c:463
proto native int Hash()
Returns hash of string.
proto native volatile void Update()
Определения PlayerSoundManager.c:125