OBJECT
/room/environ
SYNOPSIS
inherit "/room/environ";
LAST UPDATE
Softbyte, 24-Jul-95, 21:30 MET
DESCRIPTION
The simulation of environmental or similar effects on players
requires not only the notification of players entering or
leaving the room, but sometimes also continuous actions while
the players stays in the room.
The simple notification can already be done by using
notify_leave() and notify_enter(), but the continuous actions
needs a function set into the player's heart_beat hook.
/room/environ provides a simple interface to this, and also
has default functions at hand.
It's main purpose though is to form some sort of standard into
which 'standard environments' can be hooked into. We'll see.
If a living enters the room, following function is called:
mixed Enter (object living, mixed oldenv, int method, mixed extra)
<living> is the entering living, the other arguments are
directly taken from the underlying notify_enter()-call.
If a living leaves the room, this is called:
void Exit (object living, mixed dest, int method, mixed extra)
The <living> leaves the room. The other arguments are
directly taken from the underlying notify_leave()-call.
There is further the possibility to add a harmful environment
to the room. The room will then do a periodical damage to
the player in the room and write an appropriate message to
the player. The most common example is when one cannot
breath under water (DT_NOAIR). This will surely harm the player
if he/she is not protected.
The danger of the environment can vary between 1-100.
100 means a (randomized) damage of max 5HP/sec and 1 means
a damage of 0.05HP/sec.
A defences as defined via this_player()->AddDefence of a
certain damage type will be directly substraced from the
damage done. A defence of >=20 will fully protect the player!
varargs mixed AddEnvironment(int dam_type,mixed arg1,mixed arg2)
Adds an environment of dam_type to the room. dam_type must
be a damage type as defined in <combat.h> DT_XXXX.
The other two arguments are both optional and the function
will try to figure out what you have meant. If given, the first
one is the above mentioned strength (int 1..100) and the
other is the message (string) that the player will read when
he/she is hurt by the room. For the damage type DT_FIRE,
DT_COLD, DT_WATER (is NOT under water !!!), DT_GAS, DT_ACID
and DT_NOAIR (is under water) there are some default values
and default messages defined.
Multiple AddEnvironments add more than one environment
to the room.
mixed RemoveEnvironment(int dam_type)
Removes an environment of dam_type from the room, supposed
it had been present.
EXAMPLE
AddEnvironment(DT_NOAIR,92,"You cannot breath under water.\n");
AddEnvironment(DT_ACID,"You become burned by acid.\n");
AddEnvironment(DT_GAS,100);
AddEnvironment(DT_FIRE);
....
RemoveEnvironment(DT_ACID);
INHERITANCE TREE
/room/environ
`-/std/room
|-std/base
|-std/room/cleaning
|-std/room/items
|-std/room/details
|-std/room/exits
|-std/room/description
`-std/room/restrictions
SEE ALSO
room(S)