diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 58f0716907e..0ca52c34999 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -2094,3 +2094,22 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new) output["CONTENT"] = content return output + + +/proc/is_maintainer(mob/user) + #ifdef TESTING // Account for local test mode + return TRUE + #endif + + // Check if this user is a maint, or on a test server + var/ip_check = (user.client.address == "127.0.0.1" || user.client.address == null) + + var/rank_check = FALSE + + if(user.client.holder) + rank_check = (findtext(user.client.holder.rank, "Maintainer") > 0) // Accounts for "Maintainers", "Maintainer", "Host & Maintainer", etc + + if(ip_check || rank_check) + return TRUE + + return FALSE diff --git a/code/modules/admin/verbs/massmodvar.dm b/code/modules/admin/verbs/massmodvar.dm index 80101f3edcf..a283f6c945b 100644 --- a/code/modules/admin/verbs/massmodvar.dm +++ b/code/modules/admin/verbs/massmodvar.dm @@ -7,6 +7,10 @@ if(!check_rights(R_VAREDIT)) return + // Make sure we can actually edit this var + if(!vv_varname_lockcheck(var_name)) + return FALSE + if(A && A.type) if(typesof(A.type)) switch(input("Strict object type detection?") as null|anything in list("Strictly this type","This type and subtypes", "Cancel")) diff --git a/code/modules/admin/verbs/modifyvariables.dm b/code/modules/admin/verbs/modifyvariables.dm index 799aed71436..1f1c8ecc34e 100644 --- a/code/modules/admin/verbs/modifyvariables.dm +++ b/code/modules/admin/verbs/modifyvariables.dm @@ -1,7 +1,17 @@ -GLOBAL_LIST_INIT(VVlocked, list("vars", "var_edited", "client", "firemut", "ishulk", "telekinesis", "xray", "ka", "virus", "viruses", "cuffed", "last_eaten", "unlock_content")) // R_DEBUG +GLOBAL_LIST_INIT(VVlocked, list("client", "firemut", "ishulk", "telekinesis", "xray", "ka", "virus", "viruses", "cuffed", "last_eaten", "unlock_content")) // R_DEBUG GLOBAL_LIST_INIT(VVicon_edit_lock, list("icon", "icon_state", "overlays", "underlays", "resize")) // R_EVENT | R_DEBUG GLOBAL_LIST_INIT(VVckey_edit, list("key", "ckey")) // R_EVENT | R_DEBUG GLOBAL_LIST_INIT(VVpixelmovement, list("step_x", "step_y", "step_size", "bound_height", "bound_width", "bound_x", "bound_y")) // R_DEBUG + warning +// Stuff that can break the server in weird ways and shouldnt be messed with unless you actually know what you are doing +GLOBAL_LIST_INIT(VVmaint_only, list("vars", "var_edited", "contents")) + +// Protect ALL these +GLOBAL_PROTECT(VVlocked) +GLOBAL_PROTECT(VVicon_edit_lock) +GLOBAL_PROTECT(VVckey_edit) +GLOBAL_PROTECT(VVpixelmovement) +GLOBAL_PROTECT(VVmaint_only) + /client/proc/vv_get_class(var_value) if(isnull(var_value)) . = VV_NULL @@ -532,6 +542,11 @@ GLOBAL_LIST_INIT(VVpixelmovement, list("step_x", "step_y", "step_size", "bound_h var/prompt = alert(usr, "Editing this var may irreparably break tile gliding for the rest of the round. THIS CAN'T BE UNDONE", "DANGER", "ABORT ", "Continue", " ABORT") if(prompt != "Continue") return FALSE + if(param_var_name in GLOB.VVmaint_only) + if(!is_maintainer(usr)) + alert(usr, "Editing this variable is restricted to Maintainers only.", "Error", "Ok") + return FALSE + return TRUE /client/proc/modify_variables(atom/O, param_var_name = null, autodetect_class = 0)