1
!----------------------------------------------------------------------------
3
!----------------------------------------------------------------------------
4
! Author: Nicholas Daley <daleys@ihug.co.nz>
6
! Purpose: Provides a 'dirs' meta-verb that tells you which directions you
9
! It just checks if a value was given for the <dir>_to properties, so if one
10
! stored a string or a routine, then it will be included. If cant_go moves
11
! the player, then this is _not_ included.
12
! Location objects can provide an allow_directions property which may tell
13
! dirs.h:a)(return false)Print if the location provides the corresponding
15
! b)(" " true)The direction has already been printed
16
! c)(" " 2)Ignore this direction - don't print it
17
! d)(" " default)Definitely print this direction
18
!----------------------------------------------------------------------------
19
!Revision History:1.0=Original version (doesn't work with library 6/3 or
21
! 2.0=Works with libraries before and after library 6/3
22
! Added the 'allow_directions' property
23
! 2.1=can use verbs 'exits' or 'list exits' too.
24
!----------------------------------------------------------------------------
25
#ifndef DirectionName; #ifndef LanguageDirection;
26
Message fatalerror "dirs.h requires DirectionName() or \
27
LanguageDirection() to be declared (this should be \
28
done by the library)";
31
Property allow_directions;
33
[ DirsSub i flag flag2 j loc;
35
if(location==thedark) loc=real_location;
38
objectloop(i in Compass) {
39
if(loc provides allow_directions)
40
switch(loc.allow_directions(i))
42
false:flag=false;flag2=false; !Print if the corresponding *_to property
44
true:j++;flag2=true; !The direction has already been printed.
45
2:flag2=true; !Ignore this direction (do not print it)
46
default:flag=true; !Definitely print this direction
49
if(loc provides (i.door_dir) && metaclass(loc.(i.door_dir))~=nothing ||
50
flag==true && flag2==false)
54
DirectionName(i.door_dir);
56
#ifdef LanguageDirection;
57
LanguageDirection(i.door_dir);
67
Verb meta "dirs" "directions" * -> Dirs;
68
Verb meta "list" * "exits" -> Dirs;
69
Verb meta "exits" * -> Dirs;