/
ColdCore-3.0a9.02/
ColdCore-3.0a9.02/src/
new object $located: $physical;

var $described prose = [];
var $has_name name = ['uniq, "Generic Located Object", "the Generic Located Object"];
var $located inited = 0;
var $located location = $lost_and_found;
var $located obvious = 1;
var $root created_on = 796268969;
var $root flags = ['methods, 'code, 'variables, 'core];
var $root managed = [$located];
var $root manager = $located;

protected method .did_move() {
    arg mover, old_place;
    
    // cleanup events  
    .unhook_events('move, old_place);
    old_place.send_event('movement, 'leave, old_place);
    location.send_event('movement, 'arrive);
    .hook_events('move);
};

public method .environment() {
    return [this()] + ((location.environment()).setremove(this()));
};

root method .init_located() {
    location = $void;
    location.add_sender_to_contents();
    obvious = 1;
};

public method .is_obvious_to() {
    arg whom;
    
    return .is_visible_to(whom);
};

public method .location() {
    return location || $void;
};

public method .match_environment() {
    arg str;
    var thing, matches;
    
    if (str == "here")
        return location;
    return (> pass(str) <);
};

public method .match_environment_all() {
    arg s;
    
    if (s == "here")
        return [location, @(> pass(@args) <)];
    else
        return (> pass(s) <);
};

public method .move_to(): nooverride  {
    arg place;
    var old;
    
    // Don't do anything if we're already here.
    if (place == location)
        return;
    if (!(place.has_ancestor($location)))
        throw(~type, "Argument is not a location.");
    
    // Notify involved parties of impending move, allowing them to throw
    // errors.
    if (!valid(location))
        location = $nowhere;
    (> .will_move(sender(), place) <);
    (> location.will_leave(place) <);
    (> place.will_arrive(location) <);
    
    // Set location.
    old = location;
    location = place;
    old.del_sender_from_contents();
    place.add_sender_to_contents();
    
    // Notify involved parties of completed move, in reverse order.
    place.did_arrive(old);
    old.did_leave(place);
    .did_move(sender(), old);
};

public method .obvious() {
    return obvious;
};

public method .realm() {
    return realm;
};

public method .realm_name() {
    arg @args;
    
    return (.location()).realm_name(@args);
};

public method .set_obvious() {
    arg obv;
    
    .perms(sender());
    obvious = obv;
};

public method .uninit_guest_guest() {
    if (caller() != $root)
        throw(~perm, "Caller is not root.");
    location.del_sender_from_contents();
    location = 0;
};

root method .uninit_located() {
    (.location()).del_sender_from_contents();
};

public method .will_move() {
    arg mover, place;
    
};