Space Station 13 - Baystation 12 - Modules - TypesDefine Details

code/_helpers/maths.dm

DEG_TO_RADMultiplier for converting degrees to radians
RAD_TO_DEGMultiplier for converting radians to degrees
PIThe mathematical constant pi to f32 precision
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
/proc/Drand Returns a random real from an arbitrary XdY dice roll
NrandAn aproximate, fairly granular random normal real number in 0..1
/proc/CircularRandomCoordinate A circular random coordinate pair from 0, unit by default, scaled by radius, then rounded if round.
/proc/BoundedCircularRandomCoordinate A circular random coordinate with radius on center_x, center_y, reflected into low_x,low_y -> high_x,high_y, clamped in low,high, and rounded if round is set
/proc/CircularRandomTurf Pick a random turf using BoundedCircularRandomCoordinate about x,y on level z
/proc/CircularRandomTurfAround Pick a random turf using BoundedCircularRandomCoordinate around the turf of target

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

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 ...

Nrand

An aproximate, fairly granular random normal real number in 0..1

PI

The mathematical constant pi to f32 precision

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