false, changing nothing, for an already-closed door or not a door
false, changing nothing, for a locked door, an already-open one, or not a door
places a door at (x, y), swapping between open/closed terrain kinds
the id of the key item that unlocks this door, or undefined if it is not locked
removes a door's lock, leaving it closed but now openable; false if it was not locked
Staticfrom
Open/closed/locked door state, the same shape
Secretsalready uses: the state itself is just terrain (a door swaps between its own open and closed terrain kinds, sopassable/transparentneed no door-specific code at all), and this class remembers the other half - which cells are doors, and what they swap to.Locking is a separate flag from open/closed: a locked door is always closed and refuses to open until
unlockis called (typically once a game confirms the actor holds the right key item), rather than open/closed and locked/unlocked being folded into one state.Example