by Deadron
Helpful functions for handling directions and random movement. [More]
To download this library for your Linux/Mac installation, enter this on your command line:

DreamDownload byond://Deadron.Geography##version=2

Emulator users, in the BYOND pager go to File | Open Location and enter this URL:


Version 2
Date added: Jan 1 2002
Last updated: Jul 29 2009
7 fans
Returns the area for the object or mob, or null if the object is at the null location.

This returns a text name for direction.
For example, if direction is NORTH, this returns "NORTH".

dd_get_dist(first, second)
Returns the distance between two objects.
Objects can be anything with x and y variables.

dd_get_step(object, direction)
Returns the turf in the specified direction (NORTH, SOUTHWEST, etc) from the object.
Accepts any object with x, y, z variables defining its location.

dd_get_step_rand(object, considerDensity, randomness)
Returns a random valid turf one step away from the object (anything with x and y variables), or null if it can't find any valid turfs.

randomness determines the percentage chance that the step will be random instead of continuing in the direction the object was already moving.

This returns whatever direction is opposite of direction. For example, if direction is NORTH, dd_reverse_direction() returns SOUTH.

dd_step_rand(M, randomness)
Moves the object one step, returning 1 on success or null on failure.

randomness is the percentage chance that the object will move in a random direction instead of continuing in the direction it was already facing.