private static bool ExplodeDestructible(ExplosionGrenade __instance, IDestructible dest, Footprinting.Footprint attacker, Vector3 pos, ExplosionGrenade setts, out bool __result) { __result = false; try { if (Physics.Linecast(dest.CenterOfMass, pos, InventorySystem.Items.MicroHID.MicroHIDItem.WallMask)) { return(false); } Vector3 a = dest.CenterOfMass - pos; float magnitude = a.magnitude; float num = setts._playerDamageOverDistance.Evaluate(magnitude); ReferenceHub referenceHub; bool flag = ReferenceHub.TryGetHubNetID(dest.NetworkId, out referenceHub); if (flag && referenceHub.characterClassManager.CurRole.team == Team.SCP) { num *= setts._scpDamageMultiplier; } Vector3 force = (1f - magnitude / setts._maxRadius) * (a / magnitude) * setts._rigidbodyLiftForce + Vector3.up * setts._rigidbodyLiftForce; if (num > 0f && dest.Damage(num, new PlayerStatsSystem.ExplosionDamageHandler(attacker, force, num, 50), dest.CenterOfMass) && flag) { float num2 = setts._effectDurationOverDistance.Evaluate(magnitude); bool flag2 = attacker.Hub == referenceHub; if (num2 > 0f && (flag2 || HitboxIdentity.CheckFriendlyFire(attacker.Hub, referenceHub, false))) { float minimalDuration = setts._minimalDuration; ExplosionGrenade.TriggerEffect <CustomPlayerEffects.Burned>(referenceHub, num2 * setts._burnedDuration, minimalDuration); ExplosionGrenade.TriggerEffect <CustomPlayerEffects.Deafened>(referenceHub, num2 * setts._deafenedDuration, minimalDuration); ExplosionGrenade.TriggerEffect <CustomPlayerEffects.Concussed>(referenceHub, num2 * setts._concussedDuration, minimalDuration); } if (!flag2 && attacker.Hub != null) { Hitmarker.SendHitmarker(attacker.Hub, 1f); } referenceHub.inventory.connectionToClient.Send(new GunHitMessage(false, num, pos), 0); } __result = true; return(false); } catch (Exception ex) { Logger.Get.Error($"Synapse-FF: ExplodeDestructible failed!!\n{ex}"); return(true); } }
public static Player GetPlayer(this Footprinting.Footprint footprint) => footprint.Hub?.GetPlayer();