Skip to content

LightEvent

A light source was lit, went out, failed to catch, or burned away.

Full documentation: LightEvent. Wire type: light.

Default visibility: player

Message codes: exploration.light.expired, exploration.light.extinguished, exploration.light.failed, exploration.light.lit

JSON Schema

{
  "$defs": {
    "Visibility": {
      "description": "Who is allowed to see an event.\n\nEvery event has one of these two values, and the split exists because B/X keeps some rolls behind the\nreferee's screen. Filter a log on it before you show anything to a player, or call\n`GameSession.view`, which builds the player's and the referee's\nviews for you. A narrator playing referee reads both.\n\nThe values are the lowercase strings and they serialize into every event, so a renamed value is a\n`schema_version` bump.\n\nExamples:\n    ```python\n    from osrlib.core.events import DamageDealtEvent, HitPointsReportedEvent, Visibility\n\n    log = [\n        DamageDealtEvent(target_id=\"monster-0001\", amount=5),\n        HitPointsReportedEvent(target_id=\"monster-0001\", current_hp=2, max_hp=7),\n    ]\n    shown = [event.code for event in log if event.visibility is Visibility.PLAYER]\n    assert shown == [\"combat.damage.dealt\"]  # the goblin's remaining hit points stay hidden\n    ```",
      "enum": [
        "player",
        "referee"
      ],
      "title": "Visibility",
      "type": "string"
    }
  },
  "description": "A light source was lit, went out, failed to catch, or burned away.\n\nEmitted by `LightSource`,\n`ExtinguishSource`, and\n`UseItem` for an item that glows. The session\nalso emits the expiry form whenever the clock runs a light out, which can happen\ninside any command that passes time.\n\nLight gates most of exploration: searching, reading, and seeing at all need it\nunless a character has infravision. Read the party's current state from\n`GameSession.party_light` rather\nthan adding these events up.",
  "properties": {
    "code": {
      "title": "Code",
      "type": "string",
      "description": "What happened, as two or more lowercase segments separated by dots and namespaced by subsystem, like\n`combat.attack.hit`. This is what you branch on and what\n`format_message` looks up. Anything else raises a validation error."
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "player",
      "description": "Player visibility: the party watches the light go. The ledger's own expiry record behind it\nis referee visibility, and the session translates it into this player-facing form."
    },
    "event_type": {
      "const": "light",
      "default": "light",
      "title": "Event Type",
      "type": "string",
      "description": "The wire discriminator, `light`."
    },
    "character_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Character Id",
      "description": "The member carrying the source, or `None` when the light belongs to no one in the party."
    },
    "source": {
      "title": "Source",
      "type": "string",
      "description": "What is burning: `\"torch\"`, `\"lantern\"`, `\"oil\"` for a lit pool, `\"sword\"` for a blade that\nglows, or the effect kind for a light cast as a spell."
    }
  },
  "required": [
    "code",
    "source"
  ],
  "title": "LightEvent",
  "type": "object"
}