generic integrating room (#459)

(an instance of generic room made by Sick)


Go to location of this object, Sick.


HELP MANUAL:
     The generic integrating room (#459) allows objects with .look_msg properties to be 
integrated into the room's description, along with those exits with .obvious == 2.
     
     If the room's .integrating property is 0, objects' look_msgs will not be integrated 
into the room's description. Setting the .integrating property to a true value (1) 
will cause the room to integrate the messages. A a negative value (-1) prevents player 
objects from being integrated. The default .integration value is -1.
     
     If the room's .exits_first property is true, exits will be integrated before objects. 
Otherwise, objects are integrated first. By default, .exits_first is 1.
     
     Note that objects with non-string .look_msg properties will not be shown in the room's 
description or contents listing, effectively hiding them. However, the object must 
be owned by the room's owner, or be in the .residents list for this to work.
     
     [ based on Joe's integrating room #17755@lambdamoo -- sick. ]



VERB SOURCE CODE:

integrate_ok:
if (msg = $code_utils:verb_or_property(o = args[1], "look_msg"))
    if (is_player(o) && (this.integrating <= 0))
        "... players not shown if .integrating 0 or negative";
        return 0;
    elseif (typeof(msg) == STR)
        return 1;
    else
        "... room owner's objects and .residents are `hidden' when look_msg is non-string";
        return ((o.owner == this.owner) || (o in this.residents)) && -1;
    endif
endif
.


look_self:
if (!this.integrating)
    return pass(@args);
endif
player:tell(this:titlec());
if (!(args && args[1]))
    contents = integrated = {};
    for o in (setremove(this:contents(), player))
        if ((ok = this:integrate_ok(o)) > 0)
            integrated = setadd(integrated, o);
        elseif (!ok)
            contents = setadd(contents, o);
        endif
    endfor
    player:tell_lines(this:description(@integrated));
    this:tell_contents(contents, this.ctype);
else
    this:tell_contents(setremove(this:contents(), player), this.ctype);
    this:tell_exits();
endif
.


description:
if (!(args && this.integrating))
    return pass(@args);
endif
desc = this.description || "You see nothing special.";
"... don't pass() because $room:description will append exit messages without regard 
to .exits_first";
first = second = "";
for o in (args)
    first = tostr(first, first && this.look_sep_msg, $object_utils:has_callable_verb(o, 
"look_msg") ? o:look_msg() | $string_utils:pronoun_sub(o.look_msg, player, o));
endfor
for o in (this:obvious_exits(2))
    second = tostr(second, second && this.look_sep_msg, $object_utils:has_callable_verb(o, 
"look_msg") ? o:look_msg() | $string_utils:pronoun_sub(o.look_msg, player, o));
endfor
if (this.exits_first)
    temp = first;
    first = second;
    second = temp;
endif
if (typeof(desc) == STR)
    desc = tostr(desc, first && this.look_sep_msg, first, second && this.look_sep_msg, 
second);
else
    desc[length(desc)] = tostr(desc[length(desc)], (first || second) && this.look_sep_msg, 
first || second);
    if (first && second)
        desc = {@desc, second};
    endif
endif
return desc;
.



PROPERTY DATA:
      integrating
      exits_first
      help_msg

CHILDREN:
Entrance Passage Bell Tower Cathedral Altar Preparation Chamber Stair Landing Cathedral of Our Lady of the Stars Cathedral Steps Stairwell The Basement Tiny Alcove The Vault Storage Closet The House of Freaks The Tank