92 {
93
95 vector posHead = MiscGameplayFunctions.GetPlayerHeadPosition(player);
98
99
100 if (!added_item)
101 return null;
102
103
104 float item_quantity = 0;
107
108 g_Game.ConfigGetFloatArray(cfg_skinning_organ_class +
"quantityMinMax", quant_min_max);
109 g_Game.ConfigGetFloatArray(cfg_skinning_organ_class +
"quantityMinMaxCoef", quant_min_max_coef);
110
111
112 if (quant_min_max.Count() > 0)
113 {
114 float soft_skill_manipulated_value = (quant_min_max.Get(0)+ quant_min_max.Get(1)) / 2;
115 item_quantity =
Math.
RandomFloat(soft_skill_manipulated_value, quant_min_max.Get(1));
116 }
117
118 if (quant_min_max_coef.Count() > 0)
119 {
120 float coef =
Math.
RandomFloat(quant_min_max_coef.Get(0), quant_min_max_coef.Get(1));
121 item_quantity = added_item.GetQuantityMax() * coef;
122 }
123
124 if (
g_Game.ConfigGetFloat(cfg_skinning_organ_class +
"quantity") > 0)
125 item_quantity =
g_Game.ConfigGetFloat(cfg_skinning_organ_class +
"quantity");
126
127 if (
g_Game.ConfigGetFloat(cfg_skinning_organ_class +
"quantityCoef") > 0)
128 {
129 float coef2 =
g_Game.ConfigGetFloat(cfg_skinning_organ_class +
"quantityCoef");
130 item_quantity = added_item.GetQuantityMax() * coef2;
131 }
132
133 if (item_quantity > 0)
134 {
135 item_quantity =
Math.
Round(item_quantity);
137 }
138
139
140 float item_apply_tool_damage_coef =
g_Game.ConfigGetFloat(cfg_skinning_organ_class +
"transferToolDamageCoef");
141
142 if (item_apply_tool_damage_coef > 0)
143 {
144 float tool_dmg_coef = 1 - tool.GetHealth01();
145 float organ_dmg_coef = tool_dmg_coef * item_apply_tool_damage_coef;
146 added_item.DecreaseHealthCoef(organ_dmg_coef);
147 }
148
149 added_item.InsertAgent(
eAgents.SALMONELLA, 1);
150 return added_item;
151 }
const int ECE_PLACE_ON_SURFACE
Super root of all classes in Enforce script.
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Round(float f)
Returns mathematical round of value.
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].