public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            if (Props.targetFuelLevelConfigurable)
            {
                Command_SetTargetFuelLevel command_SetTargetFuelLevel = new Command_SetTargetFuelLevel();
                command_SetTargetFuelLevel.refuelable   = this;
                command_SetTargetFuelLevel.defaultLabel = "CommandSetTargetFuelLevel".Translate();
                command_SetTargetFuelLevel.defaultDesc  = "CommandSetTargetFuelLevelDesc".Translate();
                command_SetTargetFuelLevel.icon         = SetTargetFuelLevelCommand;
                yield return(command_SetTargetFuelLevel);
            }
            if (Props.showFuelGizmo && Find.Selector.SingleSelectedThing == parent)
            {
                Gizmo_RefuelableFuelStatus gizmo_RefuelableFuelStatus = new Gizmo_RefuelableFuelStatus();
                gizmo_RefuelableFuelStatus.refuelable = this;
                yield return(gizmo_RefuelableFuelStatus);
            }
            if (Props.showAllowAutoRefuelToggle)
            {
                Command_Toggle command_Toggle = new Command_Toggle();
                command_Toggle.defaultLabel = "CommandToggleAllowAutoRefuel".Translate();
                command_Toggle.defaultDesc  = "CommandToggleAllowAutoRefuelDesc".Translate();
                command_Toggle.hotKey       = KeyBindingDefOf.Command_ItemForbid;
                command_Toggle.icon         = (allowAutoRefuel ? TexCommand.ForbidOff : TexCommand.ForbidOn);
                command_Toggle.isActive     = () => allowAutoRefuel;
                command_Toggle.toggleAction = delegate
                {
                    allowAutoRefuel = !allowAutoRefuel;
                };
                yield return(command_Toggle);
            }
            if (Prefs.DevMode)
            {
                Command_Action command_Action = new Command_Action();
                command_Action.defaultLabel = "Debug: Set fuel to 0";
                command_Action.action       = delegate
                {
                    fuel = 0f;
                    parent.BroadcastCompSignal("Refueled");
                };
                yield return(command_Action);

                Command_Action command_Action2 = new Command_Action();
                command_Action2.defaultLabel = "Debug: Set fuel to 0.1";
                command_Action2.action       = delegate
                {
                    fuel = 0.1f;
                    parent.BroadcastCompSignal("Refueled");
                };
                yield return(command_Action2);

                Command_Action command_Action3 = new Command_Action();
                command_Action3.defaultLabel = "Debug: Set fuel to max";
                command_Action3.action       = delegate
                {
                    fuel = Props.fuelCapacity;
                    parent.BroadcastCompSignal("Refueled");
                };
                yield return(command_Action3);
            }
        }
Example #2
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                    if (base.Props.targetFuelLevelConfigurable)
                    {
                        Command_SetTargetFuelLevel setTargetFuelLevel = new Command_SetTargetFuelLevel();
                        setTargetFuelLevel.refuelable   = this;
                        setTargetFuelLevel.defaultLabel = "CommandSetTargetFuelLevel".Translate();
                        setTargetFuelLevel.defaultDesc  = "CommandSetTargetFuelLevelDesc".Translate();
                        setTargetFuelLevel.icon         = CompRefuelable.SetTargetFuelLevelCommand;
                        this.$current = setTargetFuelLevel;
                        if (!this.$disposing)
                        {
                            this.$PC = 1;
                        }
                        return(true);
                    }
                    break;

                case 1u:
                    break;

                case 2u:
                    goto IL_12C;

                case 3u:
                {
                    Command_Action defuel = new Command_Action();
                    defuel.defaultLabel = "Debug: Set fuel to 0.1";
                    defuel.action       = delegate()
                    {
                        this.fuel = 0.1f;
                        this.parent.BroadcastCompSignal("Refueled");
                    };
                    this.$current = defuel;
                    if (!this.$disposing)
                    {
                        this.$PC = 4;
                    }
                    return(true);
                }

                case 4u:
                {
                    Command_Action setFuelToMax = new Command_Action();
                    setFuelToMax.defaultLabel = "Debug: Set fuel to max";
                    setFuelToMax.action       = delegate()
                    {
                        this.fuel = base.Props.fuelCapacity;
                        this.parent.BroadcastCompSignal("Refueled");
                    };
                    this.$current = setFuelToMax;
                    if (!this.$disposing)
                    {
                        this.$PC = 5;
                    }
                    return(true);
                }

                case 5u:
                    goto IL_22E;

                default:
                    return(false);
                }
                if (base.Props.showFuelGizmo && Find.Selector.SingleSelectedThing == this.parent)
                {
                    Gizmo_RefuelableFuelStatus status = new Gizmo_RefuelableFuelStatus();
                    status.refuelable = this;
                    this.$current     = status;
                    if (!this.$disposing)
                    {
                        this.$PC = 2;
                    }
                    return(true);
                }
IL_12C:
                if (Prefs.DevMode)
                {
                    Command_Action zerofuel = new Command_Action();
                    zerofuel.defaultLabel = "Debug: Set fuel to 0";
                    zerofuel.action       = delegate()
                    {
                        this.fuel = 0f;
                        this.parent.BroadcastCompSignal("Refueled");
                    };
                    this.$current = zerofuel;
                    if (!this.$disposing)
                    {
                        this.$PC = 3;
                    }
                    return(true);
                }
IL_22E:
                this.$PC = -1;
                return(false);
            }