Skip to content

Command Definitions and Registry

Relevant source files

This document explains the command definition system that powers the Command Palette. It covers the structure of individual commands, the category hierarchy that organizes them, the badge system for visual indicators, and the complete set of 60+ default commands registered by the mod. For information about the UI implementation and interaction model of the palette, see Palette Overlay UI.


Each command in the registry is represented as a Dictionary with standardized properties. The TajsModDefaultCommands class in extensions/scripts/palette/default_commands.gd L1-L1102

defines and registers all default commands using this structure.

PropertyTypeRequiredDescription
idStringYesUnique identifier for the command (e.g., "cmd_select_all_nodes")
titleStringYes*Display name shown in the palette
get_titleCallableNoDynamic title function (overrides title if present)
category_pathArray[String]YesHierarchy path (e.g., ["Nodes", "Groups"])
keywordsArray[String]YesSearch terms for fuzzy matching
hintStringYesDescription/tooltip text
icon_pathStringNoPath to texture icon (e.g., "res://textures/icons/...")
badgeStringNoVisual indicator: "SAFE", "OPT-IN", or "NEW"
is_categoryboolNotrue if this is a category, not an executable command
runCallableConditional**Function executed when command is selected
can_runCallableNoFunction returning bool to enable/disable command
keep_openboolNoIf true, palette stays open after execution
  • Either title or get_title must be provided.

** Required for non-category commands.

flowchart TD

CommandDict["Command Dictionary"]
Id["id: String<br>Unique identifier"]
Title["title: String<br>Display name"]
GetTitle["get_title: Callable<br>(optional dynamic)"]
CategoryPath["category_path: Array[String]<br>Hierarchy location"]
Keywords["keywords: Array[String]<br>Search terms"]
Hint["hint: String<br>Description"]
IconPath["icon_path: String<br>Texture resource"]
Badge["badge: String<br>SAFE/OPT-IN/NEW"]
IsCategory["is_category: bool<br>Category flag"]
Run["run: Callable<br>Execution logic"]
CanRun["can_run: Callable<br>Availability check"]
KeepOpen["keep_open: bool<br>Palette persistence"]

CommandDict --> Id
CommandDict --> Title
CommandDict --> GetTitle
CommandDict --> CategoryPath
CommandDict --> Keywords
CommandDict --> Hint
CommandDict --> IconPath
CommandDict --> Badge
CommandDict --> IsCategory
CommandDict --> Run
CommandDict --> CanRun
CommandDict --> KeepOpen

subgraph Behavior ["Behavior"]
    IsCategory
    Run
    CanRun
    KeepOpen
end

subgraph Presentation ["Presentation"]
    Hint
    IconPath
    Badge
end

subgraph Organization ["Organization"]
    CategoryPath
    Keywords
end

subgraph Identification ["Identification"]
    Id
    Title
    GetTitle
end

Sources: extensions/scripts/palette/default_commands.gd L26-L69

extensions/scripts/palette/default_commands.gd L76-L131


Commands are organized into a four-tier hierarchy with root categories, subcategories, and leaf commands. Categories use is_category: true and do not have run functions.

flowchart TD

Root["Command Registry Root"]
Nodes["cat_nodes<br>'Nodes'<br>Badge: SAFE"]
TajsMod["cat_tajs_mod<br>'Taj's Mod'<br>Badge: SAFE"]
Tools["cat_tools<br>'Tools (Opt-in)'<br>Badge: OPT-IN"]
Help["cat_help<br>'Help & Links'<br>Badge: SAFE"]
NodesNetwork["cat_nodes_network<br>'Network'"]
NodesCPU["cat_nodes_cpu<br>'CPU'"]
NodesGPU["cat_nodes_gpu<br>'GPU'"]
NodesResearch["cat_nodes_research<br>'Research'"]
NodesFactory["cat_nodes_factory<br>'Factory'"]
NodesHacking["cat_nodes_hacking<br>'Hacking'"]
NodesCoding["cat_nodes_coding<br>'Coding'"]
NodesUtility["cat_nodes_utility<br>'Utility'"]
NodesGroups["cat_nodes_groups<br>'Groups'"]
TajsToggles["cat_tajs_toggles<br>'Feature Toggles'"]
TajsVisuals["cat_tajs_visuals<br>'Visuals'"]
TajsScreenshots["cat_tajs_screenshots<br>'Screenshots'"]

Root --> Nodes
Root --> TajsMod
Root --> Tools
Root --> Help
Nodes --> NodesNetwork
Nodes --> NodesCPU
Nodes --> NodesGPU
Nodes --> NodesResearch
Nodes --> NodesFactory
Nodes --> NodesHacking
Nodes --> NodesCoding
Nodes --> NodesUtility
Nodes --> NodesGroups
TajsMod --> TajsToggles
TajsMod --> TajsVisuals
TajsMod --> TajsScreenshots

subgraph subGraph1 ["Taj's Mod Subcategories"]
    TajsToggles
    TajsVisuals
    TajsScreenshots
end

subgraph subGraph0 ["Nodes Subcategories"]
    NodesNetwork
    NodesCPU
    NodesGPU
    NodesResearch
    NodesFactory
    NodesHacking
    NodesCoding
    NodesUtility
    NodesGroups
end

Sources: extensions/scripts/palette/default_commands.gd L22-L69

extensions/scripts/palette/default_commands.gd L136-L160

extensions/scripts/palette/default_commands.gd L281-L556

The category_path property defines a command’s location in the hierarchy:

Commandcategory_pathResult in Palette
Select All Nodes["Nodes"]Nodes > Select All Nodes
Select All Network["Nodes", "Network"]Nodes > Network > Select All Network
Wire Drop Menu["Taj's Mod", "Feature Toggles"]Taj’s Mod > Feature Toggles > Wire Drop Menu
Toggle Extra Glow["Taj's Mod", "Visuals"]Taj’s Mod > Visuals > Toggle Extra Glow
Money +10%["Tools (Opt-in)"]Tools (Opt-in) > Money +10%

Sources: extensions/scripts/palette/default_commands.gd L76-L95

extensions/scripts/palette/default_commands.gd L293-L308

extensions/scripts/palette/default_commands.gd L506-L519


Badges provide visual indicators about command safety and availability. They appear as colored labels next to command titles in the palette.

BadgeMeaningUsageExample Commands
SAFEDefault QoL feature, no gameplay impactMost commandsSelect All, Center View, Open Settings
OPT-INGameplay-affecting, requires explicit enablementCheat commands, gameplay modifiersMoney +10%, Set Unlimited Nodes
NEWRecently added featureNew commands in recent versionsAdd Sticky Note

Commands with badge: "OPT-IN" typically include a can_run check that verifies tools are enabled:

"can_run": func(ctx): return ctx.are_tools_enabled()

This prevents execution unless the user has explicitly enabled tools via the “Enable Tools in Palette” command.

Sources: extensions/scripts/palette/default_commands.gd L34-L57

extensions/scripts/palette/default_commands.gd L606-L617

extensions/scripts/palette/default_commands.gd L768-L781


CategorySubcategoriesCommandsBadge
Nodes9 (Network, CPU, GPU, etc.)~30SAFE
Taj’s Mod3 (Toggles, Visuals, Screenshots)~20SAFE
Tools (Opt-in)0~15OPT-IN
Help & Links08SAFE
Total12~65-

Note: Dynamic node category commands (Select All X, Upgrade X) are generated programmatically for each node type.

Command IDTitleDescription
cmd_select_all_nodesSelect All NodesSelect all nodes on desktop
cmd_deselect_allDeselect AllClear current selection
cmd_center_viewCenter View on SelectionMove camera to selected nodes
cmd_jump_to_groupJump to GroupOpen group picker for navigation
cmd_upgrade_selectedUpgrade SelectedUpgrade all selected nodes (if affordable)
cmd_upgrade_allUpgrade AllUpgrade all nodes on desktop
cmd_clear_wires_selectionClear All Wires in SelectionDisconnect all wires from selected nodes

Sources: extensions/scripts/palette/default_commands.gd L76-L225

Command IDTitleDescription
cmd_open_settingsOpen SettingsOpen mod settings panel
cmd_toggle_wire_dropWire Drop Menu [ON]/[OFF]Toggle wire drop node spawning menu
cmd_toggle_paletteCommand Palette [ON]/[OFF]Toggle command palette (MMB)
cmd_toggle_select_allCtrl+A Select All [ON]/[OFF]Toggle Ctrl+A select all nodes
cmd_toggle_glowToggle Extra GlowToggle extra glow effect
cmd_cycle_opacityCycle UI OpacityCycle through 100% → 75% → 50%
cmd_take_screenshotTake ScreenshotCapture full desktop screenshot

Sources: extensions/scripts/palette/default_commands.gd L251-L582

Command IDTitleDescription
cmd_money_addMoney +10%Increase money by 10%
cmd_money_add_50Money +50%Increase money by 50%
cmd_research_addResearch +10%Increase research by 10%
cmd_node_limit_unlimitedSet Unlimited NodesRemove node limit (set to ∞)
cmd_node_limit_defaultReset Node LimitReset node limit to 400
cmd_add_sticky_noteAdd Sticky NotePlace text note at camera center
cmd_clear_all_notesClear All Sticky NotesDelete all sticky notes

Sources: extensions/scripts/palette/default_commands.gd L606-L795

Command IDTitleDescription
cmd_show_aboutAbout Taj’s ModShow mod version and info
cmd_copy_workshopCopy Workshop LinkCopy Steam Workshop link to clipboard
cmd_enable_toolsEnable Tools in PaletteEnable opt-in tools and gameplay commands
cmd_palette_helpPalette HelpShow command palette help and hotkeys

Sources: extensions/scripts/palette/default_commands.gd L801-L890


sequenceDiagram
  participant PaletteController
  participant Command Registry
  participant TajsModDefaultCommands
  participant refs Dictionary

  PaletteController->>Command Registry: Initialize registry
  PaletteController->>refs Dictionary: Populate refs with context
  note over refs Dictionary: mod_config, mod_ui, mod_main,
  PaletteController->>TajsModDefaultCommands: register_all(registry, refs)
  TajsModDefaultCommands->>Command Registry: Register root categories
  note over Command Registry: cat_nodes, cat_tajs_mod,
  TajsModDefaultCommands->>TajsModDefaultCommands: _register_node_category
  loop [For each node type]
    TajsModDefaultCommands->>Command Registry: (network, cpu, gpu, etc.)
    TajsModDefaultCommands->>Command Registry: Register category
    TajsModDefaultCommands->>Command Registry: Register "Select All X"
  end
  TajsModDefaultCommands->>Command Registry: Register "Upgrade X"
  note over Command Registry: Select All, Center View,
  TajsModDefaultCommands->>Command Registry: Register main commands
  note over Command Registry: Wire Drop, Palette,
  TajsModDefaultCommands->>Command Registry: Register feature toggles
  note over Command Registry: Money, Research,
  TajsModDefaultCommands->>Command Registry: Register opt-in commands
  Command Registry->>PaletteController: Register help commands

Sources: extensions/scripts/palette/default_commands.gd L13-L892

The refs Dictionary passed to register_all() contains references to key system components:

KeyTypeUsage
mod_configConfigManagerRead/write settings values
mod_uiSettingsUIShow/hide settings panel
mod_mainModMainAccess managers and core functionality
contextCommandContextCheck if tools enabled, provide runtime info
palette_configPaletteConfigManage palette-specific settings
controllerPaletteControllerAccess overlay, control palette state
registryCommandRegistryRegister additional commands

These references enable command run functions to interact with the mod’s systems.

Sources: extensions/scripts/palette/default_commands.gd L14-L20


The TajsModDefaultCommands class provides several static helper functions used by multiple commands.

flowchart TD

Input["Array of WindowContainer nodes"]
Check1["Has upgrade() method?"]
Check2["can_upgrade()?"]
Check3["Check cost manually"]
Upgrade["Execute upgrade"]
Skip["Skip node"]
Count["Increment upgraded_count"]
Count2["Increment skipped_count"]
Feedback["Sound + Notification"]

Input --> Check1
Check1 --> Skip
Check1 --> Check2
Check2 --> Check3
Check2 --> Upgrade
Check3 --> Skip
Check3 --> Upgrade
Upgrade --> Count
Skip --> Count2
Count --> Feedback
Count2 --> Feedback

Purpose: Safely upgrade a list of nodes, checking affordability and handling different upgrade method signatures.

Logic:

  1. Iterate through all windows in the provided array
  2. Verify window has upgrade() method
  3. If window has can_upgrade(), use it for validation and call _on_upgrade_button_pressed()
  4. Otherwise, manually check cost property against Globals.currencies["money"]
  5. Deduct cost and call upgrade() with 0 or 1 argument based on method signature
  6. Play sound and show notification with count

Sources: extensions/scripts/palette/default_commands.gd L993-L1046

Purpose: Disconnect all wire connections from a list of windows.

Logic:

  1. Find all ResourceContainer nodes within each window
  2. For each container: _ Emit Signals.delete_connection for all output connections _ Emit Signals.delete_connection for input connection if present
  3. Return Dictionary with {"cleared": int, "nodes": int} for feedback

Used by: cmd_clear_wires_selection command

Sources: extensions/scripts/palette/default_commands.gd L1058-L1102

Purpose: Add or subtract a percentage of a currency (money, research, token).

Logic:

  1. Calculate amount = current * percent
  2. Apply minimum amount for small percentages (e.g., 1000 for money)
  3. Update Globals.currencies[type]
  4. Update Globals.max_money or Globals.max_research if increased
  5. Call Globals.process(0) to trigger UI updates
  6. Play sound and show notification

Used by: Money/Research cheat commands in Tools category

Sources: extensions/scripts/palette/default_commands.gd L895-L924

Purpose: Programmatically register a node category with “Select All” and “Upgrade” commands.

Parameters:

  • cat_id: String identifier (e.g., "network", "cpu")
  • cat_title: Display name (e.g., "Network", "CPU")
  • icon: Icon filename (e.g., "connections", "bits")

Generated Commands:

  1. Category: cat_nodes_{cat_id} with title and icon
  2. Select command: cmd_select_{cat_id} - filters by Data.windows[key].category
  3. Upgrade command: cmd_upgrade_{cat_id} - upgrades filtered nodes

Sources: extensions/scripts/palette/default_commands.gd L927-L991


To add custom commands, modify the _setup_command_palette() method in mod_main.gd:

# After TajsModDefaultCommands.register_all()
palette_controller.registry.register({
"id": "cmd_my_custom_command",
"title": "My Custom Feature",
"category_path": ["Taj's Mod"],
"keywords": ["custom", "feature", "special"],
"hint": "Execute my custom functionality",
"badge": "SAFE",
"run": func(ctx):
# Your custom logic here
print("Custom command executed!")
Signals.notify.emit("check", "Custom command ran!")
})

Use get_title to create commands with state-dependent titles (e.g., ON/OFF toggles):

registry.register({
"id": "cmd_my_toggle",
"title": "My Feature",
"get_title": func():
var enabled = mod_config.get_value("my_feature_enabled", false)
return "My Feature " + ("[ON]" if enabled else "[OFF]"),
"run": func(ctx):
var current = mod_config.get_value("my_feature_enabled", false)
mod_config.set_value("my_feature_enabled", !current)
# Apply the toggle...
})

Use can_run to disable commands based on runtime conditions:

registry.register({
"id": "cmd_require_selection",
"title": "Process Selection",
"can_run": func(ctx):
return Globals and Globals.selections.size() > 0,
"run": func(ctx):
# Process selected nodes...
})

Set keep_open: true for commands that transition to other modes (e.g., opening pickers):

registry.register({
"id": "cmd_open_picker",
"title": "Open Picker",
"keep_open": true, # Don't close palette
"run": func(ctx):
controller.overlay.show_group_picker(groups, manager)
})

Sources: extensions/scripts/palette/default_commands.gd L163-L193

extensions/scripts/palette/default_commands.gd L293-L308


Commands receive a CommandContext object (ctx parameter) that provides:

MethodReturnsDescription
ctx.are_tools_enabled()boolCheck if opt-in tools are available
ctx.set_tools_enabled(bool)voidEnable/disable tools in palette

This context is used primarily for conditional availability of opt-in commands.

Sources: extensions/scripts/palette/default_commands.gd L57-L58

extensions/scripts/palette/default_commands.gd L614-L617


The command definition system provides a flexible, declarative approach to registering palette commands:

  • Structured Properties: Commands use a standardized Dictionary format with 12 possible properties
  • Hierarchical Organization: Four root categories with subcategories enable intuitive navigation
  • Badge System: Visual indicators distinguish safe QoL features from gameplay-affecting tools
  • 60+ Default Commands: Comprehensive set covering node management, mod settings, cheats, and help
  • Helper Utilities: Shared logic for upgrades, wire clearing, and currency modification
  • Extensibility: Simple registration API for adding custom commands with dynamic titles and conditional availability

The registry acts as the single source of truth for all palette functionality, consumed by the PaletteOverlay UI layer (see Palette Overlay UI).

Sources: extensions/scripts/palette/default_commands.gd L1-L1102