mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 22:50:26 +01:00
Adds more 513 compat stuff (#47230)
* Adds more 513 compat stuff * tan * ooops casing
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
// simple is_type and similar inline helpers
|
||||
|
||||
#if DM_VERSION < 513
|
||||
#define islist(L) (istype(L, /list))
|
||||
#endif
|
||||
|
||||
#define in_range(source, user) (get_dist(source, user) <= 1 && (get_step(source, 0)?:z) == (get_step(user, 0)?:z))
|
||||
|
||||
#if DM_VERSION < 513
|
||||
#define ismovableatom(A) (istype(A, /atom/movable))
|
||||
#else
|
||||
#define ismovableatom(A) ismovable(A)
|
||||
#endif
|
||||
|
||||
#define isatom(A) (isloc(A))
|
||||
|
||||
|
||||
@@ -30,7 +30,11 @@
|
||||
// round() acts like floor(x, 1) by default but can't handle other values
|
||||
#define FLOOR(x, y) ( round((x) / (y)) * (y) )
|
||||
|
||||
#if DM_VERSION < 513
|
||||
#define CLAMP(CLVALUE,CLMIN,CLMAX) ( max( (CLMIN), min((CLVALUE), (CLMAX)) ) )
|
||||
#else
|
||||
#define CLAMP(CLVALUE,CLMIN,CLMAX) clamp(CLVALUE, CLMIN, CLMAX)
|
||||
#endif
|
||||
|
||||
// Similar to clamp but the bottom rolls around to the top and vice versa. min is inclusive, max is exclusive
|
||||
#define WRAP(val, min, max) ( min == max ? min : (val) - (round(((val) - (min))/((max) - (min))) * ((max) - (min))) )
|
||||
@@ -39,7 +43,11 @@
|
||||
#define MODULUS(x, y) ( (x) - (y) * round((x) / (y)) )
|
||||
|
||||
// Tangent
|
||||
#if DM_VERSION < 513
|
||||
#define TAN(x) (sin(x) / cos(x))
|
||||
#else
|
||||
#define TAN(x) tan(x)
|
||||
#endif
|
||||
|
||||
// Cotangent
|
||||
#define COT(x) (1 / TAN(x))
|
||||
|
||||
Reference in New Issue
Block a user