public override bool ShouldLinkWith(IntVec3 c, Thing parent) { if (!c.InBounds(parent.Map)) { return(false); } if (parent.Position + parent.Rotation.FacingCell == c) { return(true); } var blueprint = parent as Blueprint != null; var def = blueprint ? (ThingDef)parent.def.entityDefToBuild : parent.def; var cellThing = blueprint ? c.GetThingList(parent.Map) .SelectMany(t => Option(t as Blueprint)) .Where(b => b.def.entityDefToBuild as ThingDef != null) .Select(b => new { Thing = (Thing)b, Def = (ThingDef)b.def.entityDefToBuild }) .Where(b => Building_BeltConveyor.IsBeltConveyorDef(b.Def) || Building_BeltConveyorUGConnecter.IsConveyorUGConnecterDef(b.Def)) .FirstOption().GetOrDefault(null) : c.GetThingList(parent.Map) .SelectMany(t => Option(t as Building)) .Select(b => new { Thing = (Thing)b, Def = b.def }) .Where(b => Building_BeltConveyor.IsBeltConveyorDef(b.Def) || Building_BeltConveyorUGConnecter.IsConveyorUGConnecterDef(b.Def)) .FirstOption().GetOrDefault(null); if (cellThing == null) { return(false); } return(Building_BeltConveyor.CanLink(parent, cellThing.Thing, def, cellThing.Def)); }
protected override void TakePrintFrom(Thing t) { if (t.Faction != null && t.Faction != Faction.OfPlayer) { return; } if (Building_BeltConveyor.IsBeltConveyorDef(t.def) && Building_BeltConveyor.IsUndergroundDef(t.def)) { t.Graphic.Print(this, t); } }