250 {
252
253
254 string cfg_animal_class_path = "cfgVehicles " + body.GetType() + " " + "Skinning ";
255 vector bodyPosition = body.GetPosition();
256
257 if (!
g_Game.ConfigIsExisting(cfg_animal_class_path))
258 {
259 Debug.
Log(
"Failed to find class 'Skinning' in the config of: " + body.GetType());
260 return;
261 }
262
263
264 int child_count =
g_Game.ConfigGetChildrenCount(cfg_animal_class_path);
265
266 string item_to_spawn;
267 string cfg_skinning_organ_class;
268
269 for (int i1 = 0; i1 < child_count; i1++)
270 {
271
272 g_Game.ConfigGetChildName(cfg_animal_class_path, i1, cfg_skinning_organ_class);
273 cfg_skinning_organ_class = cfg_animal_class_path + cfg_skinning_organ_class + " ";
274 g_Game.ConfigGetText(cfg_skinning_organ_class +
"item", item_to_spawn);
275
276 if (item_to_spawn != "")
277 {
278
279 int item_count =
g_Game.ConfigGetInt(cfg_skinning_organ_class +
"count");
280
283 float zoneDmg = 0;
284
287
288 if (itemCount.Count() > 0)
289 {
290 item_count = 0;
291 for (int z = 0; z < itemZones.Count(); z++)
292 {
293 zoneDmg = body.GetHealth01(itemZones[z], "Health");
294 zoneDmg *= itemCount[z];
296 }
297 }
298
299 for (int i2 = 0; i2 < item_count; i2++)
300 {
301 ItemBase spawn_result =
CreateOrgan(action_data.m_Player, bodyPosition, item_to_spawn, cfg_skinning_organ_class, action_data.m_MainItem);
302
303
304
306 if (qtCoeff > 0)
307 {
308 float avgDmgZones = 0;
309 for (int c2 = 0; c2 < itemZones.Count(); c2++)
310 {
311 avgDmgZones += body.GetHealth01(itemZones[c2], "Health");
312 }
313
314 avgDmgZones = avgDmgZones/itemZones.Count();
315
316 if (spawn_result)
317 spawn_result.SetHealth01("","", avgDmgZones);
318 }
319
320
321 if (body.CanHaveTemperature() && spawn_result.CanHaveTemperature())
322 {
323 spawn_result.SetTemperatureDirect(body.GetTemperature());
324 spawn_result.SetFrozen(body.GetIsFrozen());
325 }
326
327
328 if ((item_to_spawn == "Lard") || (item_to_spawn == "Guts"))
329 {
330 if (body.IsKindOf("SurvivorBase"))
331 {
332 spawn_result.InsertAgent(
eAgents.BRAIN, 1);
333 }
334 }
335 }
336 }
337 }
338 }
ItemBase CreateOrgan(PlayerBase player, vector body_pos, string item_to_spawn, string cfg_skinning_organ_class, ItemBase tool)
proto native float ConfigGetFloat(string path)
Get float value from config on path.
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native void ConfigGetFloatArray(string path, out TFloatArray values)
Get array of floats from config on path.
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
static proto float Floor(float f)
Returns floor of value.