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

Event Bus

  • Defining a Custom Event
  • Subscribing to an Event
  • Emitting an Event
  • Handling an Event
  • Unsubscribing and Inspecting Subscriptions
  • Built-in Events

EventBus is the pub/sub layer for Mother Core. Modules subscribe to event types, and any module can emit those event types with optional eventData.

Defining a Custom Event

Events are marker types that implement IEvent.

Events/DockingApprovedEvent.cs
public class DockingApprovedEvent : IEvent { }

Subscribing to an Event

Subscribe in Boot() either through the bus directly or through the BaseModule helper.

DockingModule.cs
public override void Boot()
{
    Subscribe<DockingApprovedEvent>();
    Subscribe<RequestReceivedEvent>();
}

Emitting an Event

Use Emit<TEvent>() for the common case.

DockingModule.cs
public void ApproveDocking(IMyShipConnector connector)
{
    Emit<DockingApprovedEvent>(connector);
}

You can also emit through the bus directly if you already have an event instance.

DockingModule.cs
GetModule<EventBus>().Emit(new DockingApprovedEvent(), connector);

Handling an Event

Subscribed modules receive events through HandleEvent().

DockingModule.cs
public override void HandleEvent(IEvent e, object eventData)
{
    if (e is DockingApprovedEvent && eventData is IMyShipConnector connector)
        GetModule<BlockCatalogue>().RunHook(connector, "onApproved");
}

Unsubscribing and Inspecting Subscriptions

DockingModule.cs
EventBus eventBus = GetModule<EventBus>();

if (eventBus.IsSubscribed<DockingApprovedEvent>(this))
    eventBus.Unsubscribe<DockingApprovedEvent>(this);

Built-in Events

These events are emitted by Mother Core and are immediately available to extension modules.

EventEmitted byeventData
SystemBootedEventMother after the full boot sequence completesnull
BlockConfigChangedEventBlockCatalogue when any block Custom Data changesIMyTerminalBlock
SystemConfigChangedEventBlockCatalogue when the programmable block Custom Data changesIMyTerminalBlock
RequestReceivedEventIntergridMessageService when a request is routed innull
RequestSentEventIntergridMessageService when a request is sent successfullynull
RequestFailedEventIntergridMessageService when a unicast request cannot be sentnull
ConnectorLockedEventbundled ConnectorModuleIMyShipConnector
ConnectorUnlockedEventbundled ConnectorModuleIMyShipConnector
ConnectorReadyToLockEventbundled ConnectorModuleIMyShipConnector
MechanicalBlockAttachedEventbundled MechanicalBlockModuleIMyMechanicalConnectionBlock
MechanicalBlockDetachedEventbundled MechanicalBlockModuleIMyMechanicalConnectionBlock
MergeBlockLockedEventbundled MergeBlockModuleIMyShipMergeBlock
MergeBlockOffEventbundled MergeBlockModuleIMyShipMergeBlock

Info

EventBus does not create its own framework events. It only stores subscriptions and broadcasts events emitted elsewhere.

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