Example #1
0
        public override void DrawExtraSelectionOverlays()
        {
            base.DrawExtraSelectionOverlays();
            Blueprint_Install blueprint_Install = InstallBlueprintUtility.ExistingBlueprintFor(this);

            if (blueprint_Install != null)
            {
                GenDraw.DrawLineBetween(this.TrueCenter(), blueprint_Install.TrueCenter());
            }
        }
        public static MinifiedThing MakeMinified(this Thing thing)
        {
            MinifiedThing result;

            if (!thing.def.Minifiable)
            {
                Log.Warning("Tried to minify " + thing + " which is not minifiable.", false);
                result = null;
            }
            else
            {
                if (thing.Spawned)
                {
                    thing.DeSpawn(DestroyMode.Vanish);
                }
                if (thing.holdingOwner != null)
                {
                    Log.Warning("Can't minify thing which is in a ThingOwner because we don't know how to handle it. Remove it from the container first. holder=" + thing.ParentHolder, false);
                    result = null;
                }
                else
                {
                    Blueprint_Install blueprint_Install = InstallBlueprintUtility.ExistingBlueprintFor(thing);
                    MinifiedThing     minifiedThing     = (MinifiedThing)ThingMaker.MakeThing(thing.def.minifiedDef, null);
                    minifiedThing.InnerThing = thing;
                    if (blueprint_Install != null)
                    {
                        blueprint_Install.SetThingToInstallFromMinified(minifiedThing);
                    }
                    if (minifiedThing.InnerThing.stackCount > 1)
                    {
                        Log.Warning(string.Concat(new object[]
                        {
                            "Tried to minify ",
                            thing.LabelCap,
                            " with stack count ",
                            minifiedThing.InnerThing.stackCount,
                            ". Clamped stack count to 1."
                        }), false);
                        minifiedThing.InnerThing.stackCount = 1;
                    }
                    result = minifiedThing;
                }
            }
            return(result);
        }