public static void Postfix(Weapon __instance, ICombatant target, Vector3 position, Quaternion rotation, ref bool __result) { if (__result == true) { float forbiddenRange = CustomAmmoCategories.getWeaponForbiddenRange(__instance); if (forbiddenRange > (double)CustomAmmoCategories.Epsilon) { float ActualRange = Vector3.Distance(position, target.TargetPosition); if (ActualRange < forbiddenRange) { __result = false; } } } }
public static void Postfix(LOFCache __instance, AbstractActor shootingUnit, ICombatant targetUnit, Weapon weapon, ref bool __result) { if (__result == true) { float forbiddenRange = CustomAmmoCategories.getWeaponForbiddenRange(weapon); if (forbiddenRange > (double)CustomAmmoCategories.Epsilon) { float ActualRange = Vector3.Distance(shootingUnit.CurrentPosition, targetUnit.CurrentPosition); if (ActualRange < forbiddenRange) { __result = false; } } } }
public static void Postfix(AbstractActor attackerUnit, Vector3 attackPosition, ICombatant targetUnit, Vector3 targetPosition, bool targetIsEvasive, Weapon weapon, int numTargets, ref float __result) { if (__result > CustomAmmoCategories.Epsilon) { float forbiddenRange = CustomAmmoCategories.getWeaponForbiddenRange(weapon); if (forbiddenRange > (double)CustomAmmoCategories.Epsilon) { float ActualRange = Vector3.Distance(attackPosition, targetPosition); if (ActualRange < forbiddenRange) { __result = 0.0f; } } } }