MMoriDocs
API Reference

WebSocket Events

Live event pushes for tracking game states

WebSocket

Connect to ws://localhost:3000/ws.

All messages are JSON text frames with the format:

{ "event": "EventName", "data": { ... } }

The server only sends messages; the client does not send any.


Events

BotAdded

A new bot was spawned.

{
  "event": "BotAdded",
  "data": {
    "bot_id": 1,
    "username": "string"
  }
}

BotRemoved

A bot was stopped.

{
  "event": "BotRemoved",
  "data": { "bot_id": 1 }
}

BotStatus

Bot connection status changed.

{
  "event": "BotStatus",
  "data": {
    "bot_id": 1,
    "status": "in_world"
  }
}

See BotStatus values below.

BotWorld

Bot entered or left a world. world_name is an empty string when leaving.

{
  "event": "BotWorld",
  "data": {
    "bot_id": 1,
    "world_name": "string"
  }
}

BotMove

Bot position updated.

{
  "event": "BotMove",
  "data": {
    "bot_id": 1,
    "x": 0.0,
    "y": 0.0
  }
}

BotGems

Bot gem balance changed.

{
  "event": "BotGems",
  "data": {
    "bot_id": 1,
    "gems": 0
  }
}

BotPing

Bot ping updated. Fired when the value changes.

{
  "event": "BotPing",
  "data": {
    "bot_id": 1,
    "ping_ms": 0
  }
}

BotTrackInfo

Account info received on login.

{
  "event": "BotTrackInfo",
  "data": {
    "bot_id": 1,
    "level": 0,
    "grow_id": 0,
    "install_date": 0,
    "global_playtime": 0,
    "awesomeness": 0
  }
}

PlayerSpawn

A player appeared in the bot's world.

{
  "event": "PlayerSpawn",
  "data": {
    "bot_id": 1,
    "net_id": 0,
    "name": "string",
    "country": "us",
    "x": 0.0,
    "y": 0.0
  }
}

PlayerMove

A player moved.

{
  "event": "PlayerMove",
  "data": {
    "bot_id": 1,
    "net_id": 0,
    "x": 0.0,
    "y": 0.0
  }
}

PlayerLeave

A player left the bot's world.

{
  "event": "PlayerLeave",
  "data": {
    "bot_id": 1,
    "net_id": 0
  }
}

WorldLoaded

Full world data sent once when the bot enters a world.

{
  "event": "WorldLoaded",
  "data": {
    "bot_id": 1,
    "name": "string",
    "width": 100,
    "height": 60,
    "tiles": [
      {
        "fg": 2,
        "bg": 8,
        "flags": 64,
        "tile_type": { "type": "Basic" }
      }
    ]
  }
}

tiles is a flat array of tile objects in row-major order. Each tile has:

FieldTypeDescription
fgu16Foreground item ID
bgu16Background item ID
flagsu16Raw TileFlags bitmask (see below)
tile_typeobjectTagged extra data (see below)

TileFlags bitmask

BitValueName
00x0001HAS_EXTRA_DATA
10x0002HAS_PARENT
20x0004WAS_SPLICED
30x0008WILL_SPAWN_SEEDS_TOO
40x0010IS_SEEDLING
50x0020FLIPPED_X
60x0040IS_ON
70x0080IS_OPEN_TO_PUBLIC
80x0100BG_IS_ON
90x0200FG_ALT_MODE
100x0400IS_WET
110x0800GLUED
120x1000ON_FIRE
130x2000PAINTED_RED
140x4000PAINTED_GREEN
150x8000PAINTED_BLUE

tile_type variants (discriminated by "type" field)

TypeExtra fields
Basic
Signtext: string, flags: u8
Doortext: string, owner_uid: u32
Locksettings: u8, owner_uid: u32, access_count: u32, access_uids: u32[], minimum_level: u8
Seedtime_passed: u32, item_on_tree: u8
VendingMachineitem_id: u32, price: i32
DisplayBlockitem_id: u32
Mannequintext: string, clothing_1..10: u16/u32
Dicesymbol: u8
Forgetemperature: u32
CookingOventemperature_level: u32, ingredients: [u32,u32][]
StorageBlockitems: [u32,u32][]
WeatherMachinesettings: u32
HearthMonitordata: u32, player_name: string
SilkWormname: string, age: u32, color: u32, …
CountryFlagcountry: string
AudioRacknote: string, volume: u32
TesseractManipulatorgems: u32, next_update_ms: u32, item_id: u32, enabled: u32
(others)See source TileType enum in src/world.rs

TileUpdate

A single tile was modified.

{
  "event": "TileUpdate",
  "data": {
    "bot_id": 1,
    "x": 0,
    "y": 0,
    "fg": 0,
    "bg": 0
  }
}

ObjectsUpdate

Full set of dropped objects in the world.

{
  "event": "ObjectsUpdate",
  "data": {
    "bot_id": 1,
    "objects": [
      {
        "uid": 0,
        "item_id": 0,
        "x": 0.0,
        "y": 0.0,
        "count": 1
      }
    ]
  }
}

InventoryUpdate

Bot inventory changed.

{
  "event": "InventoryUpdate",
  "data": {
    "bot_id": 1,
    "gems": 0,
    "items": [
      {
        "item_id": 0,
        "amount": 0,
        "is_active": false,
        "action_type": 0
      }
    ]
  }
}

Console

A console message was received (game chat, script output, etc.).

{
  "event": "Console",
  "data": {
    "bot_id": 1,
    "message": "string"
  }
}

On this page