OBJECT
/obj/mazemaster
SYNOPSIS
inherit "/obj/mazemaster";
#include <properties.h>
#include <mazemaster.h>
LAST UPDATE
Thragor, 17-May-95, 00:30 MET
DESCRIPTION
The mazemaster offers an easy to handle and very flexible way
to create a bunch of cloned rooms. The advantage is, that
if you have an area with many small room-files, you can get a
better view over them.
Before you start to write a real maze you should read the
hints in /doc/papers/howtowriteIF, as most of the time mazes
are just boring. Better make the player not feel like (s)he's
in a maze with always the same room-descriptions and nothing
interesting in it. Especially this mazemaster offers a lot of
features. You may add items in any form, as function or
whatever, you may include special commands into a room and so
on.
All you need is one file: The mazemaster. You don't need
special rooms, only special doors (/obj/mazedoor).
The mazemaster has three dimensions and might have some more
with some tricks. A planed feature of the mazemaster is, that
you may 'swap' between two mazes, i. e. all players standing
in the first maze will be moved into the second maze at the
same place. This is meant to simulate moving walls, but you
may think about other ways using it. Therefore each maze has a
'label'. Later you can swap between those labels.
Here are the functions of the mazemaster:
(Functions marked as protected may only be called by the
inheriting file.)
int *build_coor(int *coor)
protected
The mazemaster is three dimensions, so the co-ordinates have
to look like ({x,y,z}). If only ({x,y}) is given the third
value will be 0 after calling this function: ({x,y,0}).
If you just want to code one line of rooms you may also just
give one co-ordinate: ({x}) -> ({x,0,0}). Finally, giving an
empty array will return ({0,0,0}).
mapping P_ROOMS "Rooms"
This holds all the rooms. The structure is a bit complicate:
([<label>:([<z>:([<y>:([<x>:<file>,<properties>,<object>])])])])
mixed QueryRoomProps(string label,int *coor)
This will return the properties of a room.
mapping AddRoom(string label,int *coor,void|string|closure room,
void|mixed|mixed* properties)
Add a room to maze <label> at the co-ordinates <coor> (see
build_coor). If <room> is not given it defaults to
"/std/room". Otherwise it might be a closure (the function
has either to return the file to clone or the cloned room
itself) or the filename of the room to clone.
The closure function will be called with <label> and <coor>
as arguments.
The properties might be given as mapping or as array of
mappings (see room(S,AddItem)).
object create_room(string label,int *coor)
This function will clone the specified room and set the
properties. The objectpointer to the room will be returned.
mixed MovePlayer(object player,string label,int *coor,
void|int method,void|mixed extra)
This function handles the movement of <player. If necessary,
the room will be cloned and then <player> moved into it
with:
<player>->move(<room>,<method>,<extra>)
There's a small hack to allow GetExitDest to get the room,
where the player would move to. This is needed for the door
handling. This feature is just mentioned. It can't be used.
So the normal return-value is the one of 'move', i. e.
(int).
If a wizard moves in the maze, the co-ordinates of the room
are printed to her/him.
void AddExit(string label,int *coor,string|string* dir,
closure|string|object|int* dest,
void|object obj)
AddExit works similar to AddExit of the /std/room, to make
the handling more easy. You only have to give the label and
the co-ordinates where the room you want to add the exit to,
is located. <dir>,<dest> and <obj> may look just like the
normal arguments to AddExit in /std/room except, that <dest>
might also be the co-ordinates of another maze-room.
If the exit is added to a room, which does not exist, the
room will be added automatically as bare /std/room. This
allows to first set the exits and THEN the rooms (though it
might be stupid to do this).
mixed GetExitDest(object room,string dir)
Get the room where the exit <dir> is leading to from <room>.
The result is either the filename or the result when calling
the exit-closure or the co-ordinates of the room as:
({label,({x,y,z})})
void HideExit(string label,int *coor,string|string* dirs,
int new)
This function works as HideExit() of /std/room except that
you have to give the co-ordinates of the room.
void AddDoor(string label,int *coor,
string dir,
string|object|closure|int* dest,
mapping props,
void|string doorobj)
Add a door (and exit) for exit <dir> in the room specified
by label and coor leading to <dest> (see AddExit()).
<props> and <doorobj> are the same as described in
room(S,AddDoor) except that the default <doorobj> is
"/obj/mazedoor".
void AddDoor(string label,int *coor,
string dir,
string|object|closure|int* dest,
string doorid,
string doorlong,
mixed *|string keyid,
int state)
To offer the same compatibility as the /std/room for the
doors you may also use the old fashioned way to define
doors.
void clean_up()
Because the master mustn't clean_up, this function is
overloaded.
void remove()
If this is called, all room-objects in the maze get
destructed. If players are in the maze, they'll move to
/std/void.
void print_rooms()
This is just to check how the maze looks like. It is not for
any other use.
/obj/mazedoor only offers the following functions (which
are different or new to /obj/door):
string P_MASTER "Master"
This is the mazemaster who should control this door. The
property is set automatically when adding Doors with AddDoor
in the /obj/mazemaster.
mixed QueryOtherRoom()
This function is modified, to handle the virtual rooms.
INHERITANCE TREE
mazemaster
mazedoor
`-obj/door
SEE ALSO
howtowriteIF(P)