Example #1
0
        public override void Print(SectionLayer layer, Thing thing)
        {
            if (thing is Blueprint)
            {
                base.Print(layer, thing);
                Printer_Plane.PrintPlane(layer, thing.TrueCenter() + new Vector3(0, 0.1f, 0), this.drawSize, this.arrow00, thing.Rotation.AsAngle);
            }
            else
            {
                var conveyor = thing as IBeltConbeyorLinkable;
                if (!Building_BeltConveyorUGConnector.IsConveyorUGConnecterDef(thing.def) && conveyor != null && conveyor.IsUnderground && !(layer is SectionLayer_UGConveyor))
                {
                    return;
                }

                base.Print(layer, thing);
                Printer_Plane.PrintPlane(layer, thing.TrueCenter() + new Vector3(0, 0.1f, 0), this.drawSize, this.arrow00, thing.Rotation.AsAngle);
                if (conveyor != null)
                {
                    conveyor.OutputRots.Where(x => x != thing.Rotation)
                    .ForEach(r => Printer_Plane.PrintPlane(layer, thing.TrueCenter(), this.drawSize, this.arrow01, r.AsAngle));
                }
            }
        }
Example #2
0
        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_BeltConveyorUGConnector.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_BeltConveyorUGConnector.IsConveyorUGConnecterDef(b.Def))
                            .FirstOption().GetOrDefault(null);

            if (cellThing == null)
            {
                return(false);
            }
            return(Building_BeltConveyor.CanLink(parent, cellThing.Thing, def, cellThing.Def));
        }