Updates SDQL2 to the latest TG version and adds variable protection. (#17997)

* SDQL2 update

* fix that verb

* cl

* fix that

* toworld

* this is pointless

* update info

* siiiiick..

* vv edit update

* fix that

* fix editing vars

* fix VV

* discord protection

---------

Co-authored-by: Matt Atlas <liermattia@gmail.com>
This commit is contained in:
Matt Atlas
2023-12-25 17:10:35 +00:00
committed by GitHub
co-authored by Matt Atlas
parent af318acfc1
commit 12487c94bb
53 changed files with 2014 additions and 1042 deletions
+67 -21
View File
@@ -1,10 +1,3 @@
var/list/forbidden_varedit_object_types = list(
/datum/admins, //Admins editing their own admin-power object? Yup, sounds like a good idea.
/datum/controller/subsystem/statistics, //Prevents people messing with feedback gathering
/datum/controller/subsystem/discord, //Nope.jpg
/datum/feedback_variable //Prevents people messing with feedback gathering
)
var/list/VVlocked = list("vars", "holder", "client", "virus", "viruses", "cuffed", "last_eaten", "unlock_content", "bound_x", "bound_y", "step_x", "step_y", "force_ending")
var/list/VVicon_edit_lock = list("icon", "icon_state", "overlays", "underlays")
var/list/VVckey_edit = list("key", "ckey")
@@ -406,15 +399,14 @@ var/list/VVdynamic_lock = list(
/client/proc/modify_variables(var/atom/O, var/param_var_name = null, var/autodetect_class = 0)
if(!check_rights(R_VAREDIT|R_DEV)) return
for(var/p in forbidden_varedit_object_types)
if( istype(O,p) )
to_chat(usr, "<span class='danger'>It is forbidden to edit this object's variables.</span>")
return
if(istype(O, /client) && (param_var_name == "ckey" || param_var_name == "key"))
to_chat(usr, "<span class='danger'>You cannot edit ckeys on client objects.</span>")
return
if(!O.vv_edit_var(param_var_name))
to_chat(src, SPAN_WARNING("You cannot edit this variable."))
return
var/class
var/variable
var/var_value
@@ -485,7 +477,8 @@ var/list/VVdynamic_lock = list(
names = sortList(names)
variable = input("Which var?","Var") as null|anything in names
if(!variable) return
if(!variable)
return
var_value = O.vars[variable]
if(variable in VVlocked)
@@ -596,17 +589,35 @@ var/list/VVdynamic_lock = list(
if("text")
var/var_new = input("Enter new text:","Text",O.vars[variable]) as null|text
if(var_new==null) return
if(var_new==null)
return
if(!O.vv_edit_var(variable, var_new))
to_chat(usr, SPAN_WARNING("You cannot edit this variable."))
return
O.vars[variable] = var_new
if("num")
if(variable=="light_range")
var/var_new = input("Enter new number:","Num",O.vars[variable]) as null|num
if(var_new == null) return
if(var_new == null)
return
if(!O.vv_edit_var(variable, var_new))
to_chat(usr, SPAN_WARNING("You cannot edit this variable."))
return
O.set_light(var_new)
else if(variable=="stat")
var/var_new = input("Enter new number:","Num",O.vars[variable]) as null|num
if(var_new == null) return
if(var_new == null)
return
if(!O.vv_edit_var(variable, var_new))
to_chat(usr, SPAN_WARNING("You cannot edit this variable."))
return
if((O.vars[variable] == 2) && (var_new < 2))//Bringing the dead back to life
dead_mob_list -= O
living_mob_list += O
@@ -616,7 +627,13 @@ var/list/VVdynamic_lock = list(
O.vars[variable] = var_new
else
var/var_new = input("Enter new number:","Num",O.vars[variable]) as null|num
if(var_new==null) return
if(var_new==null)
return
if(!O.vv_edit_var(variable, var_new))
to_chat(usr, SPAN_WARNING("You cannot edit this variable."))
return
O.vars[variable] = var_new
if("type")
@@ -641,27 +658,56 @@ var/list/VVdynamic_lock = list(
else
var_new = input("Select an atom type", "Spawn Atom", matches[1]) as null|anything in matches
if(var_new==null) return
if(var_new==null)
return
if(!O.vv_edit_var(variable, var_new))
to_chat(usr, SPAN_WARNING("You cannot edit this variable."))
return
O.vars[variable] = var_new
if("reference")
var/var_new = input("Select reference:","Reference",O.vars[variable]) as null|mob|obj|turf|area in world
if(var_new==null) return
if(var_new==null)
return
if(!O.vv_edit_var(variable, var_new))
to_chat(usr, SPAN_WARNING("You cannot edit this variable."))
return
O.vars[variable] = var_new
if("mob reference")
var/var_new = input("Select reference:","Reference",O.vars[variable]) as null|mob in world
if(var_new==null) return
if(!O.vv_edit_var(variable, var_new))
to_chat(usr, SPAN_WARNING("You cannot edit this variable."))
return
O.vars[variable] = var_new
if("file")
var/var_new = input("Pick file:","File",O.vars[variable]) as null|file
if(var_new==null) return
if(var_new==null)
return
if(!O.vv_edit_var(variable, var_new))
to_chat(usr, SPAN_WARNING("You cannot edit this variable."))
return
O.vars[variable] = var_new
if("icon")
var/var_new = input("Pick icon:","Icon",O.vars[variable]) as null|icon
if(var_new==null) return
if(var_new==null)
return
if(!O.vv_edit_var(variable, var_new))
to_chat(usr, SPAN_WARNING("You cannot edit this variable."))
return
O.vars[variable] = var_new
if("marked datum")