Goonstation 13 - Modules - TypesDefine Details

_std/macros/dir.dm

/var/cardinal Never Soggy Eat Waffles
/var/ordinal Diagonal directions
/var/alldirs Every direction known to 2D tile-grid-locked spessmen
/var/dirnames Assoc. list of dirs like "north"=NORTH
/var/dirvalues Assoc. list of dirs like "[NORTH]" = "NORTH", useful for screen_loc
/proc/dir_to_dirname Returns the lowercase english word for a direction (num)
/proc/dirname_to_dir Returns the direction (num) of a given lowercase english direction
is_cardinalReturns true if a direction is cardinal
angle2dirGiven an angle, matches it to the closest direction and returns it.
/proc/vector_magnitude Returns the vector magnitude of an x value and a y value
/proc/vector_to_dir Transforms a supplied vector x & y to a direction
/proc/angle_to_dir Transforms a given angle to a cardinal/ordinal direction
/proc/dir_to_angle Transforms a cardinal/ordinal direction to an angle
/proc/angle_inbetween Checks if an angle is between two other angles
/proc/angle_to_vector Transforms a given angle to vec2 in a list
turn_neededCalculates the angle you need to pass to the turn proc to get dir_to from dir_from turn(dir, turn_needed(dir, dir_to)) = dir_to
get_step_truly_randBYOND's default get_step_rand() is not actually uniformly random (heavily biased towards dir). This is a replacement that is actually uniformly random.
get_step_rand_cardinalReturns a tile in a random cardinal direction

Define Details

angle2dir

Given an angle, matches it to the closest direction and returns it.

get_step_rand_cardinal

Returns a tile in a random cardinal direction

get_step_truly_rand

BYOND's default get_step_rand() is not actually uniformly random (heavily biased towards dir). This is a replacement that is actually uniformly random.

is_cardinal

Returns true if a direction is cardinal

turn_needed

Calculates the angle you need to pass to the turn proc to get dir_to from dir_from turn(dir, turn_needed(dir, dir_to)) = dir_to