Space Station 13 - Modules - TypesDefine Details

code/__DEFINES/directions.dm

NO_DIRECTIONdefine purely for readability, cables especially need to use this as NO_DIRECTION represents a "node"
FLIP_DIR_HORIZONTALLYUsing the ^ operator or XOR, we can compared TRUE East and West bits against our direction, since XOR will only return TRUE if one bit is False and the other is True, if East is 0, that bit will return TRUE and if West is 1, then that bit will return 0 hence EAST (0010) XOR EAST|WEST (0011) --> WEST (0001) Flips a direction along the horizontal axis, will convert E -> W, W -> E, NE -> NW, SE -> SW, etc
FLIP_DIR_VERTICALLYFlips a direction along the vertical axis, will convert N -> S, S -> N, NE -> SE, SW -> NW, etc
IS_DIR_DIAGONALfor directions, each cardinal direction only has 1 TRUE bit, so 1000 or 0100 for example, so when you subtract 1 from a cardinal direction it results in that directions initial TRUE bit always switching to FALSE, so if you & check it against its initial self, it will return false, indicating that the direction is straight and not diagonal returns TRUE if direction is diagonal and false if not
IS_DIR_CARDINALreturns TRUE if direction is cardinal and false if not
NSCOMPONENTTrue if the dir is north or south, false therwise
EWCOMPONENTTrue if the dir is east/west, false otherwise
REVERSE_DIRInverse direction, taking into account UP|DOWN if necessary.
DIR_JUST_HORIZONTALreturns TRUE if the direction is EAST or WEST
DIR_JUST_VERTICALreturns TRUE if the direction is NORTH or SOUTH
TEXT_NORTHNorth direction as a string "[1]"
TEXT_SOUTHSouth direction as a string "[2]"
TEXT_EASTEast direction as a string "[4]"
TEXT_WESTWest direction as a string "[8]"

Define Details

DIR_JUST_HORIZONTAL

returns TRUE if the direction is EAST or WEST

DIR_JUST_VERTICAL

returns TRUE if the direction is NORTH or SOUTH

EWCOMPONENT

True if the dir is east/west, false otherwise

FLIP_DIR_HORIZONTALLY

Using the ^ operator or XOR, we can compared TRUE East and West bits against our direction, since XOR will only return TRUE if one bit is False and the other is True, if East is 0, that bit will return TRUE and if West is 1, then that bit will return 0 hence EAST (0010) XOR EAST|WEST (0011) --> WEST (0001) Flips a direction along the horizontal axis, will convert E -> W, W -> E, NE -> NW, SE -> SW, etc

FLIP_DIR_VERTICALLY

Flips a direction along the vertical axis, will convert N -> S, S -> N, NE -> SE, SW -> NW, etc

IS_DIR_CARDINAL

returns TRUE if direction is cardinal and false if not

IS_DIR_DIAGONAL

for directions, each cardinal direction only has 1 TRUE bit, so 1000 or 0100 for example, so when you subtract 1 from a cardinal direction it results in that directions initial TRUE bit always switching to FALSE, so if you & check it against its initial self, it will return false, indicating that the direction is straight and not diagonal returns TRUE if direction is diagonal and false if not

NO_DIRECTION

define purely for readability, cables especially need to use this as NO_DIRECTION represents a "node"

NSCOMPONENT

True if the dir is north or south, false therwise

REVERSE_DIR

Inverse direction, taking into account UP|DOWN if necessary.

TEXT_EAST

East direction as a string "[4]"

TEXT_NORTH

North direction as a string "[1]"

TEXT_SOUTH

South direction as a string "[2]"

TEXT_WEST

West direction as a string "[8]"