private LocalTargetInfo CurrentTargetUnderMouse(bool mustBeHittableNowIfNotMelee) { if (!IsTargeting) { return(LocalTargetInfo.Invalid); } TargetingParameters targetingParameters = (targetingSource != null) ? targetingSource.targetParams : targetParams; LocalTargetInfo localTargetInfo = GenUI.TargetsAtMouse_NewTemp(targetingParameters, thingsOnly: false, targetingSource).FirstOrFallback(LocalTargetInfo.Invalid); if (localTargetInfo.IsValid && targetingSource != null) { if (mustBeHittableNowIfNotMelee && !(localTargetInfo.Thing is Pawn) && !targetingSource.IsMeleeAttack) { if (targetingSourceAdditionalPawns != null && targetingSourceAdditionalPawns.Any()) { bool flag = false; for (int i = 0; i < targetingSourceAdditionalPawns.Count; i++) { Verb targetingVerb = GetTargetingVerb(targetingSourceAdditionalPawns[i]); if (targetingVerb != null && targetingVerb.CanHitTarget(localTargetInfo)) { flag = true; break; } } if (!flag) { localTargetInfo = LocalTargetInfo.Invalid; } } else if (!targetingSource.CanHitTarget(localTargetInfo)) { localTargetInfo = LocalTargetInfo.Invalid; } } if (localTargetInfo == targetingSource.Caster && !targetingParameters.canTargetSelf) { localTargetInfo = LocalTargetInfo.Invalid; } } return(localTargetInfo); }