public static TargetingParameters LinearLink(ILinearShield source) => new TargetingParameters { canTargetLocations = false, canTargetSelf = false, canTargetPawns = false, canTargetFires = false, canTargetBuildings = true, canTargetItems = false, validator = targetInfo => { var shield = LinearShieldUtility.Find(targetInfo.Thing); if (shield != null && source.CanLinkWith(shield)) { // TODO add efficiency LinearShieldUtility.DrawFieldBetween(source.Position, shield.Position, shield.Map, Color.grey); return(true); } return(false); } };
public static bool CanLinkWith(ILinearShield one, ILinearShield two) { return(one.CanLinkWith(two) && two.CanLinkWith(one) && !BlockingBetween(one, two).Any()); }