Goonstation 13 - Modules - TypesDefine Details

_std/macros/dir.dm

/var/cardinalNever Soggy Eat Waffles
/var/ordinalDiagonal directions
/var/alldirsEvery direction known to 2D tile-grid-locked spessmen
/var/dirnamesAssoc. list of dirs like "north"=NORTH
/var/dirvaluesAssoc. list of dirs like "[NORTH]" = "NORTH", useful for screen_loc
/proc/dir_to_dirnameReturns the lowercase english word for a direction (num)
/proc/dirname_to_dirReturns 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_magnitudeReturns the vector magnitude of an x value and a y value
/proc/vector_to_dirTransforms a supplied vector x & y to a direction
/proc/angle_to_dirTransforms a given angle to a cardinal/ordinal direction
/proc/dir_to_angleTransforms a cardinal/ordinal direction to an angle
/proc/angle_inbetweenChecks if an angle is between two other angles
/proc/angle_to_vectorTransforms 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