Disposals for mining, final blood_DNA stuff, cleaned up more code, fixed some scattered bugs, added 50% chance to end up in deep space.

This commit is contained in:
SkyMarshal
2012-02-29 13:48:16 -07:00
parent 66f38fb34b
commit 4524a2ff10
21 changed files with 4979 additions and 4880 deletions

View File

@@ -35,25 +35,6 @@
interpreter.persist = 1
interpreter.Compiler= src
// Set up all the preprocessor bullshit
//TCS_Setup(program)
// Apply preprocessor global variables
program.SetVar("PI" , 3.141592653) // value of pi
program.SetVar("E" , 2.718281828) // value of e
program.SetVar("SQURT2" , 1.414213562) // value of the square root of 2
program.SetVar("FALSE" , 0) // boolean shortcut to 0
program.SetVar("TRUE" , 1) // boolean shortcut to 1
program.SetVar("NORTH" , NORTH) // NORTH (1)
program.SetVar("SOUTH" , SOUTH) // SOUTH (2)
program.SetVar("EAST" , EAST) // EAST (4)
program.SetVar("WEST" , WEST) // WEST (8)
program.SetVar("HONK" , "clown griff u")
program.SetVar("CODERS" , "hide the fun")
program.SetVar("GRIFF" , pick("HALP IM BEING GRIFFED", "HALP AI IS MALF", "HALP GRIFFE", "HALP TRAITORS", "HALP WIZ GRIEFE ME"))
return returnerrors
/* -- Execute the compiled code -- */
@@ -63,6 +44,32 @@
if(!ready)
return
if(!interpreter)
return
interpreter.SetVar("PI" , 3.141592653) // value of pi
interpreter.SetVar("E" , 2.718281828) // value of e
interpreter.SetVar("SQURT2" , 1.414213562) // value of the square root of 2
interpreter.SetVar("FALSE" , 0) // boolean shortcut to 0
interpreter.SetVar("TRUE" , 1) // boolean shortcut to 1
interpreter.SetVar("NORTH" , NORTH) // NORTH (1)
interpreter.SetVar("SOUTH" , SOUTH) // SOUTH (2)
interpreter.SetVar("EAST" , EAST) // EAST (4)
interpreter.SetVar("WEST" , WEST) // WEST (8)
// Channel macros
interpreter.SetVar("$common", 1459)
interpreter.SetVar("$science", 1351)
interpreter.SetVar("$command", 1353)
interpreter.SetVar("$medical", 1355)
interpreter.SetVar("$engineering",1357)
interpreter.SetVar("$security", 1359)
interpreter.SetVar("$mining", 1349)
interpreter.SetVar("$cargo", 1347)
// Signal data
interpreter.SetVar("$content", signal.data["message"])
interpreter.SetVar("$freq" , signal.frequency)
interpreter.SetVar("$source" , signal.data["name"])
@@ -154,25 +161,24 @@
interpreter.Run()
// Backwards-apply variables onto signal data
/* html_encode() EVERYTHING. fucking players can't be trusted with SHIT */
/* sanitize EVERYTHING. fucking players can't be trusted with SHIT */
signal.data["message"] = html_encode(interpreter.GetVar("$content"))
signal.data["message"] = trim(copytext(sanitize(interpreter.GetVar("$content")), 1, MAX_MESSAGE_LEN))
signal.frequency = interpreter.GetVar("$freq")
var/setname = ""
var/obj/machinery/telecomms/server/S = signal.data["server"]
if(interpreter.GetVar("$source") in S.stored_names)
setname = html_encode(interpreter.GetVar("$source"))
setname = interpreter.GetVar("$source")
else
setname = "<i>[html_encode(interpreter.GetVar("$source"))]</i>"
setname = "<i>[trim(copytext(sanitize(interpreter.GetVar("$source")), 1, MAX_MESSAGE_LEN))]</i>"
if(signal.data["name"] != setname)
signal.data["realname"] = setname
signal.data["name"] = setname
signal.data["job"] = html_encode(interpreter.GetVar("$job"))
signal.data["job"] = trim(copytext(sanitize(interpreter.GetVar("$job")), 1, MAX_MESSAGE_LEN))
signal.data["reject"] = !(interpreter.GetVar("$pass")) // set reject to the opposite of $pass
/* -- Actual language proc code -- */
datum/signal
@@ -203,6 +209,9 @@ datum/signal
hradio = new // sets the hradio as a radio intercom
if(!freq)
freq = 1459
if(findtext(num2text(freq), ".")) // if the frequency has been set as a decimal
freq *= 10 // shift the decimal one place
if(!job)
job = "None"
@@ -233,4 +242,4 @@ datum/signal
newsign.data["vmessage"] = H.voice_message
newsign.data["vname"] = H.voice_name
newsign.data["vmask"] = 0
S.relay_information(newsign, "/obj/machinery/telecomms/broadcaster") // send this simple message to broadcasters
S.relay_information(newsign, "/obj/machinery/telecomms/broadcaster") // send this simple message to broadcasters

View File

@@ -120,4 +120,4 @@
/proc/smartlength(var/container)
if(container)
if(istype(container, /list) || istext(container))
return length(container)
return length(container)

View File

@@ -32,6 +32,7 @@
returnVal
max_iterations=100 // max iterations without any kind of delay
cur_iterations=0 // current iteration
max_recursion=50 // max recursions without returning anything (or completing the code block)
cur_recursion=0 // current amount of recursion
/*
@@ -211,9 +212,14 @@
*/
RunWhile(node/statement/WhileLoop/stmt)
var/i=1
if(!cur_iterations)
cur_iterations = 1
while(Eval(stmt.cond) && Iterate(stmt.block, i++))
cur_iterations++
continue
status &= ~BREAKING
cur_iterations -= i
if(cur_iterations <= 0) cur_iterations = 0
/*
Proc:Iterate
@@ -221,7 +227,7 @@
*/
Iterate(node/BlockDefinition/block, count)
RunBlock(block)
if(max_iterations > 0 && count >= max_iterations)
if(max_iterations > 0 && (count >= max_iterations || cur_iterations + 1 >= max_iterations))
RaiseError(new/runtimeError/IterationLimitReached())
return 0
if(status & (BREAKING|RETURNING))
@@ -288,4 +294,3 @@
else if(!istype(value) && isobject(value)) value = new/node/expression/value/reference(value)
//TODO: check for invalid name
S.variables["[name]"] = value