/* Filename : path.c
* Description : an enchanted path
*
* written : 02-10-1996 - Gunner
* last modified : 26-05-1998 - Gunner
* HTML-Version : 02-02-2000 - Ghorwin
*/
#include <mudlib.h>
inherit I_ROOM;
#define FUNC "/doc/crashcourse/course05/pathfuncs"
create()
{
::create();
set_light(1);
set_short("A path");
set_long("You are walking along a path running north towards "
"a mountain that can be seen in the distance. There "
"seems to be some kind of a hole in it.\n");
add_item(({"path","small path"}), "It's just a small path running "
"north towards a mountain.\n");
add_item("mountain","You can see the mountain rise up in the distance.\n");
add_item("hole","Could it be a cave?\n");
add_item("cave","It could be a cave, but it's hard to tell from this "
"far away.\n");
add_item("ground", "It's still beneath you. Stop worrying!\n");
add_item("sky","The sky is still up there. Getting paranoid?\n");
add_item(({"cloud","clouds"}),"The clouds are still attached to that "
"big bluish thing up there.\n");
add_item(({"thing","bluish thing","big thing","big bluish thing"}),
"It's the sky, stupid...\n");
add_item("sun","You can't see it because of all the clouds up there.\n");
// Let's hook some events in the room. One is for when the room
// resets and the other is for objects entering the room...
add_hook("__reset",(:call_other,FUNC,"reset_path",this_object():));
add_hook("__enter_inv",({FUNC,"enter_path"}),this_object());
replace_program(I_ROOM);
}
/* Filename : pathfuncs.c
* Description : the functionfile for path.c
*
* written : 02-10-1996 - Gunner
* last modified : 05-11-1997 - Gunner
* HTML-Version : 02-02-2000 - Ghorwin
*/
#include <mudlib.h>
inherit I_DAEMON;
#define PIZZA "/doc/crashcourse/course02/pizza"
/*
* reset_path : is called by the __reset hook
*/
void
reset_path(object room)
{
// Send a message into the room every time it resets
tell_room(room, "The room shakes slightly as the almighty RESET monster "
"bumps into it.\n");
}
/* enter_path : is called by the __enter_inv hook
* The room object is something we're passing through,
* while the ob and from objects are both standard arguments
*/
void
enter_path(object room, object ob, object from)
{
object new_ob;
if (living(ob) || // Allow living objects into the room
ob->query_id("pizza")) return; // Allow pizza's in the room. ;-)
tell_room(room, "As the " + ob->query_name() + " falls to the ground, "
"it vanishes. And a pizza appears there instead.\n");
// Destroy any non-living object that enters the room
ob->destroy();
// Clone a pizza from course #02
new_ob = clone_object(PIZZA);
// Move the pizza out into the room
new_ob->move(room);
}