Skip to content

SetDoorState

Referee: change the state of a door on any level of any dungeon.

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\nYou use these for the way `MoveParty` steps, the side of a\ncell `OpenDoor` works on, and the way a transition turns the\nparty on arrival. There is no up or down. A\n`TransitionSpec` moves the party between levels.\n\nThe values are lowercase strings, like `\"north\"`, and they appear in commands, events, and saves.",
      "enum": [
        "north",
        "east",
        "south",
        "west"
      ],
      "title": "Direction",
      "type": "string"
    }
  },
  "description": "Referee: change the state of a door on any level of any dungeon.\n\nUse it when your game logic opens, closes, reveals, or unlocks a door, like a\nlever that opens a portcullis. The door in the adventure document never changes. What\nchanges is its state in play: whether it stands open, is wedged, has been found, and has\nbeen unlocked. A field you leave `None` leaves the current value unchanged. The door doesn't have\nto be next to the party. This command is legal in every mode, `game_over` and\n`victory` included.\n\nModes:\n    `town`, `exploring`, `encounter`, `battle`, `game_over`, `victory`\n\nRejections:\n    - `session.command.unknown_location` - `dungeon_id` matches no dungeon, or\n      `level_number` matches no level in it.\n    - `session.command.no_door` - the edge on that side of that cell isn't a door,\n      or the cell is off the level's grid.\n\nEvents:\n    A `DoorEvent` at referee visibility when the\n    door opens or closes, and otherwise none.",
  "properties": {
    "command_type": {
      "const": "set_door_state",
      "default": "set_door_state",
      "title": "Command Type",
      "type": "string",
      "description": "The name that identifies the command class in serialized data. Each command class fixes\nit to a distinct snake_case string, like `\"move_party\"` or `\"open_door\"`, and constructing\nthe class sets it, so you never pass it yourself.\n`parse_command` and the\n`AnyCommand` union use it to rebuild the right class\nfrom a serialized mapping. A class's value never changes between releases."
    },
    "source": {
      "anyOf": [
        {
          "minLength": 1,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Source",
      "description": "Who or what issued the command on whose behalf: an authored trigger or quest id, or the\nname of one of your game's systems. The engine never reads it, so a command with a\n`source` does exactly what the same command without one does. The session logs and\nreplays it with the command, so the log alone shows why something happened. Leave it\n`None` when there's nothing to record. An empty string fails validation when the command\nis constructed."
    },
    "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 edge, so naming a\ncell's north side and naming its northern neighbour's south side set the same door. The\nsession refuses an edge with no door 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. A change emits a\n`DoorEvent` at referee visibility, and setting the value\nthe door 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 doesn't swing\nshut behind the party, and `CloseDoor` can't close it."
    },
    "discovered": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Discovered",
      "description": "Whether the party has found the door. `None` leaves it as it is. Setting it to `True`\nmakes a secret door visible without a search, and `False` hides it again. Revealing a\nsecret door gives every member their `room_traps` search back on both cells the door\njoins, as finding it with `Search` does."
    },
    "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 to `True` lets\n`OpenDoor` open a locked door without a thief picking the\nlock."
    }
  },
  "required": [
    "dungeon_id",
    "level_number",
    "x",
    "y",
    "direction"
  ],
  "title": "SetDoorState",
  "type": "object"
}