Mother DocsMother Docs
Buy me a Coffee
Steam Workshop
Discord
  • Mother OS (Ingame Script)
Buy me a Coffee
Steam Workshop
Discord
  • Mother OS (Ingame Script)
  • Mother OS (Ingame Script)
    • Getting Started

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

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

      • Air Vent Module
      • Battery Module
      • Terminal Block Module
      • Cockpit Module
      • Connector Module
      • Display Module
      • Docking Module
      • Door Module
      • Flight Control Module
      • Flight Planning Module
      • Gas Tank Module
      • Gyroscope Module
      • Hinge Module
      • Landing Gear Module
      • Light Module
      • Map Module
      • Piston Module
      • Programmable Block Module
      • Rotor Module
      • Screen Module
      • Sensor Module
      • Sorter Module
      • Sound Block Module
      • Thruster Module
      • Timer Block Module
    • Command Cheatsheet
    • Compatibility
    • Examples
  • Mother Core (Script Framework)
    • Getting Started

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

      • Color Helper
      • Security
      • Serializer
  • Powered By Mother

Architecture Overview

Warning

Mother requires a Remote Control block to function. This allows us to leverage positional and environmental data across our modules easily.

  • Entity Diagram
  • Program Lifecycle
    • Setting up Mother
    • Booting the Script
    • Running the Script Each Cycle
  • Command Lifecycle
  • Mother Instance
    • System Attributes

Entity Diagram

Let's look at the entity diagram for Mother OS which is the same as your custom script. This shows the relationship between Mother OS, Mother Core, and the Program. The Program is the entry point for all scripts.

Program Lifecycle

Setting up Mother

To use Mother, we need to create a Mother instance in our Program class. This is done in the constructor. We then register any extension modules we want to use.

Program.cs
partial class Program : MyGridProgram
{
    private Mother mother;

    public Program()
    {
        // Create Mother instance
        mother = new Mother(this);

        // Register Extension Modules
        mother.RegisterModules(new List<IExtensionModule> { 
            new RotorModule(mother),
            new FlightControlModule(mother),
            new MissileGuidanceModule(mother),
            ...
        });
    }
}

Important

Extension Modules must conform the the IExtensionModule interface. It is recommend that you use the BaseExtensionModule class as a base class to leverage the library of useful helpers.

Booting the Script

Mother boots automatically when the script compiles. Otherwise, the Boot() method can be called to force the boot process. Mother will boot all Core Modules, and then all Extension Modules in the order they were registered.

Mother.Boot();

Running the Script Each Cycle

The Run() method is responsible for running all registered modules, managing communications, and executing scheduled actions. See the Clock for more information on scheduling and delaying actions. We ensure the Program calls this method within the Main() method to delegate all further action to Mother.

Info

Mother runs at a default speed of ~6 ticks/second, or every 0.166 seconds . This tolerance should be acceptable for most use cases. Each cycle, Mother's Run() method is called which will then run all registered modules.

UpdateFrequency = UpdateFrequency.Update10

Program.cs
partial class Program : MyGridProgram
{
    // The game will run this method every cycle
    public void Main(string argument, UpdateType updateType)
    {
        // So we delegate to Mother
        Mother.Run(argument, updateType);
    }
}

Command Lifecycle

Commands may be triggered via any one of the following methods:

MethodDescription
TerminalVia the programmable block terminal.
Toolbar ActionVia a toolbar action using the programmable block's Run action.
ButtonVia a button on a control panel that triggers the programmable block's Run action.
Timer BlockVia a timer block that triggers the programmable block's Run action.
Event ControllerVia an event trigger which runs the programmable block's Run action.
Block HooksVia a block's hooks triggered by block state change.
Remote MessageVia a message sent from another grid using the Intergrid Message Service.

When a command is trigger it is passed to the Command Bus. The Command Bus then executes the command on the appropriate module.

Mother Instance

System Attributes

Mother makes most common Program properties available to assist with common lookups.

MissileGuidanceModule.cs
// via Mother (recommended)
IMyCubeGrid Grid = Mother.Grid
IMyGridTerminalSystem GridTerminalSystem = Mother.GridTerminalSystem
IMyProgrammableBlock ProgrammableBlock = Mother.ProgrammableBlock

// via the Program instance
IMyCubeGrid Grid = Mother.Program.Me.CubeGrid
IMyGridTerminalSystem GridTerminalSystem = Mother.Program.GridTerminalSystem
IMyProgrammableBlock ProgrammableBlock = Mother.Program.Me
Last Updated: 9/28/25, 8:12 PM
Contributors: Luke Morrison, lukejamesmorrison
Prev
Installation
Next
Managing Script Size & Complexity