parent $physical
parent $has_commands
object $location
var $location contents []
var $root child_index 0
var $root owners [$location]
var $root fertile 1
var $has_verbs verbs #[]
var $root inited 1
var $located location $void
var $root owned [$location]
var $gendered gender $gender_neuter
var $described prose #[]
var $root manager $location
var $root writable [$location]
var $root readable ['parameters, 'methods, 'code]
var $has_commands commands []
var $has_commands shortcuts []
var $root dbref 'location
var $named name ['uniq, "Generic Container Object"]
var $named name_aliases []
var $old_command_environment verb_cache #[]
var $old_command_environment command_cache []
var $old_command_environment shortcuts_cache []
method init_location
.perms(caller(), $root);
contents = [];
.
method uninit_location
var obj;
.perms(caller(), $root);
for obj in (contents)
obj.move_to($nowhere);
.
method contents
return contents || [];
.
method contains
arg obj;
return (obj in (.contents())) ? 1 | 0;
.
method put
arg obj;
obj._move_to(this());
.
method take
arg obj;
if (!(obj in contents))
throw(~objnf, ("Object (" + toliteral(obj)) + ") not in contents.");
obj._move_to(sender());
.
method will_arrive
arg old_place;
if (caller() != $located)
throw(~perm, "Caller is not $located.");
.
method will_leave
arg place;
if (caller() != $located)
throw(~perm, "Caller is not $located.");
.
method did_arrive
arg place;
if (caller() != $located)
throw(~perm, "Caller is not $located.");
(| .add_to_command_environment(sender()) |);
.
method did_leave
arg place;
if (caller() != $located)
throw(~perm, "Caller is not $located.");
(| .del_from_command_environment(sender()) |);
.
method add_sender_to_contents
disallow_overrides;
if (caller() != $located)
throw(~perm, "Caller is not $located.");
if ((sender().location()) != this())
throw(~location, "Sorry, but you're not here.");
contents = setadd(.contents(), sender());
.
method del_sender_from_contents
disallow_overrides;
if (caller() != $located)
throw(~perm, "Caller not an agent of located protocol.");
contents = setremove(contents, sender());
.
method validate_contents
var obj, newcont;
if (!(.is_writable_by(sender())))
throw(~perm, "Must be an owner to validate contents");
newcont = [];
for obj in (contents) {
if (valid(obj) && (obj.has_ancestor($located)))
newcont = setadd(newcont, obj);
}
contents = newcont;
.
method environment
return [this()] + contents;
.
method add_to_contents
disallow_overrides;
arg what;
if (caller() != $located)
throw(~perm, "Caller is not $located.");
.
method contents_accept_mail
return 1;
.
method realm
arg [args];
var loc;
loc = "";
if ((| .location() |))
loc = (.location()).realm();
return ((loc + "[") + (.namef())) + "]";
.
method realm_name
return "";
.
method local_verb_templates
var obj, out;
return dict_keys(.verb_cache());
out = [];
for obj in (.contents()) {
if (obj.has_ancestor($has_verbs))
out = out + dict_keys(obj.all_verbs());
}
return out;
.