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

Clock

Mother uses a clock system to schedule system actions and execute logic across program cycles.

  • Scheduling a Action
  • Delaying an Action
  • Using a Corountine

Scheduling a Action

The Schedule() method allows you to execute an action on a specific interval in seconds. This is useful for running periodic actions that should not be run every cycle. In most cases, you should trying to schedule actions rather than execute them within a Module's Run() method. It is highly recommended that you take great consideration when scheduling actions to avoid performance issues.

Not all system actions need to run every cycle.

MissileGuidanceModule.cs
public void Boot()
{
    Clock clock = Mother.GetModule<Clock>();
    // Schedule to run every program cycle
    clock.Schedule(UpdatePosition());

    // Or, schedule to run every 10 seconds
    clock.Schedule(DetonateIfStopped(), 10);
}

void UpdatePosition() { }
void DetonateIfStopped() { }

Delaying an Action

The QueueForLater() method allows you to delay an action for a specified amount of time in seconds. This is useful for delaying actions that should not be executed immediately. It accepts an Action as the first parameter.

MissileGuidanceModule.cs
Clock clock = Mother.GetModule<Clock>();

GetModule<Clock>().QueueForLater(ActivateAutopilotSystem(), 10);

Due to how common this action is, Mother exposes a simple helper method Wait():

MissileGuidanceModule.cs
Mother.Wait(() => ActivateAutopilotSystem(), 10);

Using a Corountine

If you want to run a process in parallel, we can use the StartCoroutine() method. This method accepts an IEnumerable<double> input. Mother uses this method as part of the boot process.

MissileGuidanceModule.cs
public void Arm()
{
    GetModule<Clock>().StartCoroutine(
        ArmSystems()
    );
}
Last Updated: 8/8/25, 10:08 PM
Contributors: Luke Morrison, lukejamesmorrison
Prev
Block Catalogue
Next
Command Bus