92 {
93
96 MiscGameplayFunctions.GetHeadBonePos(player,posHead);
99
100
101 if (!added_item)
102 return null;
103
104
105 float item_quantity = 0;
108
109 GetGame().ConfigGetFloatArray(cfg_skinning_organ_class +
"quantityMinMax", quant_min_max);
110 GetGame().ConfigGetFloatArray(cfg_skinning_organ_class +
"quantityMinMaxCoef", quant_min_max_coef);
111
112
113 if (quant_min_max.Count() > 0)
114 {
115 float soft_skill_manipulated_value = (quant_min_max.Get(0)+ quant_min_max.Get(1)) / 2;
116 item_quantity =
Math.
RandomFloat(soft_skill_manipulated_value, quant_min_max.Get(1));
117 }
118
119 if (quant_min_max_coef.Count() > 0)
120 {
121 float coef =
Math.
RandomFloat(quant_min_max_coef.Get(0), quant_min_max_coef.Get(1));
122 item_quantity = added_item.GetQuantityMax() * coef;
123 }
124
125 if (
GetGame().ConfigGetFloat(cfg_skinning_organ_class +
"quantity") > 0)
126 item_quantity =
g_Game.ConfigGetFloat(cfg_skinning_organ_class +
"quantity");
127
128 if (
GetGame().ConfigGetFloat(cfg_skinning_organ_class +
"quantityCoef") > 0)
129 {
130 float coef2 =
g_Game.ConfigGetFloat(cfg_skinning_organ_class +
"quantityCoef");
131 item_quantity = added_item.GetQuantityMax() * coef2;
132 }
133
134 if (item_quantity > 0)
135 {
136 item_quantity =
Math.
Round(item_quantity);
138 }
139
140
141 float item_apply_tool_damage_coef =
GetGame().ConfigGetFloat(cfg_skinning_organ_class +
"transferToolDamageCoef");
142
143 if (item_apply_tool_damage_coef > 0)
144 {
145 float tool_dmg_coef = 1 - tool.GetHealth01();
146 float organ_dmg_coef = tool_dmg_coef * item_apply_tool_damage_coef;
147 added_item.DecreaseHealthCoef(organ_dmg_coef);
148 }
149
150 added_item.InsertAgent(
eAgents.SALMONELLA, 1);
151 return added_item;
152 }
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].