code/__DEFINES/maths.dm

SIGN | Gets the sign of x, returns -1 if negative, 0 if 0, 1 if positive |
---|---|
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))) |
SPT_PROB | Like SPT_PROB_RATE but easier to use, simply put if(SPT_PROB(10, 5)) |
Define Details
SIGN
Gets the sign of x, returns -1 if negative, 0 if 0, 1 if positive
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)))