Refactors most spans into span procs (#59645)

Converts most spans into span procs. Mostly used regex for this and sorted out any compile time errors afterwards so there could be some bugs.
Was initially going to do defines, but ninja said to make it into a proc, and if there's any overhead, they can easily be changed to defines.

Makes it easier to control the formatting and prevents typos when creating spans as it'll runtime if you misspell instead of silently failing.
Reduces the code you need to write when writing spans, as you don't need to close the span as that's automatically handled by the proc.

(Note from Lemon: This should be converted to defines once we update the minimum version to 514. Didn't do it now because byond pain and such)
This commit is contained in:
Watermelon914
2021-06-14 21:03:53 +01:00
committed by GitHub
parent b9982f6970
commit 375a20e49b
1676 changed files with 15455 additions and 15226 deletions
@@ -10,11 +10,11 @@
return ..()
/datum/buildmode_mode/varedit/show_help(client/c)
to_chat(c, "<span class='notice'>***********************************************************</span>")
to_chat(c, "<span class='notice'>Right Mouse Button on buildmode button = Select var(type) & value</span>")
to_chat(c, "<span class='notice'>Left Mouse Button on turf/obj/mob = Set var(type) & value</span>")
to_chat(c, "<span class='notice'>Right Mouse Button on turf/obj/mob = Reset var's value</span>")
to_chat(c, "<span class='notice'>***********************************************************</span>")
to_chat(c, span_notice("***********************************************************"))
to_chat(c, span_notice("Right Mouse Button on buildmode button = Select var(type) & value"))
to_chat(c, span_notice("Left Mouse Button on turf/obj/mob = Set var(type) & value"))
to_chat(c, span_notice("Right Mouse Button on turf/obj/mob = Reset var's value"))
to_chat(c, span_notice("***********************************************************"))
/datum/buildmode_mode/varedit/Reset()
. = ..()
@@ -23,14 +23,14 @@
/datum/buildmode_mode/varedit/change_settings(client/c)
varholder = input(c, "Enter variable name:" ,"Name", "name")
if(!vv_varname_lockcheck(varholder))
return
var/temp_value = c.vv_get_value()
if(isnull(temp_value["class"]))
Reset()
to_chat(c, "<span class='notice'>Variable unset.</span>")
to_chat(c, span_notice("Variable unset."))
return
valueholder = temp_value["value"]
@@ -38,23 +38,23 @@
var/list/modifiers = params2list(params)
if(isnull(varholder))
to_chat(c, "<span class='warning'>Choose a variable to modify first.</span>")
to_chat(c, span_warning("Choose a variable to modify first."))
return
if(LAZYACCESS(modifiers, LEFT_CLICK))
if(object.vars.Find(varholder))
if(object.vv_edit_var(varholder, valueholder) == FALSE)
to_chat(c, "<span class='warning'>Your edit was rejected by the object.</span>")
to_chat(c, span_warning("Your edit was rejected by the object."))
return
log_admin("Build Mode: [key_name(c)] modified [object.name]'s [varholder] to [valueholder]")
else
to_chat(c, "<span class='warning'>[initial(object.name)] does not have a var called '[varholder]'</span>")
to_chat(c, span_warning("[initial(object.name)] does not have a var called '[varholder]'"))
if(LAZYACCESS(modifiers, RIGHT_CLICK))
if(object.vars.Find(varholder))
var/reset_value = initial(object.vars[varholder])
if(object.vv_edit_var(varholder, reset_value) == FALSE)
to_chat(c, "<span class='warning'>Your edit was rejected by the object.</span>")
to_chat(c, span_warning("Your edit was rejected by the object."))
return
log_admin("Build Mode: [key_name(c)] modified [object.name]'s [varholder] to [reset_value]")
else
to_chat(c, "<span class='warning'>[initial(object.name)] does not have a var called '[varholder]'</span>")
to_chat(c, span_warning("[initial(object.name)] does not have a var called '[varholder]'"))