Generic Room with Surfaces (#2061)

(an instance of Generic Room with Seats made by Trismegistos)

     This child of the Generic Seated Room allows you to drop objects on seats, and program special messages for when this happens. Type 'help #2061' for more details.

Go to location of this object, wooden box.


HELP MANUAL:
     
     By means of a simple (if slightly clunky) graft, this child of the Generic Room with 
Seats (#955) enables you to simulate any number of surfaces in a room, on which objects 
may be placed and people sit. Essentially, you can now drop objects on, and take 
them from, seats -- except that these seats are not just for sitting any more.
     
     For information on adding seats and the messages associated with players occupying 
and vacating these seats, type 'help #955'. In fact, if you are not already familiar 
with #955, you should read its help before proceeding with this message.
     
     This room adds two main features: 
     
           1) The verb d*rop/th*row can now be typed: "drop  on ", in order 
to add a carried object to the list of sitters for that object. Both objects and 
players count toward saeted-limits on seats -- thus, a player may find a chair occupied 
by an object, and be unable to sit there. The directed "drop" on this room also takes 
the aliases "put" and "place".
     
           2) When you perform this directed drop, putting an object on a seat, a place 
and oplace message will be displayed. These messages may be set for specific seats 
with the verbs @place and @oplace  is <"message">. Like the @sit, etc. 
messages on #955, place and oplace messages take all standard substitutions plus 
bed for the seat-name.
     
     The main innovation in this room, though, will have to come from you the designer, 
in adding seats and writing messages that reflect the new concept of seats-as-surface-locations. 
For example:
     
     @detail barbecue is "A large barbecue pit, with a blazing mesquite-wood fire going."
     @add-seat barbecue for 2
     @sitting barbecue is "Lashed to a spit, sheitter slowly  over the flaming 
barbecue pit."
     @place barbecue is "You lash a gasoline can to a spit and put it on the bed."
     @sit barbecue is "You hop on a spit and let the flames of the bed lick your flesh."
     @stand barbecue is "You untie yourself and get off the bed spit, slightly charred."
     etc.
     
     A future upgrade will add the option of specifying classes of object that each seat 
may hold -- so you can create seats for players, tables for objects, bulletin boards 
for notes, etc. Till then, enjoy and be sure to tell me of any bugs you find! -- 
Trism




VERB SOURCE CODE:

d*rop th*row put place:
if (dobj in player.contents)
    seat = this:match_seat(iobjstr);
    if (seat)
        if (length(this.seat_types) >= seat)
            if ($object_utils:isa(dobj, toobj(this.seat_types[seat])))
                typeOK = 1;
            else
                typeOK = 0;
            endif
        else
            typeOK = 1;
        endif
        if (typeOK)
            if (length(this.sitting[seat]) < this.seats[seat][2])
                message = (length(this.place_msg) >= length(this.seats)) ? this.place_msg[seat] 
| "You set %d down on the %seat.";
                omessage = (length(this.oplace_msg) >= length(this.seats)) ? this.oplace_msg[seat] 
| "You set %d down on the %seat.";
                player:tell($string_utils:pronoun_sub(strsub(message, "%seat", this.seats[seat][1][1])));
                this:announce($string_utils:pronoun_sub(strsub(omessage, "%seat", 
this.seats[seat][1][1])));
                dobj:moveto(this);
                sitlist = this.sitting;
                sitlist[seat] = setadd(sitlist[seat], dobj);
                this:set_sitting(sitlist);
            else
                player:tell("There isn't enough room to put ", dobj.name, " there.");
            endif
        else
            player:tell("That location will only take descendants of ", toobj(this.seat_types[seat]).name);
        endif
    else
        player:tell("You can't put things there.");
    endif
else
    player:tell("You don't have that!");
endif
.


g*et,t*ake:
if (oldseat = this:find_sitter(dobj))
    sitlist = this.sitting;
    sitlist[oldseat] = setremove(sitlist[oldseat], dobj);
    this:set_sitting(sitlist);
endif
pass(@args);
.


@place @oplace:
"Copied from Generic Room with Seats (#955):@sit by Dred (#100) Sat Oct  8 15:41:37 
1994 EDT";
"Usage: @sit/@osit/@stand/@ostand/@ositting  is [message|default]";
"";
"Use this command to see and set the messages for your seats. With no indirect object 
string (i.e. `@sit  is'), you will be told the current message. If you use 
the word `default' as the message, the message will be cleared back to default values. 
Otherwise, the new [message] is set for that seat. Note that in addition to standard 
pronoun substitutions, the word %seat will be replaced with the name of the seat 
in your message.";
if ((!$perm_utils:controls(valid(cp = caller_perms()) ? cp | player, this)) && (caller 
!= this))
    return E_PERM;
endif
if (seat = this:match_seat(dobjstr))
    mesnam = tostr(verb[2..length(verb)], "_msg");
    if (iobjstr)
        if (iobjstr == "default")
            player:tell("You clear the \"", mesnam[1..length(mesnam) - 4], "\" message 
of seat \"", this.seats[seat][1][1], "\" back to default values.");
            this.(mesnam)[seat] = "";
        else
            player:tell("You set the \"", mesnam[1..length(mesnam) - 4], "\" message 
of seat \"", this.seats[seat][1][1], "\".");
            this.(mesnam)[seat] = iobjstr;
        endif
    else
        player:tell("The \"", mesnam[1..length(mesnam) - 4], "\" message of seat 
\"", this.seats[seat][1][1], "\":");
        if (!(msg = this.(mesnam)[seat]))
            vlist = $string_utils:words(verb_info(#955, mesnam)[3]);
            vind = mesnam in vlist;
            msg = this.defaults[vind];
        endif
        player:tell(msg);
    endif
else
    player:tell("Seat \"", dobjstr, "\" not found.");
endif
.


@add-seat:
nseats = length(this.seats);
player:tell("Seat to hold what kind of object: (type # or $; blank to default to any kind)");
type = $command_utils:read();
type = toobj(type);
if (!valid(toobj(type)))
    type = #1;
endif
pass(@args);
if (length(this.seats) > nseats)
    this.place_msg = {@this.place_msg, "You place %d down on the %seat."};
    while (length(this.seat_types) < length(this.seats))
        this.seat_types = {@this.seat_types, ""};
    endwhile
    this.seat_types[length(this.seat_types)] = type;
    this.oplace_msg = {@this.oplace_msg, "%N places %d down on the %seat."};
endif
.


@rm-seat:
nseats = length(this.seats);
seat = this:match_seat(dobjstr);
pass(@args);
if ((length(this.seats) < nseats) && (length(this.place_msg) == nseats))
    this.place_msg = listdelete(this.place_msg, seat);
    this.oplace_msg = listdelete(this.oplace_msg, seat);
endif
if ((length(this.seats) < nseats) && (length(this.seat_types) == nseats))
    this.seat_types = listdelete(this.seat_types, seat);
endif
.



PROPERTY DATA:
      place_msg
      oplace_msg
      seat_types
      seat_types;

CHILDREN:
River's Edge AnArchie Bunker Filling Station ramshackle hut Temple of Corwin aghari's hollow Ipsol's Alley Machine Shop crate