Skip to content

SetDoorState

Referee: rewrite a door's overlay anywhere (None fields stay unchanged).

Full documentation: SetDoorState. Wire type: set_door_state.

Legal session modes: battle, encounter, exploring, game_over, town, victory

JSON Schema

{
  "$defs": {
    "Direction": {
      "description": "The four grid directions the party faces and moves in.\n\nThis is the direction vocabulary the whole crawl uses: which way\n`MoveParty` steps, which side of a cell\n`OpenDoor` works on, which way a transition faces the party on\narrival. There is no up or down here. Between levels is a\n`TransitionSpec`.\n\nThe wire values are lowercase and they serialize into commands, events, and saves, so changing\none is a `schema_version` bump.",
      "enum": [
        "north",
        "east",
        "south",
        "west"
      ],
      "title": "Direction",
      "type": "string"
    }
  },
  "description": "Referee: rewrite a door's overlay anywhere (`None` fields stay unchanged).\n\nReferee commands are legal in every mode, terminal modes included. The door\nmay be on any level of any dungeon, not just under the party.\n\nModes:\n    `town`, `exploring`, `encounter`, `battle`, `game_over`, `victory`\n\nRejections:\n    - `session.command.unknown_location` - `dungeon_id` or `level_number`\n      resolves to nothing.\n    - `session.command.no_door` - no door edge at that cell and direction.\n\nEvents:\n    A referee-visibility `DoorEvent` when the\n    open state actually changes, and otherwise none.",
  "properties": {
    "command_type": {
      "const": "set_door_state",
      "default": "set_door_state",
      "title": "Command Type",
      "type": "string",
      "description": "The wire discriminator. Each subclass fixes it to its own snake_case literal, like\n`\"move_party\"` or `\"open_door\"`, so you never set it yourself: constructing the subclass\ndoes. It's what `parse_command` and the\n`AnyCommand` union read to rebuild the right class\nfrom a serialized mapping, and it stays the same across releases."
    },
    "source": {
      "anyOf": [
        {
          "minLength": 1,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Source",
      "description": "An annotation naming the authored object (a trigger or quest id) or the game\nsystem on whose behalf the command was issued. Execution never reads it: a stamped\ncommand does exactly what the same command unstamped does. It is logged and replayed\nwith the command, so the log alone answers \"why did this happen\". Absent is `None`,\nand the empty string is not a value."
    },
    "dungeon_id": {
      "title": "Dungeon Id",
      "type": "string",
      "description": "Which dungeon the door is in, by\n`DungeonSpec.id`. It doesn't have to be the dungeon the\nparty is in."
    },
    "level_number": {
      "minimum": 1,
      "title": "Level Number",
      "type": "integer",
      "description": "Which level of that dungeon, counting from 1."
    },
    "x": {
      "title": "X",
      "type": "integer",
      "description": "The cell's x coordinate on that level's grid."
    },
    "y": {
      "title": "Y",
      "type": "integer",
      "description": "The cell's y coordinate on that level's grid."
    },
    "direction": {
      "$ref": "#/$defs/Direction",
      "description": "Which of the cell's four sides the door is on. Two cells share each physical edge, so\nnaming a cell's north side and naming its northern neighbour's south side write the same\ndoor. An edge with no door is refused with `session.command.no_door`."
    },
    "open": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Open",
      "description": "Whether the door stands open. `None`, the default, leaves it as it is. Writing a change\nhere emits a referee-visibility `DoorEvent`, and writing\nthe value it already has emits nothing."
    },
    "wedged": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Wedged",
      "description": "Whether a spike holds the door. `None` leaves it as it is. A wedged door can't swing shut\nbehind the party."
    },
    "discovered": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Discovered",
      "description": "Whether the party has found the door. `None` leaves it as it is. This is what makes a\nsecret door visible without a search, and clearing it hides one again. Revealing a secret\ndoor gives every member on both cells the edge joins their `room_traps` search back, the\nsame as finding it with `Search`."
    },
    "unlocked": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Unlocked",
      "description": "Whether the lock has been undone. `None` leaves it as it is. Setting it opens a locked door\nto `OpenDoor` without a thief."
    }
  },
  "required": [
    "dungeon_id",
    "level_number",
    "x",
    "y",
    "direction"
  ],
  "title": "SetDoorState",
  "type": "object"
}