Daedalus Dock - Modules - TypesDefine Details

code/__HELPERS/maths.dm

/proc/get_angle Calculate the angle between two points and the west|east coordinate
/proc/get_pixel_angle for getting the angle when animating something's pixel_x and pixel_y
/proc/get_line Get a list of turfs in a line from starting_atom to ending_atom.
/proc/display_power Format a power value in W, kW, MW, or GW.
/proc/display_joules Format an energy value in J, kJ, MJ, or GJ. 1W = 1J/s.
/proc/display_energy Format an energy value measured in Power Cell units.
/proc/anyprob chances are 1:value. anyprob(1) will always return true
/proc/bit_count counts the number of bits in Byond's 16-bit width field, in constant time and memory!
/proc/make_tuple Returns the name of the mathematical tuple of same length as the number arg (rounded down).
DEG_TO_RADMultiplier for converting degrees to radians
RAD_TO_DEGMultiplier for converting radians to degrees
FrandA random real number between low and high inclusive
CeilValue or the next integer in a positive direction: Ceil(-1.5) = -1 , Ceil(1.5) = 2
CeilmValue or the next multiple of divisor in a positive direction. Ceilm(-1.5, 0.3) = -1.5 , Ceilm(-1.5, 0.4) = -1.2
CeilpValue or the nearest power of power in a positive direction: Ceilp(3, 2) = 4 , Ceilp(5, 3) = 9
FloorValue or the next integer in a negative direction: Floor(-1.5) = -2 , Floor(1.5) = 1
FloormValue or the next multiple of divisor in a negative direction: Floorm(-1.5, 0.3) = -1.5 , Floorm(-1.5, 0.4) = -1.6
RoundValue or the nearest integer in either direction
RoundmValue or the nearest multiple of divisor in either direction
PercentThe percentage of value in max, rounded to places: 1 = nearest 0.1 , 0 = nearest 1 , -1 = nearest 10, etc
IsIntegerTrue if value is an integer number.
IsPowerOfTwoTrue if value is a non-negative integer that is 0 or has a single bit set. 0, 1, 2, 4, 8 ...
IsEvenTrue if value is an integer that is not zero and does not have the 1 bit set
IsOddTrue if value is an integer that has the 1 bit set.
IsMultipleTrue if value is a multiple of divisor
IsInRangeTrue if value is between low and high inclusive
CscThe cosecant of degrees
SecThe secant of degrees
CotThe cotangent of degrees
/proc/Atan2 The 2-argument arctangent of x and y
/proc/Interpolate Returns a linear interpolation from a to b according to weight. weight 0 is a, weight 1 is b, weight 0.5 is half-way between the two.
/proc/Mean Returns the mean of either a list or variadic arguments: Mean(list(1, 2, 3)) = 2 , Mean(1, 2, 3) = 2
/proc/VecSquareMag Returns the euclidian square magnitude of a vector of either a list or variadic arguments: VecSquareMag(list(1, 2, 3)) = 14 , VecSquareMag(1, 2, 3) = 14
/proc/VecMag Returns the euclidian magnitude of a vector of either a list or variadic arguments: VecMag(list(3, 4)) = 5 , VecMag(3, 4) = 5
FAHRENHEITConverts kelvin to farenheit

Define Details

Ceil

Value or the next integer in a positive direction: Ceil(-1.5) = -1 , Ceil(1.5) = 2

Ceilm

Value or the next multiple of divisor in a positive direction. Ceilm(-1.5, 0.3) = -1.5 , Ceilm(-1.5, 0.4) = -1.2

Ceilp

Value or the nearest power of power in a positive direction: Ceilp(3, 2) = 4 , Ceilp(5, 3) = 9

Cot

The cotangent of degrees

Csc

The cosecant of degrees

DEG_TO_RAD

Multiplier for converting degrees to radians

FAHRENHEIT

Converts kelvin to farenheit

Floor

Value or the next integer in a negative direction: Floor(-1.5) = -2 , Floor(1.5) = 1

Floorm

Value or the next multiple of divisor in a negative direction: Floorm(-1.5, 0.3) = -1.5 , Floorm(-1.5, 0.4) = -1.6

Frand

A random real number between low and high inclusive

IsEven

True if value is an integer that is not zero and does not have the 1 bit set

IsInRange

True if value is between low and high inclusive

IsInteger

True if value is an integer number.

IsMultiple

True if value is a multiple of divisor

IsOdd

True if value is an integer that has the 1 bit set.

IsPowerOfTwo

True if value is a non-negative integer that is 0 or has a single bit set. 0, 1, 2, 4, 8 ...

Percent

The percentage of value in max, rounded to places: 1 = nearest 0.1 , 0 = nearest 1 , -1 = nearest 10, etc

RAD_TO_DEG

Multiplier for converting radians to degrees

Round

Value or the nearest integer in either direction

Roundm

Value or the nearest multiple of divisor in either direction

Sec

The secant of degrees