Space Station 13 - Modules - TypesDefine Details

code/__DEFINES/_math.dm

TOBITSHIFTGets shift x that would be required the bitflag (1<<x)
SPT_PROB_RATEConverts a probability/second chance to probability/seconds_per_tick chance For example, if you want an event to happen with a 10% per second chance, but your proc only runs every 5 seconds, do if(prob(100*SPT_PROB_RATE(0.1, 5)))
SPT_PROBLike SPT_PROB_RATE but easier to use, simply put if(SPT_PROB(10, 5))
IS_INTChecks if a number is an integer, or a float
hex2numReturns an integer given a hex input, supports negative values "-ff". Skips preceding invalid characters.
num2hexReturns the hex value of a decimal number. len == length of returned string.

Define Details

IS_INT

Checks if a number is an integer, or a float

SPT_PROB

Like SPT_PROB_RATE but easier to use, simply put if(SPT_PROB(10, 5))

SPT_PROB_RATE

Converts a probability/second chance to probability/seconds_per_tick chance For example, if you want an event to happen with a 10% per second chance, but your proc only runs every 5 seconds, do if(prob(100*SPT_PROB_RATE(0.1, 5)))

TOBITSHIFT

Gets shift x that would be required the bitflag (1<<x)

hex2num

Returns an integer given a hex input, supports negative values "-ff". Skips preceding invalid characters.

num2hex

Returns the hex value of a decimal number. len == length of returned string.