3 const float FX_RANGE_MAX_MULT = 1.0;
7 super.OnExplosionEffects(source, directHit, componentIndex, surface, pos, surfNormal, energyFactor, explosionFactor, isWater, ammoType);
13 vector headPos = player.GetDamageZonePos(
"Head");
14 float ammoRangeKill =
GetGame().ConfigGetFloat(
string.Format(
"CfgAmmo %1 indirectHitRange", ammoType));
15 float ammoRangeMaxMult = 4.0;
17 string indirectHitRangeMultiplier =
string.Format(
"CfgAmmo %1 indirectHitRangeMultiplier", ammoType);
18 if (
GetGame().ConfigIsExisting(indirectHitRangeMultiplier))
21 ammoRangeMaxMult =
Math.Clamp(
GetGame().ConfigGetFloat(indirectHitRangeMultiplier), 1.0,
float.
MAX);
24 float ammoRangeMax = ammoRangeKill * ammoRangeMaxMult;
25 ammoRangeMax =
Math.Clamp(ammoRangeMax * FX_RANGE_MAX_MULT, ammoRangeKill, ammoRangeMax);
27 float dist =
vector.Distance(headPos, pos);
28 float distSq =
vector.DistanceSq(headPos, pos);
29 float radiusMaxSq =
Math.SqrFloat(ammoRangeMax);
31 if (distSq <= radiusMaxSq)
35 EntityAI parent = invItem.GetHierarchyParent();
38 if (!parent || !parent.IsFireplace())
41 excluded.Insert(parent);
44 excluded.Insert(
this);
49 DayZPhysics.RaycastRVProxy(rayParams, results, excluded);
53 for (
int i = 0; i < results.Count(); i++)
55 if (results[i].obj && !results[i].obj.IsInherited(
ItemBase))
57 hitObjects.Insert(results[i].obj);
62 if (hitObjects.Count() &&
PlayerBase.Cast(hitObjects[0]))
65 if (ammoRangeMax == ammoRangeKill)
69 effectCoef = 1 - ((dist - ammoRangeKill) / (ammoRangeMax - ammoRangeKill));
70 effectCoef =
Math.Clamp(effectCoef, 0.1, 100.0);
72 player.OnPlayerReceiveFlashbangHitStart(MiscGameplayFunctions.IsPlayerOrientedTowardPos(player, pos, 60));
73 player.GetFlashbangEffect().SetupFlashbangValues(effectCoef, effectCoef, effectCoef);
92 void ~FlashGrenade() {}