I7 - Interior house doors

I’m trying to implement the style of interior door you see in most houses: basically, lockable (without a key) from one side, and not lockable from the other.

Ideally, I want these doors to be as close to invisible as possible, particularly when unlocked - no extraneous messages about opening and closing doors. Really, I want them to have two states - locked-and-closed, or unlocked-and-open.

It’s fairly easy to implement them with Locksmith - almost:

[code]A house door is a kind of door. A house door is usually lockable and locked. A house door is usually scenery. A house door has a room called the latchable side.

Before unlocking keylessly a house door:
if the noun is unlocked, say “[The noun] is already unlocked.” instead;
if the location is not the latchable side of the noun, say “You can’t unlock [the noun] from this side.” instead;
now the noun is unlocked; now the noun is open instead;

Before locking keylessly a house door:
if the noun is locked, say “[The noun] is already locked.” instead;
if the location is not the latchable side of the noun, say “You can’t lock [the noun] from this side.” instead;
now the noun is closed; now the noun is locked instead.
[/code]

However, when traveling from the latchable side, the door is automatically unlocked, and then we get an error message complaining that the door is already open. Also, if trying to lock the door from the wrong side, it’s automatically closed first, and then locking fails, leaving the door in a closed-and-unlocked state.

Is there something like this already implemented somewhere (really just a two-state-only door that otherwise acts as standard Inform doors would help a lot), or do I have to go to the trouble of tracking down every rule that invokes an implicit action?

Additionally, I’d like to implement a “go to [room]” action, similar to the Misadventure example (allowing the player to go to adjacent rooms by name). I’d like the player to be able to travel without being aware of the map directions at all (in a very small map - three bedrooms, two bathrooms, living room, kitchen, and a one-room hallway/common area connecting most of the rooms). It’s very easy to implement up until you add doors. Doors interfere with the adjacency relationship - two rooms connected by a door are not adjacent.

I managed to work this one out. I dumped Locksmith, created a non-door “interior door” lockable kind, and appropriate actions, defined a room as being latched if it contains a locked interior door, and wrote special-case rules for “Before going from the Hallway to a latched room”. That plus a modified version of the code from the Misadventure example does what I want. (I just hate having to special-case the “before” rules.)

You might want to take a look at Deluxe Doors by Emily Short. It treats a door as two one-sided doors.

Try this.

Definition: a room is nearby: repeat with way running through directions begin; if the room-or-door way from the location of the player is a room begin; decide yes; otherwise if the room-or-door way from the location of the player is a door; let chosen door be the door way from the location of the player; let chosen room be the other side of the chosen door from the location of the player; if the chosen room is not nothing, decide yes; end if; end repeat; decide no.

You can then use “go to [a nearby room]”.

Hope this helps.