static public IAdvancedFacilityConnector GetCompProperties(ThingDef def) { for (int i = 0; i < def.comps.Count; i++) { IAdvancedFacilityConnector t = def.comps[i] as IAdvancedFacilityConnector; if (t != null) { return(t); } } return(null); }
static void Postfix(ref ThingDef facilityDef, ref IntVec3 facilityPos, ref Rot4 facilityRot, ref ThingDef myDef, ref IntVec3 myPos, ref Rot4 myRot, ref bool __result) { IAdvancedFacilityConnector self = GetCompProperties(facilityDef); if (self == null) { self = GetCompProperties(myDef); } ; if (self == null) { return; } bool res = self.CanLinkTo(__result, facilityDef, facilityPos, facilityRot, myDef, myPos, myRot); __result = res; }