mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 02:34:00 +00:00
Fixes for NTSL. NTSL now has a fixed statement-processing cap: scripts will crash when more than 1000 statements are called, and alert admins (scripts over 1000 statements are assumed to be buggy or malicious).
You can now properly sleep without waking up every half a second. Work on footprints. There are now different kinds of footprints, and different blood makes different colored prints. Animals leave pawprints, humans leave footprints, aliens leave big claw prints. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3242 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -265,6 +265,9 @@ var
|
|||||||
if (R.client && R.client.STFU_radio) //Adminning with 80 people on can be fun when you're trying to talk and all you can hear is radios.
|
if (R.client && R.client.STFU_radio) //Adminning with 80 people on can be fun when you're trying to talk and all you can hear is radios.
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if(istype(M, /mob/new_player)) // we don't want new players to hear messages. rare but generates runtimes.
|
||||||
|
continue
|
||||||
|
|
||||||
|
|
||||||
// --- Check for compression ---
|
// --- Check for compression ---
|
||||||
if(compression > 0)
|
if(compression > 0)
|
||||||
|
|||||||
@@ -58,10 +58,12 @@
|
|||||||
for(var/datum/comm_log_entry/C in SelectedServer.log_entries)
|
for(var/datum/comm_log_entry/C in SelectedServer.log_entries)
|
||||||
i++
|
i++
|
||||||
|
|
||||||
dat += "<li><font color = #008F00>[C.name]</font color> <font color = #FF0000><a href='?src=\ref[src];delete=[i]'>\[X\]</a></font color><br>"
|
|
||||||
|
|
||||||
// If the log is a speech file
|
// If the log is a speech file
|
||||||
if(C.input_type == "Speech File")
|
if(C.input_type == "Speech File")
|
||||||
|
|
||||||
|
dat += "<li><font color = #008F00>[C.name]</font color> <font color = #FF0000><a href='?src=\ref[src];delete=[i]'>\[X\]</a></font color><br>"
|
||||||
|
|
||||||
// -- Determine race of orator --
|
// -- Determine race of orator --
|
||||||
|
|
||||||
var/race // The actual race of the mob
|
var/race // The actual race of the mob
|
||||||
@@ -113,9 +115,10 @@
|
|||||||
dat += "</li><br>"
|
dat += "</li><br>"
|
||||||
|
|
||||||
else if(C.input_type == "Execution Error")
|
else if(C.input_type == "Execution Error")
|
||||||
dat += "<u><font color = #18743E>Data type</font color></u>: [C.input_type]<br>"
|
|
||||||
dat += "<u><font color = #18743E>Source</font color></u>: Internal server code<br>"
|
dat += "<li><font color = #990000>[C.name]</font color> <font color = #FF0000><a href='?src=\ref[src];delete=[i]'>\[X\]</a></font color><br>"
|
||||||
dat += "<u><font color = #18743E>Contents</font color></u>: \"[C.parameters["message"]]\"<br>"
|
dat += "<u><font color = #787700>Output</font color></u>: \"[C.parameters["message"]]\"<br>"
|
||||||
|
dat += "</li><br>"
|
||||||
|
|
||||||
|
|
||||||
dat += "</ol>"
|
dat += "</ol>"
|
||||||
|
|||||||
@@ -403,7 +403,9 @@
|
|||||||
log.parameters["message"] = signal.data["message"]
|
log.parameters["message"] = signal.data["message"]
|
||||||
log.parameters["name"] = signal.data["name"]
|
log.parameters["name"] = signal.data["name"]
|
||||||
log.parameters["realname"] = signal.data["realname"]
|
log.parameters["realname"] = signal.data["realname"]
|
||||||
log.parameters["uspeech"] = M.universal_speak
|
|
||||||
|
if(!istype(M, /mob/new_player))
|
||||||
|
log.parameters["uspeech"] = M.universal_speak
|
||||||
|
|
||||||
// If the signal is still compressed, make the log entry gibberish
|
// If the signal is still compressed, make the log entry gibberish
|
||||||
if(signal.data["compression"] > 0)
|
if(signal.data["compression"] > 0)
|
||||||
@@ -453,9 +455,12 @@
|
|||||||
proc/add_entry(var/content, var/input)
|
proc/add_entry(var/content, var/input)
|
||||||
var/datum/comm_log_entry/log = new
|
var/datum/comm_log_entry/log = new
|
||||||
var/identifier = num2text( rand(-1000,1000) + world.time )
|
var/identifier = num2text( rand(-1000,1000) + world.time )
|
||||||
log.name = "data packet ([md5(identifier)])"
|
log.name = "[input] ([md5(identifier)])"
|
||||||
log.input_type = input
|
log.input_type = input
|
||||||
log.parameters["message"] = content
|
log.parameters["message"] = content
|
||||||
|
log_entries.Add(log)
|
||||||
|
update_logs()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
screen = 0 // the screen number:
|
screen = 0 // the screen number:
|
||||||
list/servers = list() // the servers located by the computer
|
list/servers = list() // the servers located by the computer
|
||||||
mob/editingcode
|
mob/editingcode
|
||||||
|
mob/lasteditor
|
||||||
list/viewingcode = list()
|
list/viewingcode = list()
|
||||||
obj/machinery/telecomms/server/SelectedServer
|
obj/machinery/telecomms/server/SelectedServer
|
||||||
|
|
||||||
@@ -49,13 +50,12 @@
|
|||||||
showcode = dd_replacetext(storedcode, "\"", "\\\"")
|
showcode = dd_replacetext(storedcode, "\"", "\\\"")
|
||||||
|
|
||||||
for(var/mob/M in viewingcode)
|
for(var/mob/M in viewingcode)
|
||||||
if(M.machine == src && M in view(1, src))
|
if( (M.machine == src && M in view(1, src) ) || issilicon(M))
|
||||||
winset(M, "tcscode", "is-disabled=true")
|
winset(M, "tcscode", "is-disabled=true")
|
||||||
winset(M, "tcscode", "text=\"[showcode]\"")
|
winset(M, "tcscode", "text=\"[showcode]\"")
|
||||||
else
|
else
|
||||||
if(!issilicon(M))
|
viewingcode.Remove(M)
|
||||||
viewingcode.Remove(M)
|
winshow(M, "Telecomms IDE", 0) // hide the window!
|
||||||
winshow(M, "Telecomms IDE", 0) // hide the window!
|
|
||||||
|
|
||||||
sleep(5)
|
sleep(5)
|
||||||
|
|
||||||
@@ -164,6 +164,7 @@
|
|||||||
if(usr in viewingcode) return
|
if(usr in viewingcode) return
|
||||||
|
|
||||||
if(!editingcode)
|
if(!editingcode)
|
||||||
|
lasteditor = usr
|
||||||
editingcode = usr
|
editingcode = usr
|
||||||
winshow(editingcode, "Telecomms IDE", 1) // show the IDE
|
winshow(editingcode, "Telecomms IDE", 1) // show the IDE
|
||||||
winset(editingcode, "tcscode", "is-disabled=false")
|
winset(editingcode, "tcscode", "is-disabled=false")
|
||||||
|
|||||||
@@ -710,63 +710,89 @@ obj/machinery/computer/forensic_scanning
|
|||||||
obj/item/clothing/shoes/var
|
obj/item/clothing/shoes/var
|
||||||
track_blood = 0
|
track_blood = 0
|
||||||
mob/living/carbon/human/track_blood_mob
|
mob/living/carbon/human/track_blood_mob
|
||||||
|
track_blood_type
|
||||||
mob/var
|
mob/var
|
||||||
bloody_hands = 0
|
bloody_hands = 0
|
||||||
mob/living/carbon/human/bloody_hands_mob
|
mob/living/carbon/human/bloody_hands_mob
|
||||||
track_blood
|
track_blood
|
||||||
mob/living/carbon/human/track_blood_mob
|
mob/living/carbon/human/track_blood_mob
|
||||||
|
track_blood_type
|
||||||
obj/item/clothing/gloves/var
|
obj/item/clothing/gloves/var
|
||||||
transfer_blood = 0
|
transfer_blood = 0
|
||||||
mob/living/carbon/human/bloody_hands_mob
|
mob/living/carbon/human/bloody_hands_mob
|
||||||
|
|
||||||
|
|
||||||
obj/effect/decal/cleanable/blood/var
|
obj/effect/decal/cleanable/var
|
||||||
track_amt = 2
|
track_amt = 3
|
||||||
mob/blood_owner
|
mob/blood_owner
|
||||||
|
|
||||||
turf/Exited(mob/living/carbon/human/M)
|
turf/Exited(mob/living/carbon/human/M)
|
||||||
if(istype(M,/mob/living) && !istype(M,/mob/living/carbon/metroid))
|
if(istype(M,/mob/living) && !istype(M,/mob/living/carbon/metroid))
|
||||||
if(!istype(src, /turf/space)) // Bloody tracks code starts here
|
var/dofoot = 1
|
||||||
if(M.track_blood > 0)
|
if(istype(M,/mob/living/simple_animal))
|
||||||
M.track_blood--
|
if(!(istype(M,/mob/living/simple_animal/cat) || istype(M,/mob/living/simple_animal/corgi) || istype(M,/mob/living/simple_animal/constructwraith)))
|
||||||
src.add_bloody_footprints(M.track_blood_mob,1,M.dir,get_tracks(M))
|
dofoot = 0
|
||||||
else if(istype(M,/mob/living/carbon/human))
|
|
||||||
if(M.shoes)
|
if(dofoot)
|
||||||
if(M.shoes.track_blood > 0)
|
|
||||||
M.shoes.track_blood--
|
if(!istype(src, /turf/space)) // Bloody tracks code starts here
|
||||||
src.add_bloody_footprints(M.shoes.track_blood_mob,1,M.dir,M.shoes.name) // And bloody tracks end here
|
if(M.track_blood > 0)
|
||||||
|
M.track_blood--
|
||||||
|
src.add_bloody_footprints(M.track_blood_mob,1,M.dir,get_tracks(M),M.track_blood_type)
|
||||||
|
else if(istype(M,/mob/living/carbon/human))
|
||||||
|
if(M.shoes)
|
||||||
|
if(M.shoes.track_blood > 0)
|
||||||
|
M.shoes.track_blood--
|
||||||
|
src.add_bloody_footprints(M.shoes.track_blood_mob,1,M.dir,M.shoes.name,M.shoes.track_blood_type) // And bloody tracks end here
|
||||||
. = ..()
|
. = ..()
|
||||||
turf/Entered(mob/living/carbon/human/M)
|
turf/Entered(mob/living/carbon/human/M)
|
||||||
if(istype(M,/mob/living) && !istype(M,/mob/living/carbon/metroid))
|
if(istype(M,/mob/living) && !istype(M,/mob/living/carbon/metroid))
|
||||||
if(M.track_blood > 0)
|
var/dofoot = 1
|
||||||
M.track_blood--
|
if(istype(M,/mob/living/simple_animal))
|
||||||
src.add_bloody_footprints(M.track_blood_mob,0,M.dir,get_tracks(M))
|
if(!(istype(M,/mob/living/simple_animal/cat) || istype(M,/mob/living/simple_animal/corgi) || istype(M,/mob/living/simple_animal/constructwraith)))
|
||||||
else if(istype(M,/mob/living/carbon/human))
|
dofoot = 0
|
||||||
if(M.shoes && !istype(src,/turf/space))
|
|
||||||
if(M.shoes.track_blood > 0)
|
if(dofoot)
|
||||||
M.shoes.track_blood--
|
|
||||||
src.add_bloody_footprints(M.shoes.track_blood_mob,0,M.dir,M.shoes.name)
|
if(M.track_blood > 0)
|
||||||
|
M.track_blood--
|
||||||
|
src.add_bloody_footprints(M.track_blood_mob,0,M.dir,get_tracks(M),M.track_blood_type)
|
||||||
|
else if(istype(M,/mob/living/carbon/human))
|
||||||
|
if(M.shoes && !istype(src,/turf/space))
|
||||||
|
if(M.shoes.track_blood > 0)
|
||||||
|
M.shoes.track_blood--
|
||||||
|
src.add_bloody_footprints(M.shoes.track_blood_mob,0,M.dir,M.shoes.name,M.shoes.track_blood_type)
|
||||||
|
|
||||||
|
|
||||||
for(var/obj/effect/decal/cleanable/blood/B in src)
|
for(var/obj/effect/decal/cleanable/B in src)
|
||||||
if(B.track_amt <= 0) continue
|
if(B:track_amt <= 0) continue
|
||||||
if(B.type != /obj/effect/decal/cleanable/blood/tracks)
|
if(B.type != /obj/effect/decal/cleanable/blood/tracks)
|
||||||
if(istype(M,/mob/living/carbon/human))
|
if(istype(B, /obj/effect/decal/cleanable/xenoblood) || istype(B, /obj/effect/decal/cleanable/blood) || istype(B, /obj/effect/decal/cleanable/oil) || istype(B, /obj/effect/decal/cleanable/robot_debris))
|
||||||
if(M.shoes)
|
|
||||||
M.shoes.add_blood(B.blood_owner)
|
var/track_type = "blood"
|
||||||
M.shoes.track_blood_mob = B.blood_owner
|
if(istype(B, /obj/effect/decal/cleanable/xenoblood))
|
||||||
M.shoes.track_blood = max(M.shoes.track_blood,8)
|
track_type = "xeno"
|
||||||
else
|
else if(istype(B, /obj/effect/decal/cleanable/oil) || istype(B, /obj/effect/decal/cleanable/robot_debris))
|
||||||
M.add_blood(B.blood_owner)
|
track_type = "oil"
|
||||||
M.track_blood_mob = B.blood_owner
|
|
||||||
M.track_blood = max(M.track_blood,rand(4,8))
|
if(istype(M,/mob/living/carbon/human))
|
||||||
B.track_amt--
|
if(M.shoes)
|
||||||
break
|
M.shoes.add_blood(B.blood_owner)
|
||||||
|
M.shoes.track_blood_mob = B.blood_owner
|
||||||
|
M.shoes.track_blood = max(M.shoes.track_blood,8)
|
||||||
|
M.shoes.track_blood_type = track_type
|
||||||
|
else
|
||||||
|
M.add_blood(B.blood_owner)
|
||||||
|
M.track_blood_mob = B.blood_owner
|
||||||
|
M.track_blood = max(M.track_blood,rand(4,8))
|
||||||
|
M.track_blood_type = track_type
|
||||||
|
B.track_amt--
|
||||||
|
break
|
||||||
. = ..()
|
. = ..()
|
||||||
|
|
||||||
turf/proc/add_bloody_footprints(mob/living/carbon/human/M,leaving,d,info)
|
turf/proc/add_bloody_footprints(mob/living/carbon/human/M,leaving,d,info,bloodcolor)
|
||||||
for(var/obj/effect/decal/cleanable/blood/tracks/T in src)
|
for(var/obj/effect/decal/cleanable/blood/tracks/T in src)
|
||||||
if(T.dir == d)
|
if(T.dir == d && findtext(T.icon, bloodcolor))
|
||||||
if((leaving && T.icon_state == "steps2") || (!leaving && T.icon_state == "steps1"))
|
if((leaving && T.icon_state == "steps2") || (!leaving && T.icon_state == "steps1"))
|
||||||
T.desc = "These bloody footprints appear to have been made by [info]."
|
T.desc = "These bloody footprints appear to have been made by [info]."
|
||||||
if(T.blood_DNA)
|
if(T.blood_DNA)
|
||||||
@@ -780,12 +806,29 @@ turf/proc/add_bloody_footprints(mob/living/carbon/human/M,leaving,d,info)
|
|||||||
return
|
return
|
||||||
var/obj/effect/decal/cleanable/blood/tracks/this = new(src)
|
var/obj/effect/decal/cleanable/blood/tracks/this = new(src)
|
||||||
this.icon = 'footprints.dmi'
|
this.icon = 'footprints.dmi'
|
||||||
|
|
||||||
|
var/preiconstate = ""
|
||||||
|
|
||||||
|
if(info == "animal paws")
|
||||||
|
preiconstate = "paw"
|
||||||
|
else if(info == "alien claws")
|
||||||
|
preiconstate = "claw"
|
||||||
|
else if(info == "small alien feet")
|
||||||
|
preiconstate = "paw"
|
||||||
|
|
||||||
if(leaving)
|
if(leaving)
|
||||||
this.icon_state = "blood2"
|
this.icon_state = "[bloodcolor][preiconstate]2"
|
||||||
else
|
else
|
||||||
this.icon_state = "blood1"
|
this.icon_state = "[bloodcolor][preiconstate]1"
|
||||||
this.dir = d
|
this.dir = d
|
||||||
this.desc = "These bloody footprints appear to have been made by [info]."
|
|
||||||
|
if(bloodcolor == "blood")
|
||||||
|
this.desc = "These bloody footprints appear to have been made by [info]."
|
||||||
|
else if(bloodcolor == "xeno")
|
||||||
|
this.desc = "These acidic bloody footprints appear to have been made by [info]."
|
||||||
|
else if(bloodcolor == "oil")
|
||||||
|
this.desc = "These oil footprints appear to have been made by [info]."
|
||||||
|
|
||||||
if(istype(M,/mob/living/carbon/human))
|
if(istype(M,/mob/living/carbon/human))
|
||||||
if(this.blood_DNA.len)
|
if(this.blood_DNA.len)
|
||||||
this.blood_DNA.len++
|
this.blood_DNA.len++
|
||||||
@@ -797,12 +840,14 @@ proc/get_tracks(mob/M)
|
|||||||
if(istype(M,/mob/living))
|
if(istype(M,/mob/living))
|
||||||
if(istype(M,/mob/living/carbon/human))
|
if(istype(M,/mob/living/carbon/human))
|
||||||
. = "human feet"
|
. = "human feet"
|
||||||
else if(istype(M,/mob/living/carbon/monkey))
|
else if(istype(M,/mob/living/carbon/monkey) || istype(M,/mob/living/simple_animal/cat) || istype(M,/mob/living/simple_animal/corgi) || istype(M,/mob/living/simple_animal/crab))
|
||||||
. = "monkey paws"
|
. = "animal paws"
|
||||||
else if(istype(M,/mob/living/silicon/robot))
|
else if(istype(M,/mob/living/silicon/robot))
|
||||||
. = "robot feet"
|
. = "robot feet"
|
||||||
else if(istype(M,/mob/living/carbon/alien))
|
else if(istype(M,/mob/living/carbon/alien/humanoid))
|
||||||
. = "alien claws"
|
. = "alien claws"
|
||||||
|
else if(istype(M,/mob/living/carbon/alien/larva))
|
||||||
|
. = "small alien feet"
|
||||||
else
|
else
|
||||||
. = "an unknown creature"
|
. = "an unknown creature"
|
||||||
|
|
||||||
|
|||||||
@@ -728,7 +728,8 @@
|
|||||||
lying = 1
|
lying = 1
|
||||||
stat = 0
|
stat = 0
|
||||||
if (paralysis > 0)
|
if (paralysis > 0)
|
||||||
handle_dreams()
|
if(sleeping > 0)
|
||||||
|
handle_dreams()
|
||||||
AdjustParalysis(-1)
|
AdjustParalysis(-1)
|
||||||
blinded = 1
|
blinded = 1
|
||||||
lying = 1
|
lying = 1
|
||||||
|
|||||||
@@ -121,4 +121,8 @@
|
|||||||
|
|
||||||
DivisionByZero
|
DivisionByZero
|
||||||
name="DivideByZeroError"
|
name="DivideByZeroError"
|
||||||
message="Division by zero attempted."
|
message="Division by zero attempted."
|
||||||
|
|
||||||
|
MaxCPU
|
||||||
|
name="MaxComputationalUse"
|
||||||
|
message="Maximum amount of computational cycles reached (>= 1000)."
|
||||||
@@ -47,6 +47,8 @@
|
|||||||
if(!interpreter)
|
if(!interpreter)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
interpreter.container = src
|
||||||
|
|
||||||
interpreter.SetVar("PI" , 3.141592653) // value of pi
|
interpreter.SetVar("PI" , 3.141592653) // value of pi
|
||||||
interpreter.SetVar("E" , 2.718281828) // value of e
|
interpreter.SetVar("E" , 2.718281828) // value of e
|
||||||
interpreter.SetVar("SQURT2" , 1.414213562) // value of the square root of 2
|
interpreter.SetVar("SQURT2" , 1.414213562) // value of the square root of 2
|
||||||
@@ -137,7 +139,7 @@
|
|||||||
@param container: the list or container to measure
|
@param container: the list or container to measure
|
||||||
|
|
||||||
*/
|
*/
|
||||||
interpreter.SetProc("length", /proc/smartfind)
|
interpreter.SetProc("length", /proc/smartlength)
|
||||||
|
|
||||||
/* -- Clone functions, carried from default BYOND procs --- */
|
/* -- Clone functions, carried from default BYOND procs --- */
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,8 @@
|
|||||||
*/
|
*/
|
||||||
Run()
|
Run()
|
||||||
cur_recursion = 0 // reset recursion
|
cur_recursion = 0 // reset recursion
|
||||||
|
cur_statements = 0 // reset CPU tracking
|
||||||
|
alertadmins = 0
|
||||||
|
|
||||||
ASSERT(src.program)
|
ASSERT(src.program)
|
||||||
RunBlock(src.program)
|
RunBlock(src.program)
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
stack
|
stack
|
||||||
scopes = new()
|
scopes = new()
|
||||||
functions = new()
|
functions = new()
|
||||||
|
|
||||||
|
datum/container // associated container for interpeter
|
||||||
/*
|
/*
|
||||||
Var: status
|
Var: status
|
||||||
A variable indicating that the rest of the current block should be skipped. This may be set to any combination of <Status Macros>.
|
A variable indicating that the rest of the current block should be skipped. This may be set to any combination of <Status Macros>.
|
||||||
@@ -31,10 +33,12 @@
|
|||||||
status=0
|
status=0
|
||||||
returnVal
|
returnVal
|
||||||
|
|
||||||
max_iterations=100 // max iterations without any kind of delay
|
max_statements=1000 // maximum amount of statements that can be called in one execution. this is to prevent massive crashes and exploitation
|
||||||
cur_iterations=0 // current iteration
|
cur_statements=0 // current amount of statements called
|
||||||
max_recursion=50 // max recursions without returning anything (or completing the code block)
|
alertadmins=0 // set to 1 if the admins shouldn't be notified of anymore issues
|
||||||
cur_recursion=0 // current amount of recursion
|
max_iterations=100 // max number of uninterrupted loops possible
|
||||||
|
max_recursion=50 // max recursions without returning anything (or completing the code block)
|
||||||
|
cur_recursion=0 // current amount of recursion
|
||||||
/*
|
/*
|
||||||
Var: persist
|
Var: persist
|
||||||
If 0, global variables will be reset after Run() finishes.
|
If 0, global variables will be reset after Run() finishes.
|
||||||
@@ -88,56 +92,74 @@
|
|||||||
CreateGlobalScope()
|
CreateGlobalScope()
|
||||||
curScope = globalScope
|
curScope = globalScope
|
||||||
|
|
||||||
for(var/node/statement/S in Block.statements)
|
if(cur_statements < max_statements)
|
||||||
while(paused) sleep(10)
|
|
||||||
if(istype(S, /node/statement/VariableAssignment))
|
for(var/node/statement/S in Block.statements)
|
||||||
var/node/statement/VariableAssignment/stmt = S
|
while(paused) sleep(10)
|
||||||
var/name = stmt.var_name.id_name
|
|
||||||
if(!stmt.object)
|
cur_statements++
|
||||||
// Below we assign the variable first to null if it doesn't already exist.
|
if(cur_statements >= max_statements)
|
||||||
// This is necessary for assignments like +=, and when the variable is used in a function
|
RaiseError(new/runtimeError/MaxCPU())
|
||||||
// If the variable already exists in a different block, then AssignVariable will automatically use that one.
|
|
||||||
if(!IsVariableAccessible(name))
|
if(container && !alertadmins)
|
||||||
AssignVariable(name, null)
|
if(istype(container, /datum/TCS_Compiler))
|
||||||
AssignVariable(name, Eval(stmt.value))
|
var/datum/TCS_Compiler/Compiler = container
|
||||||
|
var/obj/machinery/telecomms/server/Holder = Compiler.Holder
|
||||||
|
var/message = "Potential crash-inducing NTSL script detected at telecommunications server [Compiler.Holder] ([Holder.x], [Holder.y], [Holder.z])."
|
||||||
|
|
||||||
|
alertadmins = 1
|
||||||
|
message_admins(message, 1)
|
||||||
|
break
|
||||||
|
|
||||||
|
if(istype(S, /node/statement/VariableAssignment))
|
||||||
|
var/node/statement/VariableAssignment/stmt = S
|
||||||
|
var/name = stmt.var_name.id_name
|
||||||
|
if(!stmt.object)
|
||||||
|
// Below we assign the variable first to null if it doesn't already exist.
|
||||||
|
// This is necessary for assignments like +=, and when the variable is used in a function
|
||||||
|
// If the variable already exists in a different block, then AssignVariable will automatically use that one.
|
||||||
|
if(!IsVariableAccessible(name))
|
||||||
|
AssignVariable(name, null)
|
||||||
|
AssignVariable(name, Eval(stmt.value))
|
||||||
|
else
|
||||||
|
var/datum/D = Eval(GetVariable(stmt.object.id_name))
|
||||||
|
if(!D) return
|
||||||
|
D.vars[stmt.var_name.id_name] = Eval(stmt.value)
|
||||||
|
else if(istype(S, /node/statement/VariableDeclaration))
|
||||||
|
//VariableDeclaration nodes are used to forcibly declare a local variable so that one in a higher scope isn't used by default.
|
||||||
|
var/node/statement/VariableDeclaration/dec=S
|
||||||
|
if(!dec.object)
|
||||||
|
AssignVariable(dec.var_name.id_name, null, curScope)
|
||||||
|
else
|
||||||
|
var/datum/D = Eval(GetVariable(dec.object.id_name))
|
||||||
|
if(!D) return
|
||||||
|
D.vars[dec.var_name.id_name] = null
|
||||||
|
else if(istype(S, /node/statement/FunctionCall))
|
||||||
|
RunFunction(S)
|
||||||
|
else if(istype(S, /node/statement/FunctionDefinition))
|
||||||
|
//do nothing
|
||||||
|
else if(istype(S, /node/statement/WhileLoop))
|
||||||
|
RunWhile(S)
|
||||||
|
else if(istype(S, /node/statement/IfStatement))
|
||||||
|
RunIf(S)
|
||||||
|
else if(istype(S, /node/statement/ReturnStatement))
|
||||||
|
if(!curFunction)
|
||||||
|
RaiseError(new/runtimeError/UnexpectedReturn())
|
||||||
|
continue
|
||||||
|
status |= RETURNING
|
||||||
|
returnVal=Eval(S:value)
|
||||||
|
break
|
||||||
|
else if(istype(S, /node/statement/BreakStatement))
|
||||||
|
status |= BREAKING
|
||||||
|
break
|
||||||
|
else if(istype(S, /node/statement/ContinueStatement))
|
||||||
|
status |= CONTINUING
|
||||||
|
break
|
||||||
else
|
else
|
||||||
var/datum/D = Eval(GetVariable(stmt.object.id_name))
|
RaiseError(new/runtimeError/UnknownInstruction())
|
||||||
if(!D) return
|
if(status)
|
||||||
D.vars[stmt.var_name.id_name] = Eval(stmt.value)
|
break
|
||||||
else if(istype(S, /node/statement/VariableDeclaration))
|
|
||||||
//VariableDeclaration nodes are used to forcibly declare a local variable so that one in a higher scope isn't used by default.
|
|
||||||
var/node/statement/VariableDeclaration/dec=S
|
|
||||||
if(!dec.object)
|
|
||||||
AssignVariable(dec.var_name.id_name, null, curScope)
|
|
||||||
else
|
|
||||||
var/datum/D = Eval(GetVariable(dec.object.id_name))
|
|
||||||
if(!D) return
|
|
||||||
D.vars[dec.var_name.id_name] = null
|
|
||||||
else if(istype(S, /node/statement/FunctionCall))
|
|
||||||
RunFunction(S)
|
|
||||||
else if(istype(S, /node/statement/FunctionDefinition))
|
|
||||||
//do nothing
|
|
||||||
else if(istype(S, /node/statement/WhileLoop))
|
|
||||||
RunWhile(S)
|
|
||||||
else if(istype(S, /node/statement/IfStatement))
|
|
||||||
RunIf(S)
|
|
||||||
else if(istype(S, /node/statement/ReturnStatement))
|
|
||||||
if(!curFunction)
|
|
||||||
RaiseError(new/runtimeError/UnexpectedReturn())
|
|
||||||
continue
|
|
||||||
status |= RETURNING
|
|
||||||
returnVal=Eval(S:value)
|
|
||||||
break
|
|
||||||
else if(istype(S, /node/statement/BreakStatement))
|
|
||||||
status |= BREAKING
|
|
||||||
break
|
|
||||||
else if(istype(S, /node/statement/ContinueStatement))
|
|
||||||
status |= CONTINUING
|
|
||||||
break
|
|
||||||
else
|
|
||||||
RaiseError(new/runtimeError/UnknownInstruction())
|
|
||||||
if(status)
|
|
||||||
break
|
|
||||||
curScope = scopes.Pop()
|
curScope = scopes.Pop()
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -212,14 +234,9 @@
|
|||||||
*/
|
*/
|
||||||
RunWhile(node/statement/WhileLoop/stmt)
|
RunWhile(node/statement/WhileLoop/stmt)
|
||||||
var/i=1
|
var/i=1
|
||||||
if(!cur_iterations)
|
|
||||||
cur_iterations = 1
|
|
||||||
while(Eval(stmt.cond) && Iterate(stmt.block, i++))
|
while(Eval(stmt.cond) && Iterate(stmt.block, i++))
|
||||||
cur_iterations++
|
|
||||||
continue
|
continue
|
||||||
status &= ~BREAKING
|
status &= ~BREAKING
|
||||||
cur_iterations -= i
|
|
||||||
if(cur_iterations <= 0) cur_iterations = 0
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Proc:Iterate
|
Proc:Iterate
|
||||||
@@ -227,7 +244,7 @@
|
|||||||
*/
|
*/
|
||||||
Iterate(node/BlockDefinition/block, count)
|
Iterate(node/BlockDefinition/block, count)
|
||||||
RunBlock(block)
|
RunBlock(block)
|
||||||
if(max_iterations > 0 && (count >= max_iterations || cur_iterations + 1 >= max_iterations))
|
if(max_iterations > 0 && count >= max_iterations)
|
||||||
RaiseError(new/runtimeError/IterationLimitReached())
|
RaiseError(new/runtimeError/IterationLimitReached())
|
||||||
return 0
|
return 0
|
||||||
if(status & (BREAKING|RETURNING))
|
if(status & (BREAKING|RETURNING))
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 742 B After Width: | Height: | Size: 2.3 KiB |
Reference in New Issue
Block a user