mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2025-12-20 07:12:55 +00:00
Some math, mob helper/ one-liner optimizations
This commit is contained in:
@@ -199,27 +199,27 @@
|
||||
interpreter.SetProc("tostring", /proc/n_num2str)
|
||||
interpreter.SetProc("sqrt", /proc/n_sqrt)
|
||||
interpreter.SetProc("abs", /proc/n_abs)
|
||||
interpreter.SetProc("floor", /proc/Floor)
|
||||
interpreter.SetProc("ceil", /proc/Ceiling)
|
||||
interpreter.SetProc("floor", /proc/n_floor)
|
||||
interpreter.SetProc("ceil", /proc/n_ceiling)
|
||||
interpreter.SetProc("round", /proc/n_round)
|
||||
interpreter.SetProc("clamp", /proc/n_clamp)
|
||||
interpreter.SetProc("inrange", /proc/IsInRange)
|
||||
interpreter.SetProc("inrange", /proc/n_isInRange)
|
||||
interpreter.SetProc("rand", /proc/rand_chance)
|
||||
interpreter.SetProc("arctan", /proc/Atan2)
|
||||
interpreter.SetProc("lcm", /proc/Lcm)
|
||||
interpreter.SetProc("lcm", /proc/n_lcm)
|
||||
interpreter.SetProc("gcd", /proc/Gcd)
|
||||
interpreter.SetProc("mean", /proc/Mean)
|
||||
interpreter.SetProc("root", /proc/Root)
|
||||
interpreter.SetProc("root", /proc/n_root)
|
||||
interpreter.SetProc("sin", /proc/n_sin)
|
||||
interpreter.SetProc("cos", /proc/n_cos)
|
||||
interpreter.SetProc("arcsin", /proc/n_asin)
|
||||
interpreter.SetProc("arccos", /proc/n_acos)
|
||||
interpreter.SetProc("tan", /proc/Tan)
|
||||
interpreter.SetProc("csc", /proc/Csc)
|
||||
interpreter.SetProc("cot", /proc/Cot)
|
||||
interpreter.SetProc("sec", /proc/Sec)
|
||||
interpreter.SetProc("todegrees", /proc/ToDegrees)
|
||||
interpreter.SetProc("toradians", /proc/ToRadians)
|
||||
interpreter.SetProc("tan", /proc/n_tan)
|
||||
interpreter.SetProc("csc", /proc/n_csc)
|
||||
interpreter.SetProc("cot", /proc/n_cot)
|
||||
interpreter.SetProc("sec", /proc/n_sec)
|
||||
interpreter.SetProc("todegrees", /proc/n_toDegrees)
|
||||
interpreter.SetProc("toradians", /proc/n_toRadians)
|
||||
interpreter.SetProc("lerp", /proc/Lerp)
|
||||
interpreter.SetProc("max", /proc/n_max)
|
||||
interpreter.SetProc("min", /proc/n_min)
|
||||
|
||||
@@ -221,13 +221,13 @@ proc/n_abs(var/num)
|
||||
proc/n_floor(var/num)
|
||||
//writepanic("[__FILE__].[__LINE__] \\/proc/n_floor() called tick#: [world.time]")
|
||||
if(isnum(num))
|
||||
return round(num)
|
||||
return Floor(num)
|
||||
|
||||
// Round up
|
||||
proc/n_ceil(var/num)
|
||||
proc/n_ceiling(var/num)
|
||||
//writepanic("[__FILE__].[__LINE__] \\/proc/n_ceil() called tick#: [world.time]")
|
||||
if(isnum(num))
|
||||
return round(num)+1
|
||||
return Ceiling(num)
|
||||
|
||||
// Round to nearest integer
|
||||
proc/n_round(var/num)
|
||||
@@ -235,22 +235,61 @@ proc/n_round(var/num)
|
||||
if(isnum(num))
|
||||
if(num-round(num)<0.5)
|
||||
return round(num)
|
||||
return n_ceil(num)\
|
||||
return Ceiling(num)
|
||||
|
||||
// END OF BY DONKIE :(
|
||||
|
||||
/proc/n_sin(var/const/x)
|
||||
return sin(x)
|
||||
if(isnum(x))
|
||||
return sin(x)
|
||||
|
||||
/proc/n_cos(var/const/x)
|
||||
return cos(x)
|
||||
if(isnum(x))
|
||||
return cos(x)
|
||||
|
||||
/proc/n_tan(var/const/x)
|
||||
if(isnum(x))
|
||||
return Tan(x)
|
||||
|
||||
/proc/n_csc(var/const/x)
|
||||
if(isnum(x))
|
||||
return Csc(x)
|
||||
|
||||
/proc/n_cot(var/const/x)
|
||||
if(isnum(x))
|
||||
return Cot(x)
|
||||
|
||||
/proc/n_sec(var/const/x)
|
||||
if(isnum(x))
|
||||
return Sec(x)
|
||||
|
||||
/proc/n_asin(var/const/x)
|
||||
return arcsin(x)
|
||||
if(isnum(x))
|
||||
return arcsin(x)
|
||||
|
||||
/proc/n_acos(var/const/x)
|
||||
return arccos(x)
|
||||
if(isnum(x))
|
||||
return arccos(x)
|
||||
|
||||
/proc/n_isInRange(var/const/x, var/const/min, var/const/max)
|
||||
if(isnum(x) && isnum(min) && isnum(max))
|
||||
return IsInRange(x, min, max)
|
||||
|
||||
/proc/n_lcm(var/const/a, var/const/b)
|
||||
if(isnum(a) && isnum(b))
|
||||
return Lcm(a, b)
|
||||
|
||||
/proc/n_root(var/const/n, var/const/x)
|
||||
if(isnum(n) && isnum(x))
|
||||
return Root(n, x)
|
||||
|
||||
/proc/n_toDegrees(var/const/x)
|
||||
if(isnum(x))
|
||||
return ToDegrees(x)
|
||||
|
||||
/proc/n_toRadians(var/const/x)
|
||||
if(isnum(x))
|
||||
return ToRadians(x)
|
||||
|
||||
/proc/n_max(...)
|
||||
return max(arglist(args))
|
||||
|
||||
Reference in New Issue
Block a user