mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-13 09:05:11 +01:00
Updates/fixes to NTSL
- Fixed NTSL division - Added new NTSL math functions - Added changelog information
This commit is contained in:
@@ -190,6 +190,11 @@
|
||||
interpreter.SetProc("randseed", /proc/n_randseed)
|
||||
interpreter.SetProc("min", /proc/n_min)
|
||||
interpreter.SetProc("max", /proc/n_max)
|
||||
interpreter.SetProc("sin", /proc/n_sin)
|
||||
interpreter.SetProc("cos", /proc/n_cos)
|
||||
interpreter.SetProc("asin", /proc/n_asin)
|
||||
interpreter.SetProc("acos", /proc/n_acos)
|
||||
interpreter.SetProc("log", /proc/n_log)
|
||||
|
||||
// Time
|
||||
interpreter.SetProc("time", /proc/n_time)
|
||||
|
||||
@@ -262,6 +262,31 @@
|
||||
if(isnum(num)&&isnum(min)&&isnum(max))
|
||||
return ((min <= num) && (num <= max))
|
||||
|
||||
// Returns the sine of num
|
||||
/proc/n_sin(var/num)
|
||||
if(isnum(num))
|
||||
return sin(num)
|
||||
|
||||
// Returns the cosine of num
|
||||
/proc/n_cos(var/num)
|
||||
if(isnum(num))
|
||||
return cos(num)
|
||||
|
||||
// Returns the arcsine of num
|
||||
/proc/n_asin(var/num)
|
||||
if(isnum(num)&&-1<=num&&num<=1)
|
||||
return arcsin(num)
|
||||
|
||||
// Returns the arccosine of num
|
||||
/proc/n_acos(var/num)
|
||||
if(isnum(num)&&-1<=num&&num<=1)
|
||||
return arccos(num)
|
||||
|
||||
// Returns the natural log of num
|
||||
/proc/n_log(var/num)
|
||||
if(isnum(num)&&0<num)
|
||||
return log(num)
|
||||
|
||||
// Replace text
|
||||
/proc/n_replace(text, find, replacement)
|
||||
if(istext(text) && istext(find) && istext(replacement))
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
else if(isobject(b) && !isobject(a))
|
||||
RaiseError(new/runtimeError/TypeMismatch("/", a, b))
|
||||
return null
|
||||
if(b==0)
|
||||
if(b==0 || b==null)
|
||||
RaiseError(new/runtimeError/DivisionByZero())
|
||||
return null
|
||||
return a/b
|
||||
@@ -166,4 +166,4 @@
|
||||
//Unary//
|
||||
Minus(a) return -a
|
||||
LogicalNot(a) return !a
|
||||
BitwiseNot(a) return ~a
|
||||
BitwiseNot(a) return ~a
|
||||
|
||||
@@ -118,13 +118,14 @@
|
||||
for(, src.codepos<=lentext(code), src.codepos++)
|
||||
|
||||
var/char=copytext(code, codepos, codepos+1)
|
||||
var/nextchar=copytext(code, codepos+1, codepos+2)
|
||||
if(char=="\n")
|
||||
line++
|
||||
linepos=codepos
|
||||
|
||||
if(ignore.Find(char))
|
||||
continue
|
||||
else if(char == "/")
|
||||
else if(char == "/" && (nextchar == "/" || nextchar == "*"))
|
||||
ReadComment()
|
||||
else if(end_stmt.Find(char))
|
||||
tokens+=new /token/end(char, line, COL)
|
||||
|
||||
Reference in New Issue
Block a user