/* Filename : forest.c
* Description : a forest with something to dig up
*
* 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/forestfuncs"
create()
{
::create();
set_short("In a forest");
set_long("You are standing inside a dark forest. High above you the "
"treetops are blocking the sunlight out, making the forest "
"dark and gloomy. There's something strange about this "
"forest. Not a sound can be heard anywhere.\n");
add_item(({"forest","dark forest","gloomy forest","strange forest",
"quiet forest"}),
"The forest is dark and quiet. Not a sound can be heard.\n");
add_neg("listen","","Nothing. It's so quiet in here.\n");
add_item(({"tree","trees","climbable tree","climbable trees"}),
"The trees actually looks climbable.\n");
add_item(({"top","tops","treetop","treetops"}),
"The treetops block the sunlight out, making the forest "
"dark and gloomy.\n");
add_item(({"light","sunlight","sun"}),"You can't see much of it down "
"here in this dark forest.\n");
add_item(({"ground","soft ground"}),"The ground feels soft here.\n");
add_trigger("dig",(:call_other,FUNC,"dig_ground",this_object():));
add_trigger("climb",(:call_other,FUNC,"climb_tree",this_object():));
add_hook("__reset",(:call_other,FUNC,"reset_forest",this_object():));
replace_program(I_ROOM);
}
/* Filename : forestfuncs.c
* Description : the functionfile for forest.c
*
* written : 02-10-1996 - Gunner
* last modified : 05-11-1997 - Gunner
* HTML-Version : 02-02-2000 - Ghorwin
*/
#include <mudlib.h>
#include "/doc/crashcourse/defs.h"
inherit I_DAEMON;
#define AMULET "/doc/crashcourse/course05/amulet"
#define TREE "/doc/crashcourse/course05/treebranch"
/*
* reset_forest : Makes sure the room is cleaned up ever reset
*/
void
reset_forest(object room)
{
// If the property 'ground_dug' exists, remove it
room->remove_property("ground_dug");
}
/*
* dig_ground : Let's see if we can't find some treasure hidden
* in the ground...
*/
int
dig_ground(object room, string arg)
{
object amulet;
// If the player didn't type 'dig ground' or 'dig soft ground'
// nothing happens...
if (!arg || (arg != "ground" && arg != "soft ground"))
return notify_fail("Dig what?\n");
// Has the ground been dug this reset already?
if (room->query_property("ground_dug"))
{
tell_object(TP,"You find nothing.\n");
return 1;
}
tell_object(TP,"After a lot of digging, you find an amulet which "
"you pick up.\n");
tell_room(room,"After some digging, " + TP->query_name() + " picks "
"up an amulet.\n",({TP}));
amulet = clone_object(AMULET);
amulet->move(TP);
// Make sure the ground is only dug once per reset
room->add_property("ground_dug");
return 1;
}
/*
* climb_tree : Let's see if we can get our asses up this tree...
*/
int
climb_tree(object room, string arg)
{
if (!arg || (arg != "tree" && arg != "trees" && arg != "up"))
return notify_fail("Climb what?\n");
tell_object(TP,"You climb up the nearest tree.\n");
tell_room(room,TP->query_name() + " climbs up the nearest tree.\n",({TP}));
// Move the player up the tree to the treebranch room.
TP->move_player("climbing up the tree",load_object(TREE));
return 1;
}