skylib_fluffos_v3/
skylib_fluffos_v3/bin/
skylib_fluffos_v3/bin/db/
skylib_fluffos_v3/fluffos-2.9-ds2.04/
skylib_fluffos_v3/fluffos-2.9-ds2.04/ChangeLog.old/
skylib_fluffos_v3/fluffos-2.9-ds2.04/Win32/
skylib_fluffos_v3/fluffos-2.9-ds2.04/compat/
skylib_fluffos_v3/fluffos-2.9-ds2.04/compat/simuls/
skylib_fluffos_v3/fluffos-2.9-ds2.04/include/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/clone/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/command/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/data/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/etc/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/include/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/inherit/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/inherit/master/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/log/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/single/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/single/tests/compiler/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/single/tests/efuns/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/single/tests/operators/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/u/
skylib_fluffos_v3/fluffos-2.9-ds2.04/tmp/
skylib_fluffos_v3/fluffos-2.9-ds2.04/windows/
skylib_fluffos_v3/mudlib/
skylib_fluffos_v3/mudlib/cmds/
skylib_fluffos_v3/mudlib/cmds/admin/
skylib_fluffos_v3/mudlib/cmds/guild-race/
skylib_fluffos_v3/mudlib/cmds/living/broken/
skylib_fluffos_v3/mudlib/cmds/player/group_cmds/
skylib_fluffos_v3/mudlib/cmds/playtester/
skylib_fluffos_v3/mudlib/d/admin/
skylib_fluffos_v3/mudlib/d/admin/room/
skylib_fluffos_v3/mudlib/d/admin/room/we_care/
skylib_fluffos_v3/mudlib/d/admin/save/
skylib_fluffos_v3/mudlib/d/admin/text/
skylib_fluffos_v3/mudlib/d/learning/TinyTown/buildings/
skylib_fluffos_v3/mudlib/d/learning/TinyTown/map/
skylib_fluffos_v3/mudlib/d/learning/TinyTown/roads/
skylib_fluffos_v3/mudlib/d/learning/chars/
skylib_fluffos_v3/mudlib/d/learning/functions/
skylib_fluffos_v3/mudlib/d/learning/handlers/
skylib_fluffos_v3/mudlib/d/learning/help_topics/
skylib_fluffos_v3/mudlib/d/learning/help_topics/npcs/
skylib_fluffos_v3/mudlib/d/learning/help_topics/objects/
skylib_fluffos_v3/mudlib/d/learning/help_topics/rcs_demo/
skylib_fluffos_v3/mudlib/d/learning/help_topics/rcs_demo/RCS/
skylib_fluffos_v3/mudlib/d/learning/help_topics/rooms/
skylib_fluffos_v3/mudlib/d/learning/help_topics/rooms/crowd/
skylib_fluffos_v3/mudlib/d/learning/help_topics/rooms/situations/
skylib_fluffos_v3/mudlib/d/learning/save/
skylib_fluffos_v3/mudlib/d/learning/school/
skylib_fluffos_v3/mudlib/d/learning/school/add_sc/
skylib_fluffos_v3/mudlib/d/learning/school/characters/
skylib_fluffos_v3/mudlib/d/learning/school/general/
skylib_fluffos_v3/mudlib/d/learning/school/getting-started/
skylib_fluffos_v3/mudlib/d/learning/school/getting-started/basic_commands/
skylib_fluffos_v3/mudlib/d/learning/school/getting-started/edtutor/
skylib_fluffos_v3/mudlib/d/learning/school/getting-started/unix_tutor/
skylib_fluffos_v3/mudlib/d/learning/school/items/
skylib_fluffos_v3/mudlib/d/learning/school/npc_school/
skylib_fluffos_v3/mudlib/d/learning/school/room_school/
skylib_fluffos_v3/mudlib/d/learning/school/room_school/room_basic/
skylib_fluffos_v3/mudlib/d/learning/school/room_school/situations/
skylib_fluffos_v3/mudlib/d/learning/school/room_school/terrain_tutor/
skylib_fluffos_v3/mudlib/d/learning/text/
skylib_fluffos_v3/mudlib/d/liaison/
skylib_fluffos_v3/mudlib/d/mudlib/
skylib_fluffos_v3/mudlib/d/mudlib/changes/
skylib_fluffos_v3/mudlib/d/playtesters/
skylib_fluffos_v3/mudlib/d/playtesters/effects/
skylib_fluffos_v3/mudlib/d/playtesters/handlers/
skylib_fluffos_v3/mudlib/d/playtesters/items/
skylib_fluffos_v3/mudlib/d/sage/
skylib_fluffos_v3/mudlib/doc/
skylib_fluffos_v3/mudlib/doc/creator/
skylib_fluffos_v3/mudlib/doc/driver/
skylib_fluffos_v3/mudlib/doc/driver/efuns/arrays/
skylib_fluffos_v3/mudlib/doc/driver/efuns/buffers/
skylib_fluffos_v3/mudlib/doc/driver/efuns/calls/
skylib_fluffos_v3/mudlib/doc/driver/efuns/compile/
skylib_fluffos_v3/mudlib/doc/driver/efuns/filesystem/
skylib_fluffos_v3/mudlib/doc/driver/efuns/floats/
skylib_fluffos_v3/mudlib/doc/driver/efuns/functions/
skylib_fluffos_v3/mudlib/doc/driver/efuns/general/
skylib_fluffos_v3/mudlib/doc/driver/efuns/mappings/
skylib_fluffos_v3/mudlib/doc/driver/efuns/mixed/
skylib_fluffos_v3/mudlib/doc/driver/efuns/mudlib/
skylib_fluffos_v3/mudlib/doc/driver/efuns/numbers/
skylib_fluffos_v3/mudlib/doc/driver/efuns/parsing/
skylib_fluffos_v3/mudlib/doc/login/
skylib_fluffos_v3/mudlib/doc/lpc/basic_manual/
skylib_fluffos_v3/mudlib/doc/lpc/intermediate/
skylib_fluffos_v3/mudlib/doc/new/add_command/
skylib_fluffos_v3/mudlib/doc/new/events/
skylib_fluffos_v3/mudlib/doc/new/handlers/
skylib_fluffos_v3/mudlib/doc/new/living/race/
skylib_fluffos_v3/mudlib/doc/new/living/spells/
skylib_fluffos_v3/mudlib/doc/new/object/
skylib_fluffos_v3/mudlib/doc/new/player/
skylib_fluffos_v3/mudlib/doc/new/room/guild/
skylib_fluffos_v3/mudlib/doc/new/room/outside/
skylib_fluffos_v3/mudlib/doc/new/room/storeroom/
skylib_fluffos_v3/mudlib/doc/object/
skylib_fluffos_v3/mudlib/doc/playtesters/
skylib_fluffos_v3/mudlib/doc/policy/
skylib_fluffos_v3/mudlib/doc/weapons/
skylib_fluffos_v3/mudlib/global/
skylib_fluffos_v3/mudlib/global/creator/
skylib_fluffos_v3/mudlib/handlers/
skylib_fluffos_v3/mudlib/include/casino/
skylib_fluffos_v3/mudlib/include/cmds/
skylib_fluffos_v3/mudlib/include/effects/
skylib_fluffos_v3/mudlib/include/npc/
skylib_fluffos_v3/mudlib/include/room/
skylib_fluffos_v3/mudlib/include/shops/
skylib_fluffos_v3/mudlib/net/daemon/
skylib_fluffos_v3/mudlib/net/daemon/chars/
skylib_fluffos_v3/mudlib/net/inherit/
skylib_fluffos_v3/mudlib/net/obj/
skylib_fluffos_v3/mudlib/net/obj/BACKUPS/
skylib_fluffos_v3/mudlib/obj/amulets/
skylib_fluffos_v3/mudlib/obj/armours/plate/
skylib_fluffos_v3/mudlib/obj/b_day/
skylib_fluffos_v3/mudlib/obj/clothes/transport/horse/
skylib_fluffos_v3/mudlib/obj/faith/symbols/
skylib_fluffos_v3/mudlib/obj/fungi/
skylib_fluffos_v3/mudlib/obj/gatherables/
skylib_fluffos_v3/mudlib/obj/instruments/
skylib_fluffos_v3/mudlib/obj/media/
skylib_fluffos_v3/mudlib/obj/misc/player_shop/
skylib_fluffos_v3/mudlib/obj/monster/godmother/
skylib_fluffos_v3/mudlib/obj/monster/transport/
skylib_fluffos_v3/mudlib/obj/rings/
skylib_fluffos_v3/mudlib/obj/scabbards/
skylib_fluffos_v3/mudlib/obj/spells/
skylib_fluffos_v3/mudlib/obj/stationery/
skylib_fluffos_v3/mudlib/obj/stationery/envelopes/
skylib_fluffos_v3/mudlib/obj/toys/
skylib_fluffos_v3/mudlib/obj/vessels/
skylib_fluffos_v3/mudlib/obj/weapons/axes/
skylib_fluffos_v3/mudlib/obj/weapons/chains/
skylib_fluffos_v3/mudlib/obj/weapons/maces/BACKUPS/
skylib_fluffos_v3/mudlib/save/autodoc/
skylib_fluffos_v3/mudlib/save/book_handler/
skylib_fluffos_v3/mudlib/save/books/history/calarien/
skylib_fluffos_v3/mudlib/save/mail/
skylib_fluffos_v3/mudlib/save/new_soul/data/
skylib_fluffos_v3/mudlib/save/parcels/
skylib_fluffos_v3/mudlib/save/playerinfo/
skylib_fluffos_v3/mudlib/save/players/d/
skylib_fluffos_v3/mudlib/save/players/s/
skylib_fluffos_v3/mudlib/save/random_names/
skylib_fluffos_v3/mudlib/save/random_names/data/
skylib_fluffos_v3/mudlib/save/terrains/
skylib_fluffos_v3/mudlib/save/terrains/tutorial_desert/
skylib_fluffos_v3/mudlib/save/terrains/tutorial_grassy_field/
skylib_fluffos_v3/mudlib/save/terrains/tutorial_mountain/
skylib_fluffos_v3/mudlib/save/todo_lists/
skylib_fluffos_v3/mudlib/secure/
skylib_fluffos_v3/mudlib/secure/cmds/admin/
skylib_fluffos_v3/mudlib/secure/cmds/lord/
skylib_fluffos_v3/mudlib/secure/config/
skylib_fluffos_v3/mudlib/secure/handlers/autodoc/
skylib_fluffos_v3/mudlib/secure/handlers/intermud/
skylib_fluffos_v3/mudlib/secure/include/global/
skylib_fluffos_v3/mudlib/secure/save/
skylib_fluffos_v3/mudlib/secure/save/handlers/
skylib_fluffos_v3/mudlib/secure/std/
skylib_fluffos_v3/mudlib/secure/std/classes/
skylib_fluffos_v3/mudlib/secure/std/modules/
skylib_fluffos_v3/mudlib/std/creator/
skylib_fluffos_v3/mudlib/std/dom/
skylib_fluffos_v3/mudlib/std/effects/
skylib_fluffos_v3/mudlib/std/effects/external/
skylib_fluffos_v3/mudlib/std/effects/fighting/
skylib_fluffos_v3/mudlib/std/effects/magic/
skylib_fluffos_v3/mudlib/std/effects/magic/BACKUPS/
skylib_fluffos_v3/mudlib/std/effects/other/BACKUPS/
skylib_fluffos_v3/mudlib/std/effects/priest/
skylib_fluffos_v3/mudlib/std/effects/room/
skylib_fluffos_v3/mudlib/std/environ/
skylib_fluffos_v3/mudlib/std/guilds/
skylib_fluffos_v3/mudlib/std/guilds/old/
skylib_fluffos_v3/mudlib/std/languages/
skylib_fluffos_v3/mudlib/std/liquids/
skylib_fluffos_v3/mudlib/std/npc/
skylib_fluffos_v3/mudlib/std/npc/goals/
skylib_fluffos_v3/mudlib/std/npc/goals/basic/
skylib_fluffos_v3/mudlib/std/npc/goals/misc/
skylib_fluffos_v3/mudlib/std/npc/plans/
skylib_fluffos_v3/mudlib/std/npc/plans/basic/
skylib_fluffos_v3/mudlib/std/npc/types/
skylib_fluffos_v3/mudlib/std/npc/types/helper/
skylib_fluffos_v3/mudlib/std/npcs/
skylib_fluffos_v3/mudlib/std/outsides/
skylib_fluffos_v3/mudlib/std/races/shadows/
skylib_fluffos_v3/mudlib/std/room/basic/BACKUPS/
skylib_fluffos_v3/mudlib/std/room/basic/topography/
skylib_fluffos_v3/mudlib/std/room/controller/
skylib_fluffos_v3/mudlib/std/room/inherit/topography/
skylib_fluffos_v3/mudlib/std/room/topography/area/
skylib_fluffos_v3/mudlib/std/room/topography/iroom/
skylib_fluffos_v3/mudlib/std/room/topography/milestone/
skylib_fluffos_v3/mudlib/std/shadows/curses/
skylib_fluffos_v3/mudlib/std/shadows/disease/
skylib_fluffos_v3/mudlib/std/shadows/fighting/
skylib_fluffos_v3/mudlib/std/shadows/healing/
skylib_fluffos_v3/mudlib/std/shadows/magic/
skylib_fluffos_v3/mudlib/std/shadows/poison/
skylib_fluffos_v3/mudlib/std/shadows/room/
skylib_fluffos_v3/mudlib/std/shops/controllers/
skylib_fluffos_v3/mudlib/std/shops/objs/
skylib_fluffos_v3/mudlib/std/shops/player_shop/
skylib_fluffos_v3/mudlib/std/socket/
skylib_fluffos_v3/mudlib/std/soul/d/
skylib_fluffos_v3/mudlib/std/soul/e/
skylib_fluffos_v3/mudlib/std/soul/i/
skylib_fluffos_v3/mudlib/std/soul/j/
skylib_fluffos_v3/mudlib/std/soul/k/
skylib_fluffos_v3/mudlib/std/soul/l/
skylib_fluffos_v3/mudlib/std/soul/n/
skylib_fluffos_v3/mudlib/std/soul/o/
skylib_fluffos_v3/mudlib/std/soul/q/
skylib_fluffos_v3/mudlib/std/soul/r/
skylib_fluffos_v3/mudlib/std/soul/u/
skylib_fluffos_v3/mudlib/std/soul/v/
skylib_fluffos_v3/mudlib/std/soul/y/
skylib_fluffos_v3/mudlib/std/soul/z/
skylib_fluffos_v3/mudlib/std/stationery/
skylib_fluffos_v3/mudlib/w/
skylib_fluffos_v3/mudlib/w/default/
skylib_fluffos_v3/mudlib/w/default/armour/
skylib_fluffos_v3/mudlib/w/default/clothes/
skylib_fluffos_v3/mudlib/w/default/item/
skylib_fluffos_v3/mudlib/w/default/npc/
skylib_fluffos_v3/mudlib/w/default/room/
skylib_fluffos_v3/mudlib/w/default/weapon/
skylib_fluffos_v3/mudlib/www/
skylib_fluffos_v3/mudlib/www/java/
skylib_fluffos_v3/mudlib/www/secure/
skylib_fluffos_v3/mudlib/www/secure/lpc/advanced/
skylib_fluffos_v3/mudlib/www/secure/lpc/intermediate/
skylib_fluffos_v3/win32/
/**
 * Basic door object used by rooms. Typically there is no need to use any of
 * the methods in this object since they are accessible through modify_exit.
 * @author pinkfish
 */
#include <door.h>
#include <parse_command.h>

#define BEVERB        ({" is ", " are "})
#define PRONOUN       ({"it", "them"})

#define CLOSED        2
#define CLOSED_LOCKED 3

inherit "/std/basic/enchant";
inherit "/std/basic/hide_invis";
inherit "/std/basic/property";
inherit "/std/basic/close_lock";
inherit "/std/basic/trap";
inherit "/std/basic/id_match";

private int how_many;
private int one_way;
private string shrt;
private string lng;
private string my_id;
private string other_id;
private string *name;
private string *adjs;
private string *plu;
private string dest;
private object key;
private object my_room;

void create() {
   hide_invis::create();
   property::create();
   close_lock::create();

   name = ({"door"});
   lng = "It's just a door.\n";
   shrt = "door";
   adjs = ({ });
   plu = ({ });

   add_property("determinate", "the ");
   set_unlocked();

} /* create() */

/** @ignore yes */
int group_object() { return how_many > 0; }

/** @ignore yes */
int query_how_many() { return how_many; }

/** @ignore yes */
void set_how_many( int number ) { how_many = number; }

/** @ignore yes */
int query_one_way() { return one_way; }

/** @ignore yes */
void set_one_way( int number ) { one_way = number; }

/** @ignore yes */
string query_short() {  return shrt; }

/** @ignore yes */
void set_short( string words ) {
   string *bits;

   shrt = words;
   bits = explode( words, " " );

   if( member_array( bits[<1], name ) == -1 )
       name += ({ bits[<1] });

   adjs += bits[0..<2];
   plu += ({ pluralize( bits[<1] ) });

} /* set_short() */

/** @ignore yes */
string query_long() { return lng; }

/** @ignore yes */
void set_long( string word ) {lng = word;}

/** @ignore yes */
string query_my_id() { return my_id; }

/** @ignore yes */
void set_my_id( string word ) { my_id = word; }

/** @ignore yes */
string query_other_id() { return other_id; }

/** @ignore yes */
void set_other_id( string word ) { other_id = word; }

/** @ignore yes */
string *query_name() { return name; }

/** @ignore yes */
string *query_adjs() { return adjs; }

/** @ignore yes */
string *query_plu() { return plu; }

/**
 * This method returns the destination room of this door.
 * @return the destination room of the door
 */
string query_dest() { return dest; }

/**
 * This method sets the destination room of the door.
 * @param word the filename of the destination room
 */
void set_dest( string word ) { dest = word; }

/**
 * This method returns the room this door belongs to.
 * @return the room we belong to
 */
object query_my_room() { return my_room; }

/** @ignore yes */
void init() {
    add_command("knock", "on <direct:object>");
    close_lock::init();
} /* init() */

/** @ignore yes */
string query_determinate() { return "the "; }
/** @ignore yes */
string short() { return query_short(); }
/** @ignore yes */
string a_short() { return "$a_short:"+ file_name( TO ) +"$"; }
/** @ignore yes */
string one_short() { return "$one_short:"+ file_name( TO ) +"$"; }
/** @ignore yes */
string poss_short() { return "$poss_short:"+ file_name( TO ) +"$"; }
/** @ignore yes */
string the_short() { return "$the_short:"+ file_name( TO ) +"$"; }
/** @ignore yes */
string pretty_short() { return query_short(); }
/** @ignore yes */
string query_plural() { return pluralize( query_short() ); }
/** @ignore yes */
string pretty_plural() { return pluralize( query_short() ); }

/** @ignore yes */
string long() {
    return lng + ( TP->query_see_octarine() ? enchant_string() :
                   "" ) + long_status();
} /* long() */

/** @ignore yes */
int drop() { return 1; }

/** @ignore yes */
int get() { return 1; }

/** @ignore yes */
void setup_door( string word, object mine, string his, mixed *args,
                 string type ) {
    string *bits;

    my_id = word;
    my_room = mine;
    dest = his;

    switch( type ) {
      case "window":
        if( word != "window")
            shrt = word + " window";
        else
            shrt = word;

        lng = "It's just the " + shrt + ".\n";
        name = ({ shrt, "window"});
        plu = ({"windows"});
      break;
      default:
        if( word[0..5] == "enter ") {
            shrt = word[6..]+" door";
            lng = "It's just the " + shrt + ".\n";
            name += ({ shrt });
            if( !args[D_SECRET ] )
                plu = ({"doors"});
        } else {
            shrt = word +" door";
            lng = "It's just the " + shrt + ".\n";
            name += ({ shrt });
            if( !args[D_SECRET ] )
                plu = ({"doors"});
        }
    }

    bits = explode( word, " ");
    name += ({ bits[<1] });
    adjs +=  bits;
    plu += ({ pluralize( bits[<1] ) });

    args[ D_CLOSED ] ? set_open() : set_closed();
    args[ D_LOCKED ] ? set_locked() : set_unlocked();

    set_key(args[ D_KEY ] );
    set_difficulty(args[ D_DIFFICULTY ] );
    if( args[ D_SECRET ] )
        add_hide_invis( "secret", 0, 200, 0 );

    if( sizeof(args) >= D_TRANSPARENT && args[D_TRANSPARENT] )
        set_transparent();

} /* setup_door() */

/** @ignore yes */
void add_alias( string word ) {
    string *bits;

    bits = explode( word, " ");

    if( member_array( bits[<1], name ) == -1 )
        name += ({ bits[<1] });

    adjs +=  bits[0..<2];
    plu += ({ pluralize( bits[<1] ) });

} /* add_alias() */

/** @ignore yes */
int force_other() {
    if( !other_id ) {
        ROOM_H->check_door( ({ my_room, my_id,  dest }) );
        if( !other_id )
            return 0;
    }

    if( find_object( dest ) )
        dest->query_door( my_room );

    return 1;

} /* force_other() */

/** @ignore yes */
int do_open() {
    if( !::do_open() )
        return 0;

    if( !force_other() && !one_way ) {
        set_closed();
        return 0;
    }

    if( objectp( query_property("lockpicked") ) )
        query_property("lockpicked")->event_door_open( TO, TP );

    // If the door is now open, it's outdoors and this is not a move
    // (i.e. the room handler is not involved), the wind could blow it shut.
    if( my_room->query_property("location") == "outside" &&
        member_array( find_object(ROOM_H), previous_object(-1) ) == -1 )
        ROOM_H->add_door( TO );

    if( !one_way && find_object(dest) ) {
        dest->modify_exit( other_id, ({"closed", 0 }) );
        dest->tell_door( other_id, TP->a_short()+" opens the $D.\n", 0 );
    }

    return 1;

} /* do_open() */

/** @ignore yes */
int do_close() {
    if( !::do_close() )
        return 0;

    if( !force_other() && !one_way ) {
        set_open();
        return 0;
    }

    if( !one_way && find_object(dest) ) {
        if( query_autolock() ) {
            dest->modify_exit( other_id, ({"closed", 1, "locked", 1 }) );
            dest->tell_door( other_id, "Someone closes the $D which lock$s "
                "as $p close$s.\n", 0 );
        } else {
            dest->modify_exit( other_id, ({"closed", 1 }) );
            dest->tell_door( other_id, "Someone closes the $D.\n", 0 );
        }
    }

    return 1;

} /* do_close() */

/** @ignore yes */
int do_lock( object *obs ) {
    if( !::do_lock(obs) )
        return 0;

    if( !force_other() && !one_way ) {
        set_unlocked();
        return 0;
    }

    if( !one_way && find_object(dest) ) {
        dest->modify_exit( other_id, ({"locked", 1 }));
        dest->tell_door( other_id, "Someone locks the $D.\n", 0 );
    }

    return 1;

} /* do_lock() */

/** @ignore yes */
int do_unlock( object *obs ) {
    if( !::do_unlock(obs) )
        return 0;

    if( !force_other() && !one_way ) {
        set_locked();
        return 0;
    }

    if( !one_way && find_object(dest) ) {
        dest->modify_exit( other_id, ({"locked", 0 }));
        dest->tell_door( other_id, "Someone unlocks the $D.\n", 0 );
    }

    return 1;

} /* do_unlock() */

/** @ignore yes */
int do_knock() {
    if( !other_id && !one_way ) {
        ROOM_H->check_door( ({ my_room, my_id }) );
        if( !other_id )
            return 0;
    }

    if( one_way )
        return 1;

    dest->tell_door( other_id, "Someone knocks on the $D.\n", 0 );
    event( find_object(dest), "door_knock", TP, other_id );

    return 1;

} /* do_knock() */

int pick_unlock( object thing ) {
    if( !::pick_unlock(thing) )
        return 0;

    if( !force_other() && !one_way ) {
        set_locked();
        return 0;
    }

    if( !one_way && find_object(dest) ) {
        dest->modify_exit( other_id, ({"locked", 0 }) );
        dest->tell_door( other_id, "Someone unlocks the $D.\n", 0 );
    }

    return 1;

} /* pick_unlock() */

int pick_lock( object thing ) {
    if( !::pick_lock(thing) )
        return 0;

    if( !force_other() && !one_way ) {
        set_unlocked();
        return 0;
    }

    if( !one_way && find_object(dest) ) {
        dest->modify_exit( other_id, ({"locked", 1 }) );
        dest->tell_door( other_id, "Someone locks the $D.\n", 0 );
    }

    return 1;

} /* pick_lock() */

/** @ignore yes */
string *parse_command_id_list() {
    return ( TP ? name + ({ TP->find_rel(my_id) }) : name );
} /* parse_command_id_list() */

/** @ignore yes */
string *parse_command_adjectiv_id_list() { return adjs; }

/** @ignore yes */
string *parse_command_plural_id_list() { return plu; }

/** @ignore yes */
object query_parse_id( mixed *arr ) {
   if( arr[P_THING] == 0 )
       return TO;

   // specific object case.
   if( arr[P_THING] < 0 ) {
       if( ++arr[P_THING] != 0 )
           return 0;
       arr[P_THING] = -10321;
       return TO;
   }

   // lots of objects case.
   if( --arr[P_THING] != 0 )
       return TO;

   arr[P_THING] = -10101;

   return TO;

} /* query_parse_id() */

/** @ignore yes */
mixed parse_match_object( string* input, object viewer,
                          class obj_match_context context ) {
   if( input[<1] == "all")
       return 0;

   return ::parse_match_object( input, viewer, context );

} /* parse_match_object() */

/** @ignore yes */
void dest_me() { destruct(TO); }

/** @ignore yes */
void dwep() { destruct( TO ); }

/**
 * This method is used by the room object ("undoor" option in modify_exit(),
 * more specifically) to get rid of doors.
 * We will first attempt to recycle the door, and if that fails,
 * we destruct it.
 * @param flag used internally
 */
varargs void go_away( int flag ) {
    if( !flag ) {
        call_out( (: go_away :), 0, 1 );
    } else {
        if( !ROOM_H->recycle_door(TO) )
            dest_me();
    }
} /* go_away() */

/** @ignore yes */
int move() { return 1; }

int moving_open( object thing ) {
    object tp = TP;

    set_this_player(thing);

    if( !::do_open() ) {
        set_this_player(tp);
        return 0;
    }

    if( !force_other() && !one_way ) {
        set_closed();
        return 0;
    }

    thing->remove_hide_invis("sneaking");

    if( !one_way && find_object(dest) ) {
        dest->modify_exit( other_id, ({ "closed", 0 }));
        dest->tell_door( other_id, thing->a_short()+" opens the $D.\n", 0 );
    }

    tell_object( thing, "You open the "+shrt+".\n" );
    tell_room( my_room, thing->the_short()+" opens the "+shrt+".\n", thing );

    return 1;

} /* moving_open() */

int moving_close( object thing ) {
    object tp = TP;

    set_this_player(thing);

    if( !::do_close() ) {
        set_this_player(tp);
        return 0;
    }

    if( !force_other() && !one_way ) {
        set_open();
        return 0;
    }

    if( !one_way && find_object(dest) ) {
        if( query_autolock() ) {
            dest->modify_exit( other_id, ({"closed", 1, "locked", 1 }) );
            dest->tell_door( other_id, thing->the_short()+" close$s the $D "
                "which lock$s as $p close$s.\n", thing );
        } else {
            dest->modify_exit( other_id, ({ "closed", 1 }) );
            if( thing->short() )
                dest->tell_door( other_id, thing->the_short()+" close$s "
                    "the $D.\n", thing );
        }
    }

    if( query_autolock() ) {
        tell_object( thing, "You close the "+dest->call_door( other_id,
            "query_short")+" which locks as it closes.\n");
        tell_room( my_room, thing->the_short()+" closes the "+shrt+" which "
            "locks as it closes.\n", thing );
    } else {
        tell_object( thing, "You close the "+dest->call_door( other_id,
            "query_short")+".\n");
        tell_room( my_room, thing->the_short()+" closes the "+shrt+".\n",
            thing );
    }

    return 1;

} /* moving_close() */

int moving_unlock( object thing ) {
    object tp = TP;

    set_this_player(thing);

    if( !::do_unlock( INV(thing) ) ) {
        set_this_player(tp);
        return 0;
    }

    if( !one_way && find_object(dest) )
        dest->modify_exit( other_id, ({"locked", 0 }) ) ;

    tell_object( thing, "You unlock the "+shrt+".\n");

    if( thing->short() )
        tell_room( my_room, thing->the_short()+" unlocks the "+
            shrt+".\n", thing );

    return 1;

} /* moving_unlock() */

int moving_lock( object thing ) {
    object tp = TP;

    set_this_player(thing);

    if( !::do_lock( INV(thing) ) ) {
        set_this_player(tp);
        return 0;
    }

    if( !one_way && find_object(dest) )
        dest->modify_exit( other_id, ({"locked", 1 }));

    tell_object( thing, "You lock the "+dest->call_door(
        other_id, "query_short")+".\n");

    if( thing->short() )
        dest->tell_door( other_id, thing->the_short()+" locks the $D.\n",
            thing );

    return 1;

} /* moving_lock() */

void tell_door( string words, object thing ) {
    tell_room( my_room, replace( words, ({ "$D", shrt, "$p",
        PRONOUN[how_many], "$s", ({"s", ""})[how_many] })), ({ thing }) );
} /* tell_door() */

/** @ignore yes */
mixed stats() {
    return property::stats() + close_lock::stats() + ({
        ({"how many", how_many }),
        ({"one way", one_way }),
        ({"my id", my_id }),
        ({"other id", other_id }),
        ({"destination", dest }),
        ({"key object", key }),
        ({"my room", my_room }),
    });
} /* stats() */

// Mask long status from close_lock to accurated describe double doors.
string long_status() {
    string str;

    // If it is stuck in one state don't bother telling us the state.
    if( !query_stuck() ) {
        str = ( query_how_many() > 0 ? "They are" : "It is");
        switch( query_closed_locked_status() ) {
          case CLOSED_LOCKED :
            return str + " closed and locked.\n";
          case CLOSED :
            return str + " closed.\n";
          default :
            return str + " open.\nThrough "+the_short()+" you can see:\n"+
                dest->long( 0, ( TP ? TP->check_dark( dest->query_light() ) :
                0 ) );
        }
    } else {
        return "";
    }

} /* long_status() */