DoorEvent
A door changed state. The event identifies the door by a cell and the side of the cell it's on.
Full documentation: DoorEvent. Wire type: door.
Default visibility: player
Message codes: exploration.door.closed, exploration.door.forced, exploration.door.opened, exploration.door.stuck, exploration.door.swung_shut, exploration.door.unlocked, exploration.door.wedged
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 door changed state. The event identifies the door by a cell and the side of the cell it's on.\n\nEmitted by the door commands,\n`OpenDoor`,\n`CloseDoor`,\n`ForceDoor`,\n`PickLock`, and\n`WedgeDoor`. A door the party opened swings shut\nonce the party walks away from it, unless it's wedged, so a command that moves the\nparty, like `MoveParty`,\n`UseStairs`, or\n`TravelToTown`, can emit it too. A referee's\n`SetDoorState` emits it at referee visibility\nwhen it opens or closes a door, because the party didn't see that happen.\n\nA door belongs to the edge between two cells, so you can refer to the same door from\neither side. Redraw the door from `x`, `y`, and `direction` rather than keeping your\nown record of which door is which.",
"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, except on an event from the referee's `SetDoorState`, which is referee."
},
"event_type": {
"const": "door",
"default": "door",
"title": "Event Type",
"type": "string",
"description": "The event type, `door`, which identifies this class in serialized form."
},
"x": {
"title": "X",
"type": "integer",
"description": "The column of the cell the door is named from. For a door command it's the party's cell,\nfor `SetDoorState` it's the cell given in the command, and for a door swinging shut it's the cell\non the door's south or east side."
},
"y": {
"title": "Y",
"type": "integer",
"description": "The row of the cell the door is named from, chosen the same way as `x`."
},
"direction": {
"title": "Direction",
"type": "string",
"description": "Which side of that cell the door is on, as a lowercase\n`Direction` value."
},
"character_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Character Id",
"description": "The member who forced the door, failed to force it, or picked its lock. `None` for the other\ncodes, where the party acts as one or nobody acts."
},
"narrative": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Narrative",
"description": "The success text the author wrote on the door's gate, when opening the door passed one, or\n`None`. The author wrote this text, not the engine, and\n`format_message` adds it after the line it builds from the\ncode."
}
},
"required": [
"code",
"x",
"y",
"direction"
],
"title": "DoorEvent",
"type": "object"
}