public static void DrawLinesToPotentialThingsToLinkTo(ThingDef myDef, IntVec3 myPos, Rot4 myRot, Map map) { CompProperties_Facility compProperties = myDef.GetCompProperties <CompProperties_Facility>(); Vector3 a = GenThing.TrueCenter(myPos, myRot, myDef.size, myDef.Altitude); for (int i = 0; i < compProperties.linkableBuildings.Count; i++) { foreach (Thing item in map.listerThings.ThingsOfDef(compProperties.linkableBuildings[i])) { CompAffectedByFacilities compAffectedByFacilities = item.TryGetComp <CompAffectedByFacilities>(); if (compAffectedByFacilities != null && compAffectedByFacilities.CanPotentiallyLinkTo(myDef, myPos, myRot)) { GenDraw.DrawLineBetween(a, item.TrueCenter()); compAffectedByFacilities.DrawRedLineToPotentiallySupplantedFacility(myDef, myPos, myRot); } } } }