Mother DocsMother Docs
Buy me a Coffee
Steam Workshop
Discord
  • Mother OS (Ingame Script)
  • Mother GUI
  • Mother Autopilot System (MAPS)
  • Mother Core (Script Framework)
  • Cheatsheet
  • Brand Guidelines
Buy me a Coffee
Steam Workshop
Discord
  • Mother OS (Ingame Script)
  • Mother GUI
  • Mother Autopilot System (MAPS)
  • Mother Core (Script Framework)
  • Cheatsheet
  • Brand Guidelines
  • Cheatsheet
  • Mother OS (Ingame Script)
    • Getting Started

      • Upgrade Guide
      • Installation
      • Command Line Interface (CLI)
      • Configuration
      • Modules
    • Core Modules

      • Activity Monitor
      • Almanac
      • Block Catalogue
      • Intergrid Message Service
      • Local Storage
      • Merge Block Module
    • Extension Modules

      • Air Vent Module
      • Battery Module
      • Terminal Block Module
      • Cockpit Module
      • Connector Module
      • Display Module
      • Door Module
      • Gas Tank Module
      • Hinge Module
      • Landing Gear Module
      • Light Module
      • Piston Module
      • Programmable Block Module
      • Rotor Module
      • Screen Module
      • Sensor Module
      • Sorter Module
      • Sound Block Module
      • Thruster Module
      • Timer Block Module
      • Wheel Module
    • Compatibility
    • Examples
  • Mother GUI
    • Getting Started

      • Installation
      • Configuration
    • Commands
    • Menus
    • Views
  • Mother Autopilot System (MAPS)
    • Getting Started

      • Upgrade Guide
      • Installation
    • Modules

      • Flight Planning Module
      • Map Module
      • Flight Control Module
      • Attitude Module
      • Docking Module
  • Mother Core (Script Framework)
    • Getting Started

      • Upgrade Guide
      • Installation
      • Architecture Overview
      • Managing Script Size & Complexity
    • Building A Module
    • Mother CLI (Console)
    • Core Modules
      • Activity Monitor
      • Almanac
      • Block Catalogue
      • Clock
      • Command Bus
      • Configuration
      • Event Bus
      • Intergrid Message Service
      • Local Storage
      • Log
      • Terminal
    • Utilities

      • Color Helper
      • Number Helper
      • Security
      • Serializer
    • Tutorials
  • Powered By Mother
  • Brand Guidelines

Command Bus

  • Registering a Command
  • Running a Command or Routine
  • Config Commands
  • Construct-Wide Command Sharing
  • Important Commands and Force-Local Execution
  • Helpful Members
  • Emitted Events

CommandBus registers commands from core modules, extension modules, and programmable block Custom Data, then resolves and executes them as local commands, routines, or construct-wide delegated commands.

Registering a Command

Commands are usually registered in a module's Boot() method.

LightModule.cs
public override void Boot()
{
    RegisterCommand(new SetLightColorCommand(this));
}

Running a Command or Routine

RunTerminalCommand() accepts the same routine syntax the player uses in the programmable block terminal.

DockingModule.cs
GetModule<CommandBus>().RunTerminalCommand(
    "light/color \"Dock Light\" yellow; wait 2; light/color \"Dock Light\" green"
);

That means you can trigger:

  1. Single commands.
  2. Multi-step routines.
  3. Config commands defined in [commands].
  4. Construct-wide commands exported by other Mother instances.

Config Commands

Programmable block Custom Data commands are loaded by Configuration, then executed by CommandBus.

Programmable Block > Custom Data
[commands]
prepareDock=light/color "Dock Light" yellow; wait 1; connector/lock "Dock Connector"

Programmable Block Terminal
prepareDock

Construct-Wide Command Sharing

Mother Core shares command names with other Mother instances on the same construct. If another script exposes a command and your script does not, CommandBus can delegate to that remote instance automatically.

Programmable Block A > Custom Data
[commands]
greeting=screen/print MainDisplay "Hello, Space Engineer!";

Programmable Block B > Terminal
greeting

Important Commands and Force-Local Execution

Prefix a config command with ! to mark it as construct-priority.

Programmable Block A > Custom Data
[commands]
!alert=light/color "Warning Lights" red; sound/play "Alarm"

If another script needs to bypass the important construct command and run its own local definition, prefix the call with !!.

Programmable Block B > Terminal
!!alert

Helpful Members

MemberUse
ModuleCommandsCommands registered on this instance
ConstructCommandsCommand names discovered on other scripts on the same construct
ImportantConstructCommandsImportant command names exported by other scripts
FindInstanceWithCommand(name)Returns the script ID that owns a construct command
GetSelfCommandNames()Returns the local command names exported to peers

Emitted Events

CommandBus does not emit any built-in events.

Last Updated: 5/2/26, 10:05 PM
Contributors: Luke Morrison, lukejamesmorrison, Copilot
Prev
Clock
Next
Configuration