Daedalus Dock - Modules - TypesDefine Details

code/__DEFINES/maths.dm

SIGNGets the sign of x, returns -1 if negative, 0 if 0, 1 if positive
WRAP_UPIncrements a value and wraps it if it exceeds some value. Can be used to circularly iterate through a list through idx = WRAP_UP(idx, length_of_list).
TOBITSHIFTGets shift x that would be required the bitflag (1<<x)
DT_PROB_RATEConverts a probability/second chance to probability/delta_time 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*DT_PROB_RATE(0.1, 5)))
DT_PROBLike DT_PROB_RATE but easier to use, simply put if(DT_PROB(10, 5))
DIAMOND_AREAThe number of cells in a taxicab circle (rasterized diamond) of radius X.
MAPCLAMPSee above, but clamps the resulting value between omin and omax

Define Details

DIAMOND_AREA

The number of cells in a taxicab circle (rasterized diamond) of radius X.

DT_PROB

Like DT_PROB_RATE but easier to use, simply put if(DT_PROB(10, 5))

DT_PROB_RATE

Converts a probability/second chance to probability/delta_time 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*DT_PROB_RATE(0.1, 5)))

MAPCLAMP

See above, but clamps the resulting value between omin and omax

SIGN

Gets the sign of x, returns -1 if negative, 0 if 0, 1 if positive

TOBITSHIFT

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

WRAP_UP

Increments a value and wraps it if it exceeds some value. Can be used to circularly iterate through a list through idx = WRAP_UP(idx, length_of_list).