/
ColdCore-3.0a9.02/
ColdCore-3.0a9.02/src/
new object $in_location: $located_location;

var $described prose = [];
var $foundation defined_msgs = #[["enter", #[['branches, ["actor", "source", "dest"]]]], ["open", #[['branches, ["general", "actor", "inside"]]]], ["close", #[['branches, ["general", "actor", "inside"]]]]];
var $foundation msgs = #[["enter", #[["actor", <$ctext_frob, [["You enter ", <$generator, ["dest", [], [], 'gen_dest]>, "."], #[]]>], ["source", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " enters ", <$generator, ["dest", [], [], 'gen_dest]>, "."], #[]]>], ["dest", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " enters from ", <$generator, ["source", [], [], 'gen_source]>, "."], #[]]>]]], ["open", #[["general", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " opens ", <$generator, ["this", [], [], 'gen_this]>, "."], #[]]>], ["inside", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " opens ", <$generator, ["this", [], [], 'gen_this]>, "."], #[]]>], ["actor", <$ctext_frob, [["You open ", <$generator, ["this", [], [], 'gen_this]>, "."], #[]]>]]], ["close", #[["inside", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " closes ", <$generator, ["this", [], [], 'gen_this]>, "."], #[]]>], ["general", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " closes ", <$generator, ["this", [], [], 'gen_this]>, "."], #[]]>], ["actor", <$ctext_frob, [["You close ", <$generator, ["this", [], [], 'gen_this]>, "."], #[]]>]]]];
var $has_commands local = \
	#[["exit|leave", [["exit|leave", "", "exit|leave", 'exit_cmd, #[]]]], ["exit", [["exit", "", "exit", 'exit_cmd, #[]]]]];
var $has_commands remote = #[["enter", [["enter", "*", "enter <this>", 'enter_cmd, #[[1, ['this, []]]]]]], ["open", [["open", "*", "open <this>", 'open_cmd, #[[1, ['this, []]]]]]], ["close", [["close", "*", "close <this>", 'close_cmd, #[[1, ['this, []]]]]]]];
var $has_commands shortcuts = #[];
var $has_name name = ['prop, "in_location", "in_location"];
var $located location = $nowhere;
var $located obvious = 1;
var $location contents = [];
var $root created_on = 809991552;
var $root defined_settings = #[["locked", #[['parse, ['is_boolean]], ['format, ['format_boolean]]]], ["lockable", #[['parse, ['is_boolean]], ['format, ['format_boolean]]]], ["closable", #[['parse, ['is_boolean]], ['format, ['format_boolean]]]], ["closed", #[['parse, ['is_boolean]], ['format, ['format_boolean]]]]];
var $root flags = ['methods, 'code, 'variables, 'core, 'fertile];
var $root inited = 1;
var $root managed = [$in_location];
var $root manager = $in_location;
var $root settings = #[["locked", 0], ["lockable", 0], ["closable", 0], ["closed", 0]];
var $thing gender = $gender_neuter;

public method .close_cmd() {
    arg cmdstr, cmd, this;
    var vars, m;
    
    if (.get_setting("closable", $in_location)) {
        if (.get_setting("closed", $in_location)) {
            return ((.name()).capitalize()) + " is already closed.";
        } else {
            .set_setting("closed", $in_location, "yes");
            vars = #[["$actor", sender()], ["actor", sender().name()], ["$this", this()], ["this", .name()], ["$inside", this()]];
            m = .eval_message("close", $in_location, vars);
            (.location()).announce(m);
            .announce(m);
        }
    } else {
        return ((.name()).capitalize()) + " cannot be closed.";
    }
};

public method .description() {
    arg flags;
    var line;
    
    if (.get_setting("closed", $in_location))
        line = (((.gender()).pronoun('ps)).capitalize()) + " is closed.";
    else
        line = (("Inside " + (.name())) + " you see: ") + ((.contents()).map_to_english('name));
    return (> pass(flags) <) + [line];
};

public method .enter_cmd() {
    arg cmdstr, cmd, me;
    var m, source;
    
    (> .perms(caller(), 'command) <);
    if (.get_setting("closed", $in_location)) {
        return ((("You can't enter " + (.name())) + " because ") + ((.gender()).pronoun('ps))) + " is closed.";
    } else {
        source = sender().location();
        m = .eval_message("enter", $in_location, #[["actor", sender().name()], ["$actor", sender()], ["source", source.name()], ["$source", source], ["dest", .name()], ["$dest", this()], ["this", this()]]);
        sender().move_to(this());
        (.location()).announce(m);
        return .announce(m);
    }
};

public method .exit_cmd() {
    arg cmdstr, cmd;
    
    (> .perms(caller(), 'command) <);
    if ((sender().location()) != this())
        return ("You are not in " + (.name())) + "!";
    sender().move_to(.location());
    (.location()).announce(((((sender().name()).capitalize()) + " exits ") + (.name())) + ".", this(), sender());
    .announce(((sender().name()).capitalize()) + " leaves.");
    return "You arrive";
};

public method .open_cmd() {
    arg cmdstr, cmd, this;
    var vars, m;
    
    if (.get_setting("closable", $in_location)) {
        if (.get_setting("closed", $in_location)) {
            .set_setting("closed", $in_location, "no");
            vars = #[["$actor", sender()], ["actor", sender().name()], ["$this", this()], ["this", .name()], ["$inside", this()]];
            m = .eval_message("open", $in_location, vars);
            (.location()).announce(m);
            .announce(m);
        } else {
            return ((.name()).capitalize()) + " is already opened.";
        }
    } else {
        return ((.name()).capitalize()) + " cannot be opened.";
    }
};

public method .tell() {
    arg @args;
    
    if (.get_setting("closed", $in_location))
        return;
    .announce([("[outside " + (.name())) + "]: "] + args);
};