Dump of #6792 (Generic Integrating Description Room)

@create #3879 named Generic Integrating Description Room:Generic Integrating Description Room
@prop #6792."enabled" -1 rc
@prop #6792."look_sep_msg" "  " rc
"#6792.("entrances") => E_PERM (Permission denied)
"#6792.("exits") => E_PERM (Permission denied)
"#6792.("key") => E_PERM (Permission denied)
;;#6792.("aliases") = {"Generic Integrating Description Room"}
;;#6792.("description") = "Integrates some objects in its .contents or .exits into its description. .enabled >0 all objects with :look_msg() verbs or .look_msg property, <0 not players, 0 none of them. Inspired by a similar room on alphamoo that Woodlock wrote."
;;#6792.("object_size") = {3706, 1141286549}

@verb #6792:"look_self" this none this
@program #6792:look_self
if ((!this.enabled) || (args && args[1]))
  return pass(@args);
endif
player:tell(this:title());
c = i = {};
for k in (this:exits())
  if (valid(k) && (this:ok(k) > 0))
    i = listappend(i, k);
  endif
endfor
for k in (setremove(this:contents(), player))
  if ((y = this:ok(k)) > 0)
    i = setadd(i, k);
  elseif (y == 0)
    c = listappend(c, k);
  endif
endfor
player:tell_lines(this:description(@i));
this:tell_contents(c, this.ctype);
.

@verb #6792:"description" this none this
@program #6792:description
d = pass();
if ((args == {}) || (!this.enabled))
  return d;
else
  s = ex = "";
  for k in (args)
    lookmsg = $object_utils:has_verb(k, "look_msg") ? k:look_msg() | k.look_msg;
    s = tostr(s, ex, $string_utils:pronoun_sub(lookmsg, k, k));
    ex = this.look_sep_msg;
  endfor
endif
if (typeof(d) == LIST)
  return listappend(d, s);
elseif (typeof(d) == STR)
  return (d + this.look_sep_msg) + s;
else
  return s;
endif
.

@verb #6792:"ok" this none this
@program #6792:ok
"An object is 'OK' for inclusion in the room's desc if it has some sort of look_msg";
"If the message is a string it gets included.";
"If it's a non-string the object is invisible (must be owned by the room's owner, or a resident).";
".enabled<0 suppresses players being included.";
k = args[1];
if (($object_utils:has_callable_verb(k, "look_msg") && (y = k:look_msg())) || ($object_utils:has_property(k, "look_msg") && (y = k.look_msg)))
  if (is_player(k) && (this.enabled <= 0))
    return 0;
  elseif ((k.owner == this.owner) || (k in this.residents))
    return (typeof(y) == STR) ? 1 | ((typeof(y) == OBJ) ? -1 | 0);
  else
    return (typeof(y) == STR) && 1;
  endif
endif
.

@verb #6792:"description(old)" this none this rd
@program #6792:description(old)
"Copied from Generic Integrating Description Room (#6792):description by Gary_Severn (#15) Wed Sep  1 01:52:23 1993 PDT";
d = pass();
if ((args == {}) || (!this.enabled))
  return d;
else
  s = ex = "";
  for k in (args)
    s = (s + ex) + $string_utils:pronoun_sub($object_utils:has_verb(k, "look_msg") ? k:look_msg() | k.look_msg, k);
    ex = this.look_sep_msg;
  endfor
endif
if (typeof(d) == LIST)
  return listappend(d, s);
elseif (typeof(d) == STR)
  return (d + this.look_sep_msg) + s;
else
  return s;
endif
.

"***finished***