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 may see an event: the players, or only the referee.\n\nEvery event has one of these values, because in B/X the referee makes some rolls behind a screen. Filter\na log on it before you show anything to a player, or call\n`GameSession.view`, which builds the players' view and the referee's\nview for you. A narrator that plays the referee reads every event.\n\nA serialized event contains the lowercase value. The values stay fixed within a `schema_version`, the version\nstamp of the saved format.\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 a light runs out as time passes, which can happen\ninside any command that passes time.\n\nWithout light, the session refuses several commands with\n`exploration.action.requires_light`. Searching and listening at a door also work for\na character with infravision. Picking a lock, handling a treasure trap, and reading a\nscroll need light. Read whether the party has light from\n`GameSession.party_light` rather\nthan working it out from these events.",
"properties": {
"code": {
"title": "Code",
"type": "string",
"description": "What happened, like `combat.attack.hit`: two or more lowercase parts separated by dots. The first part is\nthe area of the rules the event comes from, like `combat` or `magic`.\n\nBranch on it, and pass the event to `format_message` to turn it into English.\nBuilding an event with a code in any other format raises a pydantic `ValidationError`."
},
"visibility": {
"$ref": "#/$defs/Visibility",
"default": "player",
"description": "Player visibility: the party sees the light change. When a light burns out, the\n`EffectExpiredEvent` for it has referee visibility, and\nthe session adds this event after it so the players learn of it."
},
"event_type": {
"const": "light",
"default": "light",
"title": "Event Type",
"type": "string",
"description": "The event type, `light`, which identifies this class in serialized form."
},
"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"
}