Restricting postures in a room

Is there a way to restrict the postures that the player (or an Actor) can assume in a Room? Suppose the player is crawling along a low tunnel. Standing up or sitting up should not be allowed. I can force an Actor to assume a posture upon entering the room by doing:

Room 'tunnel'
    defaultPosture = lying
;

… but this doesn’t present the action stand up from working. The NestedRoom implementation has allowedPostures, but this seems to apply to an Actor getting into the nested room. No allowedPostures property exists on Room.

I’m going digging through the NestedRoom source to see how I can do this, but it seems like this should be an easy thing. Does anyone know of an elegant way of doing this?

I ended up doing this:

class DuctRoom: Room
    defaultPosture = lying
    roomBeforeAction() {
        if(gActionIs(Stand)) {
            "The air duct is much too cramped for {you/him} to 
            stand up in. {You're/he's} forced to crawl on {your/his} 
            hands and knees. ";
        }
    }
;

This catches the stand action, but I would have liked to see something more like allowedPostures.

1 Like

There seem to be various ways to do this. You could override the standUp() method of the player character and prevent standing up when in that particular location. Or you could override makePosture(newPosture) of the PC to be more specific about which postures are allowed (you could for example allow lying and sitting but not standing.)

Or, you could override makeStandingUp() of the room instead and prevent standing up there.

1 Like

Thank you for the feedback. I think makeStandingUp would be the best thing to override, since is applies to the room, and that would nicely encapsulate this rule into the (type of) room where it applies. Overriding something on the PC would need overriding on an Actor class as well, in order to prevent NPCs to stand up in the room.

Then again, I suppose one could override makePosture on Actor and check the type of room they’re in, and respond accordingly a la location.ofKind(lowRoom) and that would work equall well.

Thanks again.

There is an allowedPostures property, did you not see it? Are you using adv3?

I am using adv3. allowedPostures is a property only of NestedRoom though, not Room.

Oh, I see what you mean… it seems like it wouldn’t be too hard to modify Room to use the allowedPosture mechanism from NestedRoom, but it sounds like you’ve already got something that works…