public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (Gizmo c in this.< GetGizmos > __BaseCallProxy0())
            {
                yield return(c);
            }
            if (this.def.Minifiable && base.Faction == Faction.OfPlayer)
            {
                yield return(InstallationDesignatorDatabase.DesignatorFor(this.def));
            }
            Command buildCopy = BuildCopyCommandUtility.BuildCopyCommand(this.def, base.Stuff);

            if (buildCopy != null)
            {
                yield return(buildCopy);
            }
            if (base.Faction == Faction.OfPlayer)
            {
                foreach (Command facility in BuildFacilityCommandUtility.BuildFacilityCommands(this.def))
                {
                    yield return(facility);
                }
            }
            yield break;
        }
Exemple #2
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (var gizmo in base.GetGizmos())
            {
                yield return(gizmo);
            }

            if (allHeatingElements == null)
            {
                allHeatingElements = new List <BuildableDef>();
                foreach (var def in DefDatabase <ThingDef> .AllDefsListForReading)
                {
                    if (def.thingClass.IsInstanceOfType(typeof(Building_HeatingElement)))
                    {
                        allHeatingElements.Add(def);
                    }
                }
            }

            foreach (var item in allHeatingElements)
            {
                var allowedDesignator = BuildCopyCommandUtility.BuildCommand(item, null, "RF.HeatingElement.Build".Translate(item.label), null, true);
                if (allowedDesignator != null)
                {
                    yield return(allowedDesignator);
                }
            }
        }
Exemple #3
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (Gizmo gizmo in base.GetGizmos())
            {
                yield return(gizmo);
            }
            if (((def.BuildableByPlayer && def.passability != Traversability.Impassable && !def.IsDoor) || def.building.forceShowRoomStats) && Gizmo_RoomStats.GetRoomToShowStatsFor(this) != null && Find.Selector.SingleSelectedObject == this)
            {
                yield return(new Gizmo_RoomStats(this));
            }
            Gizmo selectMonumentMarkerGizmo = QuestUtility.GetSelectMonumentMarkerGizmo(this);

            if (selectMonumentMarkerGizmo != null)
            {
                yield return(selectMonumentMarkerGizmo);
            }
            if (def.Minifiable && base.Faction == Faction.OfPlayer)
            {
                yield return(InstallationDesignatorDatabase.DesignatorFor(def));
            }
            Command command = BuildCopyCommandUtility.BuildCopyCommand(def, base.Stuff);

            if (command != null)
            {
                yield return(command);
            }
            if (base.Faction == Faction.OfPlayer)
            {
                foreach (Command item in BuildFacilityCommandUtility.BuildFacilityCommands(def))
                {
                    yield return(item);
                }
            }
        }
Exemple #4
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (var c in base.GetGizmos())
            {
                yield return(c);
            }

            if (def.Minifiable && Faction == Faction.OfPlayer)
            {
                yield return(InstallationDesignatorDatabase.DesignatorFor(def));
            }

            var buildCopy = BuildCopyCommandUtility.BuildCopyCommand(def, Stuff);

            if (buildCopy != null)
            {
                yield return(buildCopy);
            }

            if (Faction == Faction.OfPlayer)
            {
                foreach (var facility in BuildFacilityCommandUtility.BuildFacilityCommands(def))
                {
                    yield return(facility);
                }
            }
        }
        public override IEnumerable <Gizmo> GetGizmos()
        {
            using (IEnumerator <Gizmo> enumerator = base.GetGizmos().GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    Gizmo c = enumerator.Current;
                    yield return(c);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            if (base.def.Minifiable && base.Faction == Faction.OfPlayer)
            {
                yield return((Gizmo)InstallationDesignatorDatabase.DesignatorFor(base.def));

                /*Error: Unable to find new state assignment for yield return*/;
            }
            Command buildCopy = BuildCopyCommandUtility.BuildCopyCommand(base.def, base.Stuff);

            if (buildCopy == null)
            {
                yield break;
            }
            yield return((Gizmo)buildCopy);

            /*Error: Unable to find new state assignment for yield return*/;
IL_0161:
            /*Error near IL_0162: Unexpected return in MoveNext()*/;
        }
Exemple #6
0
 public static void parrot_designate_single_cell(IntVec3 c, ThingDef stuffDef, Rot4 placingRot, BuildableDef entDef)
 {
     use_native = true;
     try
     {
         var designator = BuildCopyCommandUtility.FindAllowedDesignator(entDef, false);
         designator.SetStuffDef(stuffDef);
         designator.GetType().GetField("placingRot", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(designator, placingRot);
         designator.DesignateSingleCell(c);
     }
     finally
     {
         use_native = false;
     }
 }
Exemple #7
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (Gizmo c in base.GetGizmos())
            {
                yield return(c);
            }
            if (this.def.Minifiable && base.Faction == Faction.OfPlayer)
            {
                yield return(InstallationDesignatorDatabase.DesignatorFor(this.def));
            }
            Command buildCopy = BuildCopyCommandUtility.BuildCopyCommand(this.def, base.Stuff);

            if (buildCopy != null)
            {
                yield return(buildCopy);
            }
        }
        private bool DoWork(Slate slate)
        {
            Map map = slate.Get <Map>("map");

            if (map == null)
            {
                return(false);
            }
            float       x2             = slate.Get("points", 0f);
            SimpleCurve value          = pointsToMaxItemMarketValueCurve.GetValue(slate);
            float       num            = maxMarketValueFactor.GetValue(slate) ?? 1f;
            float       maxMarketValue = value.Evaluate(x2) * num;
            SimpleCurve value2         = pointsToRequiredWorkCurve.GetValue(slate);
            float       randomInRange  = (workAmountRandomFactorRange.GetValue(slate) ?? FloatRange.One).RandomInRange;
            float       num2           = value2.Evaluate(x2) * randomInRange;

            tmpCandidates.Clear();
            for (int j = 0; j < allWorkTables.Count; j++)
            {
                if (BuildCopyCommandUtility.FindAllowedDesignator(allWorkTables[j]) == null)
                {
                    continue;
                }
                List <RecipeDef> recipes = allWorkTables[j].AllRecipes;
                for (int i = 0; i < recipes.Count; i++)
                {
                    if (!recipes[i].AvailableNow || !recipes[i].products.Any() || recipes[i].PotentiallyMissingIngredients(null, map).Any())
                    {
                        continue;
                    }
                    foreach (ThingDef stuff in recipes[i].products[0].thingDef.MadeFromStuff ? GenStuff.AllowedStuffsFor(recipes[i].products[0].thingDef) : Gen.YieldSingle <ThingDef>(null))
                    {
                        if (stuff != null && (!map.listerThings.ThingsOfDef(stuff).Any() || stuff.stuffProps.commonality < minStuffCommonality.GetValue(slate)))
                        {
                            continue;
                        }
                        int num3 = 0;
                        if (stuff != null)
                        {
                            List <Thing> list = map.listerThings.ThingsOfDef(stuff);
                            for (int k = 0; k < list.Count; k++)
                            {
                                num3 += list[k].stackCount;
                            }
                        }
                        float num4 = recipes[i].WorkAmountTotal(stuff);
                        if (!(num4 > 0f))
                        {
                            continue;
                        }
                        int num5 = Mathf.FloorToInt(num2 / num4);
                        if (stuff != null)
                        {
                            IngredientCount ingredientCount = recipes[i].ingredients.Where((IngredientCount x) => x.filter.Allows(stuff)).MaxByWithFallback((IngredientCount x) => x.CountRequiredOfFor(stuff, recipes[i]));
                            num5 = Mathf.Min(num5, Mathf.FloorToInt((float)num3 / (float)ingredientCount.CountRequiredOfFor(stuff, recipes[i])));
                        }
                        if (num5 > 0)
                        {
                            tmpCandidates.Add(new Pair <ThingStuffPair, int>(new ThingStuffPair(recipes[i].products[0].thingDef, stuff), recipes[i].products[0].count * num5));
                        }
                    }
                }
            }
            tmpCandidates.RemoveAll((Pair <ThingStuffPair, int> x) => x.Second <= 0);
            tmpCandidates.RemoveAll((Pair <ThingStuffPair, int> x) => StatDefOf.MarketValue.Worker.GetValueAbstract(x.First.thing, x.First.stuff) > maxMarketValue);
            if (!tmpCandidates.Any())
            {
                return(false);
            }
            Pair <ThingStuffPair, int> pair = tmpCandidates.RandomElement();
            int   num6           = Mathf.Min(Mathf.RoundToInt(maxMarketValue / StatDefOf.MarketValue.Worker.GetValueAbstract(pair.First.thing, pair.First.stuff)), pair.Second);
            float randomInRange2 = (productionItemCountRandomFactorRange.GetValue(slate) ?? FloatRange.One).RandomInRange;

            num6 = Mathf.RoundToInt((float)num6 * randomInRange2);
            num6 = Mathf.Max(num6, 1);
            slate.Set(storeProductionItemDefAs.GetValue(slate), pair.First.thing);
            slate.Set(storeProductionItemStuffAs.GetValue(slate), pair.First.stuff);
            slate.Set(storeProductionItemCountAs.GetValue(slate), num6);
            string value3 = storeProductionItemLabelAs.GetValue(slate);

            if (!string.IsNullOrEmpty(value3))
            {
                slate.Set(value3, GenLabel.ThingLabel(pair.First.thing, pair.First.stuff, num6));
            }
            return(true);
        }
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                bool flag = false;

                switch (num)
                {
                case 0u:
                    enumerator = base.< GetGizmos > __BaseCallProxy0().GetEnumerator();
                    num        = 4294967293u;
                    break;

                case 1u:
                    break;

                case 2u:
                    goto IL_114;

                case 3u:
                    goto IL_160;

                case 4u:
                    goto IL_195;

                default:
                    return(false);
                }
                try
                {
                    switch (num)
                    {
                    }
                    if (enumerator.MoveNext())
                    {
                        c             = enumerator.Current;
                        this.$current = c;
                        if (!this.$disposing)
                        {
                            this.$PC = 1;
                        }
                        flag = true;
                        return(true);
                    }
                }
                finally
                {
                    if (!flag)
                    {
                        if (enumerator != null)
                        {
                            enumerator.Dispose();
                        }
                    }
                }
                if (this.def.Minifiable && base.Faction == Faction.OfPlayer)
                {
                    this.$current = InstallationDesignatorDatabase.DesignatorFor(this.def);
                    if (!this.$disposing)
                    {
                        this.$PC = 2;
                    }
                    return(true);
                }
IL_114:
                buildCopy = BuildCopyCommandUtility.BuildCopyCommand(this.def, base.Stuff);
                if (buildCopy != null)
                {
                    this.$current = buildCopy;
                    if (!this.$disposing)
                    {
                        this.$PC = 3;
                    }
                    return(true);
                }
IL_160:
                if (base.Faction != Faction.OfPlayer)
                {
                    goto IL_20C;
                }
                enumerator2 = BuildFacilityCommandUtility.BuildFacilityCommands(this.def).GetEnumerator();
                num         = 4294967293u;
                try
                {
IL_195:
                    switch (num)
                    {
                    }
                    if (enumerator2.MoveNext())
                    {
                        facility      = enumerator2.Current;
                        this.$current = facility;
                        if (!this.$disposing)
                        {
                            this.$PC = 4;
                        }
                        flag = true;
                        return(true);
                    }
                }
                finally
                {
                    if (!flag)
                    {
                        if (enumerator2 != null)
                        {
                            enumerator2.Dispose();
                        }
                    }
                }
IL_20C:
                this.$PC = -1;
                return(false);
            }
        public bool BuildingDesignatorControl()
        {
            if (Find.CurrentMap == null || Find.DesignatorManager == null)
            {
                return(true);
            }
            var Dem = Find.DesignatorManager.SelectedDesignator;

            if (Dem != null && Dem is Designator_Build)
            {
                if (Event.current.type == EventType.MouseDown && Event.current.button == 2)
                {
                    //Better than UI.mousecell
                    MiddleClickCell = Find.CameraDriver.MapPosition;
                }

                //Middle click to select designator
                if (Event.current.type == EventType.MouseUp && Event.current.button == 2 && MiddleClickCell == Find.CameraDriver.MapPosition)
                {
                    Thing   targetThing = null;
                    IntVec3 UICell      = UI.MouseCell();
                    Map     map         = Find.CurrentMap;
                    if (map == null)
                    {
                        return(false);
                    }
                    if (!UICell.InBounds(map))
                    {
                        return(false);
                    }

                    //Search for blueprints
                    if (targetThing == null)
                    {
                        targetThing = UICell.GetFirstThing <Blueprint>(map);
                    }

                    //Search for frames
                    if (targetThing == null)
                    {
                        targetThing = UICell.GetFirstThing <Frame>(map);
                    }

                    //Search for Buildings
                    if (targetThing == null)
                    {
                        targetThing = UICell.GetFirstBuilding(map);
                    }

                    //Can't find things
                    if (targetThing == null)
                    {
                        //SoundDefOf.ClickReject.PlayOneShotOnCamera();
                        Event.current.Use();
                        return(false);
                    }

                    //Find designator
                    Designator_Build Desig = null;
                    Desig = BuildCopyCommandUtility.FindAllowedDesignator(targetThing.def);

                    if (Desig == null && (targetThing is Blueprint || targetThing is Frame))
                    {
                        Desig = BuildCopyCommandUtility.FindAllowedDesignator(targetThing.def.entityDefToBuild);
                    }

                    if ((targetThing.def.BuildableByPlayer || targetThing.def.entityDefToBuild?.BuildableByPlayer == true) && Desig != null)
                    {
                        //Set stuff

                        if (targetThing.Stuff != null)
                        {
                            Desig.SetStuffDef(targetThing.Stuff);
                        }
                        if ((targetThing as Blueprint_Build)?.stuffToUse != null)
                        {
                            Desig.SetStuffDef((targetThing as Blueprint_Build).stuffToUse);
                        }
                        if ((targetThing as Blueprint_Install)?.Stuff != null)
                        {
                            Desig.SetStuffDef((targetThing as Blueprint_Install).Stuff);
                        }
                        if ((targetThing as Frame)?.Stuff != null)
                        {
                            Desig.SetStuffDef((targetThing as Frame).Stuff);
                        }

                        Find.DesignatorManager.Select(Desig);
                        SoundDefOf.Click.PlayOneShotOnCamera();
                    }
                    else
                    {
                        //SoundDefOf.ClickReject.PlayOneShotOnCamera();
                    }

                    Event.current.Use();
                    return(false);
                }

                //Cancel drag

                //First, absorb Right click event, handle it manually
                if (Event.current.type == EventType.MouseDown && Event.current.button == 1)
                {
                    Event.current.Use();
                }

                if (IsCancelDragging)
                {
                    GenUI.DrawMouseAttachment(CancelIcon, string.Empty, 0);
                }
                if (Input.GetMouseButton(1))
                {
                    if (IsCancelDragging)
                    {
                        //RenderCancelHighlights();
                    }
                    else
                    {
                        //Start cancel dragging

                        IsCancelDragging = true;
                        DragStart        = UI.MouseCell();
                        SoundDefOf.Click.PlayOneShotOnCamera(null);
                    }
                }

                //Right click up
                else if (Event.current.type == EventType.MouseUp && Event.current.button == 1)
                {
                    IsCancelDragging = false;
                    selectedThings.Clear();
                    Event.current.Use();

                    if (selectedThings.Any())
                    {
                        selectedThings.Do(delegate(Thing t) { t.Destroy(DestroyMode.Cancel); });
                        SoundDefOf.Designate_Cancel.PlayOneShotOnCamera();
                    }
                    else
                    {
                        SoundDefOf.CancelMode.PlayOneShotOnCamera(null);
                        Find.DesignatorManager.Deselect();
                        return(false);
                    }
                }

                //While cancel dragging, left click to abort
                if (Event.current.type == EventType.MouseDown && Event.current.button == 0 && IsCancelDragging)
                {
                    selectedThings.Clear();
                    IsCancelDragging = false;
                    SoundDefOf.CancelMode.PlayOneShotOnCamera(null);
                    Find.DesignatorManager.Deselect();
                    Event.current.Use();
                    return(false);
                }

                //Drag to place blueprints

                var BuildDesignator = (Designator_Build)Dem;

                if (BuildDesignator.DraggableDimensions != 0)
                {
                    return(true);
                }

                if (Event.current.type == EventType.MouseDown && Event.current.button == 0)
                {
                    PreviousCell = IntVec3.Invalid;
                    ClickedFlag  = true;
                    Event.current.Use();
                }
                if (Event.current.type == EventType.MouseUp && Event.current.button == 0)
                {
                    PreviousCell = IntVec3.Invalid;
                    ClickedFlag  = false;
                    Event.current.Use();
                }

                if (Input.GetMouseButton(0) && !Mouse.IsInputBlockedNow && PreviousCell != UI.MouseCell() && ClickedFlag)
                {
                    var acceptanceReport = BuildDesignator.CanDesignateCell(UI.MouseCell());

                    if (DebugSettings.godMode && acceptanceReport.Accepted) //Handle god mode
                    {
                        Traverse     t        = Traverse.Create(BuildDesignator);
                        BuildableDef entDef   = t.Field("entDef").GetValue <BuildableDef>();
                        Rot4         rot      = t.Field("placingRot").GetValue <Rot4>();
                        CellRect     cellRect = GenAdj.OccupiedRect(UI.MouseCell(), rot, entDef.Size);
                        foreach (IntVec3 c in cellRect)
                        {
                            var thinglist = c.GetThingList(Find.CurrentMap);
                            for (int i = 0; i < thinglist.Count; i++)
                            {
                                var thing3 = thinglist[i];
                                if (!GenConstruct.CanPlaceBlueprintOver(entDef, thing3.def))
                                {
                                    acceptanceReport = new AcceptanceReport("SpaceAlreadyOccupied_DevFail");
                                }
                            }
                        }
                    }
                    if (acceptanceReport.Accepted)
                    {
                        BuildDesignator.DesignateSingleCell(UI.MouseCell());
                        BuildDesignator.Finalize(true);
                    }
                    else
                    {
                        //If this is first cell clicked
                        if (PreviousCell == IntVec3.Invalid)
                        {
                            Messages.Message(acceptanceReport.Reason, MessageTypeDefOf.SilentInput, false);
                            BuildDesignator.Finalize(false);
                        }
                    }

                    PreviousCell = UI.MouseCell();
                    //Event.current.Use();
                }
                return(false);
            }
            else //This is not Building designator
            {
                IsCancelDragging = false;
                return(true);
            }
        }
Exemple #11
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            Command_Action mineMode = new Command_Action()
            {
                icon          = this.icon,
                defaultLabel  = this.defaultLabel,
                defaultDesc   = defaultDesc,
                hotKey        = KeyBindingDefOf.Misc10,
                activateSound = SoundDefOf.Click,
                action        = delegate()
                {
                    Find.WindowStack.Add(MakeModeMenu(this));
                },
            };

            // Only allow this option if stonecutting has been researched
            // The default behavior is to allow resources, but not blocks
            if (!QuarryDefOf.Stonecutting.IsFinished)
            {
                mineMode.Disable(Static.ReportGizmoLackingResearch);
            }
            yield return(mineMode);

            yield return(new Command_Toggle()
            {
                icon = Static.DesignationHaul,
                defaultLabel = Static.LabelHaulMode,
                defaultDesc = HaulDescription,
                hotKey = KeyBindingDefOf.Misc11,
                activateSound = SoundDefOf.Click,
                isActive = () => autoHaul,
                toggleAction = () => { autoHaul = !autoHaul; },
            });

            yield return(new Command_Action
            {
                defaultLabel = Static.CommandBedSetOwnerLabel,
                icon = ContentFinder <Texture2D> .Get("UI/Commands/AssignOwner", true),
                defaultDesc = Static.CommandSetOwnerDesc,
                action = delegate
                {
                    Find.WindowStack.Add(new Dialog_AssignBuildingOwner(this.TryGetComp <CompAssignableToPawn>()));
                },
                hotKey = KeyBindingDefOf.Misc3
            });

            /*
             * if (base.GetGizmos() != null)
             * {
             *  Log.Message("do base.GetGizmos()");
             *  foreach (Command c in base.GetGizmos())
             *  {
             *      Log.Message(string.Format("base.GetGizmos() {0}",c));
             *      yield return c;
             *  }
             * }
             */

            IEnumerator <Gizmo> enumerator = null;

            if (((this.def.BuildableByPlayer && this.def.passability != Traversability.Impassable && !this.def.IsDoor) || this.def.building.forceShowRoomStats) && Gizmo_RoomStats.GetRoomToShowStatsFor(this) != null && Find.Selector.SingleSelectedObject == this)
            {
                yield return(new Gizmo_RoomStats(this));
            }
            if (this.def.Minifiable && base.Faction == Faction.OfPlayer)
            {
                yield return(InstallationDesignatorDatabase.DesignatorFor(this.def));
            }
            Command command = BuildCopyCommandUtility.BuildCopyCommand(this.def, base.Stuff);

            if (command != null)
            {
                yield return(command);
            }
            if (base.Faction == Faction.OfPlayer)
            {
                foreach (Command command2 in BuildFacilityCommandUtility.BuildFacilityCommands(this.def))
                {
                    yield return(command2);
                }
                IEnumerator <Command> enumerator2 = null;
            }
            if (forbiddable != null)
            {
                foreach (Gizmo item in forbiddable.CompGetGizmosExtra())
                {
                    yield return(item);
                }
                ;
            }
            yield break;
            Log.Message("post base.GetGizmos()");
        }
Exemple #12
0
        // Note to whoever wants to add to this method (hi jptrrs!):
        // You can just do
        // foreach (Gizmo c in base.GetGizmos())
        // {
        //    yield return c;
        // }
        // yield return [whatever you want to add];
        //
        // No need to copy this method.
        public override IEnumerable <Gizmo> GetGizmos()
        {
            // Display the original gizmos (includes the swap guest bed button via patch)
            foreach (var gizmo in base.GetGizmos())
            {
                switch (gizmo)
                {
                case Command_Toggle toggle: {
                    // Disable prisoner and medical buttons
                    if (toggle.defaultLabel == "CommandBedSetForPrisonersLabel".Translate() || toggle.defaultLabel == "CommandBedSetAsMedicalLabel".Translate())
                    {
                        gizmo.Disable();
                    }
                    break;
                }

                case Command_Action action: {
                    // Disable set owner button
                    if (action.defaultLabel == "CommandThingSetOwnerLabel".Translate())
                    {
                        action.Disable();
                    }
                    break;
                }
                }
                yield return(gizmo);
            }

            // Gizmo for drawing guest room info
            if (Find.Selector.SingleSelectedObject == this)
            {
                if (Stats.lastCalculated == 0 || Stats.room == null)
                {
                    UpdateStats();
                }
                yield return(new Gizmo_GuestBedStats(this));
            }

            // Add buttons to decrease / increase the fee
            yield return(new Command_Action
            {
                defaultLabel = "CommandBedDecreaseFeeLabel".Translate(feeStep),
                defaultDesc = "CommandBedDecreaseFeeDesc".Translate(feeStep, MoodEffect),
                icon = ContentFinder <Texture2D> .Get("UI/Commands/ChangePriceDown"),
                action = () => AdjustFee(-feeStep),
                hotKey = KeyBindingDefOf.Misc5,
                disabled = rentalFee < feeStep
            });

            yield return(new Command_Action
            {
                defaultLabel = "CommandBedIncreaseFeeLabel".Translate(feeStep),
                defaultDesc = "CommandBedIncreaseFeeDesc".Translate(feeStep, MoodEffect),
                icon = ContentFinder <Texture2D> .Get("UI/Commands/ChangePriceUp"),
                action = () => AdjustFee(feeStep),
                hotKey = KeyBindingDefOf.Misc6
            });

            // Get base def
            var defName = def.defName.ReplaceFirst("Guest", string.Empty);
            var baseDef = DefDatabase <ThingDef> .GetNamed(defName);

            // Add build copy command
            Command buildCopy = BuildCopyCommandUtility.BuildCopyCommand(baseDef, Stuff);

            if (buildCopy != null)
            {
                yield return(buildCopy);
            }
        }
        // RimWorld.Building_Grave
        //public override Graphic Graphic


        public override IEnumerable <Gizmo> GetGizmos()
        {
            if (this.AllComps != null)
            {
                for (int i = 0; i < AllComps.Count; i++)
                {
                    foreach (Gizmo item in AllComps[i].CompGetGizmosExtra())
                    {
                        yield return(item);
                    }
                }
            }

            if (((def.BuildableByPlayer && def.passability != Traversability.Impassable && !def.IsDoor) || def.building.forceShowRoomStats) && Gizmo_RoomStats.GetRoomToShowStatsFor(this) != null && Find.Selector.SingleSelectedObject == this)
            {
                yield return(new Gizmo_RoomStats(this));
            }
            if (def.Minifiable && base.Faction == Faction.OfPlayer)
            {
                yield return(InstallationDesignatorDatabase.DesignatorFor(def));
            }
            Command command = BuildCopyCommandUtility.BuildCopyCommand(def, base.Stuff);

            if (command != null)
            {
                yield return(command);
            }
            if (base.Faction == Faction.OfPlayer)
            {
                foreach (Command item in BuildFacilityCommandUtility.BuildFacilityCommands(def))
                {
                    yield return(item);
                }
            }

            var p = Corpse?.InnerPawn ?? (Pawn)(innerContainer.FirstOrDefault()) ?? null;

            if ((p?.IsVampire() ?? false) || (p?.HasVampireHediffs() ?? false))
            {
                foreach (Gizmo y in HarmonyPatches.GraveGizmoGetter(p, this))
                {
                    yield return(y);
                }
            }

            if (this.GetComps <CompVampBed>().FirstOrDefault() is CompVampBed vbed)
            {
                if (vbed.Bed != null)
                {
                    if (vbed.Bed.def.building.bed_humanlike && base.Faction == Faction.OfPlayer)
                    {
                        Command_Toggle command_Toggle0 = new Command_Toggle();
                        command_Toggle0.defaultLabel = "ROMV_VampiresOnly".Translate();
                        command_Toggle0.defaultDesc  = "ROMV_VampiresOnlyDesc".Translate();
                        command_Toggle0.icon         = TexButton.ROMV_VampiresOnly;
                        command_Toggle0.isActive     = (() => vbed.VampiresOnly);
                        command_Toggle0.toggleAction = delegate
                        {
                            vbed.VampiresOnly = !vbed.VampiresOnly;
                        };
                        command_Toggle0.hotKey = KeyBindingDefOf.Misc2;
                        yield return(command_Toggle0);

                        Command_Toggle command_Toggle = new Command_Toggle();
                        command_Toggle.defaultLabel = "CommandBedSetForPrisonersLabel".Translate();
                        command_Toggle.defaultDesc  = "CommandBedSetForPrisonersDesc".Translate();
                        command_Toggle.icon         = ContentFinder <Texture2D> .Get("UI/Commands/ForPrisoners");

                        command_Toggle.isActive     = (() => vbed.Bed.ForPrisoners);
                        command_Toggle.toggleAction = delegate
                        {
                            AccessTools.Method(typeof(Building_Bed), "ToggleForPrisonersByInterface").Invoke(vbed.Bed, null);
                        };
                        if (!((bool)(AccessTools.Method(typeof(Building_Bed), "RoomCanBePrisonCell").Invoke(vbed.Bed, new object[] { this.GetRoom() }))) && !vbed.Bed.ForPrisoners)
                        {
                            command_Toggle.Disable("CommandBedSetForPrisonersFailOutdoors".Translate());
                        }
                        command_Toggle.hotKey       = KeyBindingDefOf.Misc3;
                        command_Toggle.turnOffSound = null;
                        command_Toggle.turnOnSound  = null;
                        yield return(command_Toggle);

                        Command_Toggle command_Toggle2 = new Command_Toggle();
                        command_Toggle2.defaultLabel = "CommandBedSetAsMedicalLabel".Translate();
                        command_Toggle2.defaultDesc  = "CommandBedSetAsMedicalDesc".Translate();
                        command_Toggle2.icon         = ContentFinder <Texture2D> .Get("UI/Commands/AsMedical");

                        command_Toggle2.isActive     = (() => vbed.Bed.Medical);
                        command_Toggle2.toggleAction = delegate
                        {
                            vbed.Bed.Medical = !vbed.Bed.Medical;
                        };
                        command_Toggle2.hotKey = KeyBindingDefOf.Misc2;
                        yield return(command_Toggle2);

                        if (!vbed.Bed.ForPrisoners && !vbed.Bed.Medical)
                        {
                            Command_Action command_Action = new Command_Action();
                            command_Action.defaultLabel = "CommandThingSetOwnerLabel".Translate();
                            command_Action.icon         = ContentFinder <Texture2D> .Get("UI/Commands/AssignOwner");

                            command_Action.defaultDesc = "CommandBedSetOwnerDesc".Translate();
                            command_Action.action      = delegate
                            {
                                Find.WindowStack.Add(new Dialog_AssignBuildingOwner(vbed.Bed.CompAssignableToPawn));
                            };
                            command_Action.hotKey = KeyBindingDefOf.Misc3;
                            yield return(command_Action);
                        }
                    }
                }
            }
        }