#include "boot.clh"
object ROOM
parents LOCATED_OBJ, DESCRIBED_OBJ;
list exits;
name = "Generic Room";
verb "go move" = go_verb;
method init
if (this == ROOM)
this.add_owner(WIZARD);
elseif (PERMS_OK)
exits = {};
pass();
else
raise E_PERM;
endif
endmethod /* init */
method destroy
var exit, thing;
ignore E_SERVERDN, E_OBJNF;
if (!PERMS_OK)
raise E_PERM;
else
for exit in (exits)
exit.destroy();
endfor
pass() to LOCATED_OBJ;
endif
endmethod
method id
return pass() to DESCRIBED_OBJ;
endmethod
method exits
return exits;
endmethod
method announce
/*
* announce a message to everyone in room, except if listed in 2nd arg
*/
var dude;
ignore E_METHODNF, E_SERVERDN;
for dude in (contents)
if (lengthof(args) == 1 || !(dude in args[2]))
dude.tell(args[1]); /* SSPOT */
endif
endfor
endmethod /* announce */
method go_verb /* verb */
if (!args[2])
player.tell("Go where?");
elseif(this.go(args[2]))
player.tell("There is no passage in that direction.");
endif
endmethod /* go_verb */
method go
var exit;
for exit in (exits)
if (exit.match(args[1]) && exit.dest)
exit.activate();
return 0;
endif
endfor
return -1;
endmethod /* go */
method look
var thing;
var nm;
ignore E_SERVERDN, E_OBJNF;
player.tell(name);
if (desc)
player.tell(desc);
endif
if (contents)
for thing in (contents)
if (thing != player)
nm = thing.sdesc;
if (nm == E_SERVERDN || nm == E_OBJNF)
player.tell("(Ghost of " + tostr(thing) + " is here.)");
else
player.tell(nm);
endif
endif
endfor
endif
endmethod /* look */
method match
return (args[1] == "here" && player.location == this);
endmethod /* match */
method match_exit
var exit;
for exit in (exits)
if (exit.match(args[1]))
return exit;
endif
endfor
return NOTHING;
endmethod /* match_exit */
method link_ok
return (PERMS_OK);
endmethod /* link_ok */
method open_ok
return (PERMS_OK);
endmethod /* open_ok */
method add_exit
if (PERMS_OK)
exits = exits + args[1];
else
raise (E_PERM);
endif
endmethod /* add_exit */
method rm_exit
if (PERMS_OK || caller in exits)
exits = exits - args[1];
else
raise(E_PERM);
endif
endmethod /* remove_exit */
endobject /* ROOM */