/tg/ Station 13 - Modules - Types

code/__HELPERS/maths.dm

/proc/get_angleCalculate the angle between two movables and the west|east coordinate
/proc/delta_to_angleCalculate the angle produced by a pair of x and y deltas
/proc/get_angle_rawAngle between two arbitrary points and horizontal line same as /proc/get_angle
/proc/get_pixel_anglefor getting the angle when animating something's pixel_x and pixel_y
/proc/get_lineGet a list of turfs in a line from starting_atom to ending_atom.
/proc/get_perimeterGet a list of turfs in a perimeter given the center_atom and radius. Automatically rounds down decimals and does not accept values less than positive 1 as they don't play well with it. Is efficient on large circles but ugly on small ones Uses Jesko`s method to the midpoint circle Algorithm.
/proc/siunit_isolatedFormats a number into a list representing the si unit. Access the coefficient with [SI_COEFFICIENT], and access the unit with [SI_UNIT].
/proc/display_power*Format a power value in prefixed watts.
/proc/display_energyFormat an energy value in prefixed joules. Arguments
/proc/energy_to_powerConverts the joule to the watt, assuming SSmachines tick rate. Arguments
/proc/power_to_energyConverts the watt to the joule, assuming SSmachines tick rate.
/proc/anyprobchances are 1:value. anyprob(1) will always return true
/proc/bit_countcounts the number of bits in Byond's 16-bit width field, in constant time and memory!
/proc/make_tupleReturns the name of the mathematical tuple of same length as the number arg (rounded down).
/proc/at_leastTakes a value, and a threshold it has to at least match returns the correctly signed value max'd to the threshold
/proc/reciprocal_addTakes two values x and y, and returns 1/((1/x) + y) Useful for providing an additive modifier to a value that is used as a divisor, such as /obj/projectile/var/speed
/proc/prefix_zeros_to_numberReturns a text string containing N prefixed with a series of zeros with length equal to max_zeros minus log(10, N), rounded down.
/proc/reverse_angle180s an angle