public static Command BuildCommand(BuildableDef buildable, ThingDef stuff, string label, string description, bool allowHotKey) { Designator_Build des = FindAllowedDesignator(buildable); if (des == null) { return(null); } if (buildable.MadeFromStuff && stuff == null) { return(des); } Command_Action command_Action = new Command_Action(); command_Action.action = delegate { SoundDefOf.Tick_Tiny.PlayOneShotOnCamera(); des.SetStuffDef(stuff); Find.DesignatorManager.Select(des); }; command_Action.defaultLabel = label; command_Action.defaultDesc = description; command_Action.icon = des.ResolvedIcon(); command_Action.iconProportions = des.iconProportions; command_Action.iconDrawScale = des.iconDrawScale; command_Action.iconTexCoords = des.iconTexCoords; command_Action.iconAngle = des.iconAngle; command_Action.iconOffset = des.iconOffset; command_Action.order = 10f; if (stuff != null) { command_Action.defaultIconColor = buildable.GetColorForStuff(stuff); } else { command_Action.defaultIconColor = buildable.uiIconColor; } if (allowHotKey) { command_Action.hotKey = KeyBindingDefOf.Misc11; } return(command_Action); }