Pathfinding through a Door

Okay, this is odd.

I’m working in a tracking dog NPC who is supposed to go to a certain spot in the map by the shortest route. I want it to get stuck at doors, even unlocked ones, and my efforts to disarm the automatic opening of unlocked doors by the dog has hit a… snag. It works fine, but only if the player is in the same room as the dog. If they’re not, the closed door apparently doesn’t count as a closed door :confused:

[code]A person has a room called a destination.

Start is a room. The Exterior is north of Start.

The red door is north of the Exterior and south of the Interior. The red door is a closed openable locked lockable door.

The iron key is in the Interior. The iron key unlocks the red door.

The Rooftop is up from the Exterior and south of the Chimney. The Chimney is up from the Interior.

The german shepherd is an animal in Start. The german shepherd can be either hunting or idle.

Every turn when the german shepherd is hunting:
If the location of the german shepherd is not the destination of the german shepherd:
Let the way be the best route from the location of the german shepherd to the destination of the german shepherd, using even locked doors;
Let the barrier be the door the way from the location;
If the barrier is a closed door:
Say “[The german shepherd] paws at [the barrier].”;
Say “Bar!”;
Otherwise:
Try the german shepherd going the way;
Say “Foo!”;
Otherwise:
Say “The german shepherd barks happily.”

Instead of waiting:
Say “The dog looks bored and wanders off.”;
Now the destination of the german shepherd is the Interior;
Now the german shepherd is hunting;[/code]

		Let the barrier be the door the way from the location of the german shepherd;

D’oh! Forgot ‘location’ is the player’s location. Thank you.