[Package Index | Mudlib Index | Effect Index]
File /obj/handlers/direction_handler.c
Direction HandlerWritten by Elera
Started 11 July 2006
This is a basic handler you can use to determine the location of one
object relative to the location of another object.
Method index
- basic_direction(int *, int *)
A basic function to show the approximate direction from the start
position to the target position.
- calc_degrees(int *, int *)
A basic function to show the precise direction from the start
position to the target position.
- cardinal_direction(int *, int *)
A basic function to show the approximate direction from the start
position to the target position.
- compass_direction(int *, int *)
A basic function to show a fairly precise direction from the start
position to the target position.
- vertical_direction(int *, int *)
A basic function to show if the target is up or down from the start
position.
Public Functions
These are functions that everyone can access.
-
basic_direction
string basic_direction(int * start,
int * target)
A basic function to show the approximate direction from the start
position to the target position.
- Parameters:
start - The coords of the first object
target - The coords of the second object
- Returns:
string "north", "southeast", or similar
-
calc_degrees
string calc_degrees(int * start,
int * target)
A basic function to show the precise direction from the start
position to the target position. It will give the degrees
east, west, north, or south from the start location's x or y axis to which
the target is nearest. If due west or southeast, etc, it will
return "due west" or "due southeast", etc.
- Parameters:
start - The coords of the first object
target - The coords of the second object
- Returns:
string "17 degrees east of due north"
-
cardinal_direction
string cardinal_direction(int * start,
int * target)
A basic function to show the approximate direction from the start
position to the target position. It will not give combined
directions like "northeast".
- Parameters:
start - The coords of the first object
target - The coords of the second object
- Returns:
string "north", "south", "east" or "west"
-
compass_direction
string compass_direction(int * start,
int * target)
A basic function to show a fairly precise direction from the start
position to the target position. It will estimate the closest
compass direction frm the start position to the target position.
- Parameters:
start - The coords of the first object
target - The coords of the second object
- Returns:
string "west", "southeast", "north-northwest"
-
vertical_direction
string vertical_direction(int * start,
int * target)
A basic function to show if the target is up or down from the start
position. If the target is not higher or lower than the start
position, it will return an empty string.
- Parameters:
start - The coords of the first object
target - The coords of the second object
- Returns:
string "up" or "down"