private void LinkToNearbyBuildings() { UnlinkAll(); CompProperties_Facility props = Props; if (props.linkableBuildings != null) { for (int i = 0; i < props.linkableBuildings.Count; i++) { foreach (Thing item in parent.Map.listerThings.ThingsOfDef(props.linkableBuildings[i])) { CompAffectedByFacilities compAffectedByFacilities = item.TryGetComp <CompAffectedByFacilities>(); if (compAffectedByFacilities != null && compAffectedByFacilities.CanLinkTo(parent)) { linkedBuildings.Add(item); compAffectedByFacilities.Notify_NewLink(parent); } } } } }
private void LinkToNearbyBuildings() { this.UnlinkAll(); CompProperties_Facility props = this.Props; if (props.linkableBuildings == null) { return; } for (int i = 0; i < props.linkableBuildings.Count; i++) { foreach (Thing current in this.parent.Map.listerThings.ThingsOfDef(props.linkableBuildings[i])) { CompAffectedByFacilities compAffectedByFacilities = current.TryGetComp <CompAffectedByFacilities>(); if (compAffectedByFacilities != null && compAffectedByFacilities.CanLinkTo(this.parent)) { this.linkedBuildings.Add(current); compAffectedByFacilities.Notify_NewLink(this.parent); } } } }