Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TADS3: AutoClosingDoor auto closing without going through

5 views
Skip to first unread message

HappyEngineer

unread,
Aug 15, 2006, 2:59:15 AM8/15/06
to
This is another one of those things which doesn't make much difference
in terms of gameplay, but it's nice to have to add to the atmosphere.

If I have a doggy door, I want to be able to open it and have it close
after I go through. AutoClosingDoor does that just fine. However, if I
open the door and then leave the room without going through then come
back and examine the door, it'll say that the door is still open.

I'd rather have it close when the player leaves the room. If it stays
open while in the room then it can be assumed that the player was
holding it open, so no problems there.

This might actually have an effect on things if the there is a sense
connector through the door. (You can see things on the other side of
the door when the flap is open.)

Eric Eve

unread,
Aug 15, 2006, 3:39:59 AM8/15/06
to
"HappyEngineer" <googl...@g42.org> wrote in message
news:1155625155....@75g2000cwc.googlegroups.com...

There's probably more than one way to do this. One way would be to
put something like the following on your AutoClosingDoor:

beforeTravel (traveler, connector)
{
if(connector != self)
{
makeOpen(nil);
"As you leave, you see <<theName>> swing shut. ";
}
}

-- Eric


BrettW

unread,
Aug 15, 2006, 4:44:52 AM8/15/06
to

Eric Eve suggested one method. You can also have a
TimedAutoClosingDoor. I wrote an implementation of this (included
below) for a game of mine. It's not the cleanest or prettiest way to
do it, but it does have a few advantages:

- It closes after a specified time after being opened. (Duh)
- If the player "opens the door" before it fully closes, the timer
restarts. That is, a player can catch the door before it closes.
- If a player can see the door shut, it lets them know (via closeMsg).
- The door can be made to lock automatically upon closing (via
autoLocking). (Though you need to add Lockable to the class list)
- It's easy to modify the behaviour (you can change canSenseAutoClose
so that a PC only has to be within *hearing* range).

There may be bugs, and comments are sparse, so beware.

Cheers,

BrettW

// Timed Autoclosing door.
// This is a different kind of autoclosing door. Upon opening, it sets up a
// fuse to shut the door. Imagine this as a swinging door that slowly
slides
// shut.

class TimedAutoClosingDoor : Door
closeTime = 3
closeMsg = "\^<<self.theName>> slowly closes by itself and clicks
shut. "
closeFuseID = nil
isAutoLocking = true
autoClose() {
makeOpen(nil);
if(canSenseAutoClose )
closeMsg;
}
autoLock() {
makeLocked(true);
}
canSenseAutoClose() {
return (gPlayerChar.canSee(self) || gPlayerChar.canSee(otherSide) );
}
makeOpen(stat) {
inherited(stat);

/* Set up the autoclosing fuse */
if (stat) {
if(closeFuseID != nil)
closeFuseID.removeEvent;
closeFuseID = new Fuse(self,&autoClose, closeTime);
}
else {
if(closeFuseID != nil)
closeFuseID.removeEvent;
closeFuseID = nil;
if(isAutoLocking)
autoLock();
}
}
dobjFor(Open) {
action() {
if(isOpen)
"You catch the door before it closes and open it again. ";
inherited();
}
}
;

0 new messages