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 13:03:53 -07:00
committed by GitHub
parent b9982f6970
commit 375a20e49b
1676 changed files with 15455 additions and 15226 deletions
+3 -3
View File
@@ -34,7 +34,7 @@
CRASH("No help defined, yell at a coder")
/datum/buildmode_mode/proc/change_settings(client/c)
to_chat(c, "<span class='warning'>There is no configuration available for this mode</span>")
to_chat(c, span_warning("There is no configuration available for this mode"))
return
/datum/buildmode_mode/proc/Reset()
@@ -78,12 +78,12 @@
return
if(cornerA && !cornerB)
cornerB = select_tile(get_turf(object), AREASELECT_CORNERB)
to_chat(c, "<span class='boldwarning'>Region selected, if you're happy with your selection left click again, otherwise right click.</span>")
to_chat(c, span_boldwarning("Region selected, if you're happy with your selection left click again, otherwise right click."))
return
handle_selected_area(c, params)
deselect_region()
else
to_chat(c, "<span class='notice'>Region selection canceled!</span>")
to_chat(c, span_notice("Region selection canceled!"))
deselect_region()
return
+11 -11
View File
@@ -6,15 +6,15 @@
// of the currently selected path
/datum/buildmode_mode/advanced/show_help(client/c)
to_chat(c, "<span class='notice'>***********************************************************</span>")
to_chat(c, "<span class='notice'>Right Mouse Button on buildmode button = Set object type</span>")
to_chat(c, "<span class='notice'>Left Mouse Button + alt on turf/obj = Copy object type</span>")
to_chat(c, "<span class='notice'>Left Mouse Button on turf/obj = Place objects</span>")
to_chat(c, "<span class='notice'>Right Mouse Button = Delete objects</span>")
to_chat(c, span_notice("***********************************************************"))
to_chat(c, span_notice("Right Mouse Button on buildmode button = Set object type"))
to_chat(c, span_notice("Left Mouse Button + alt on turf/obj = Copy object type"))
to_chat(c, span_notice("Left Mouse Button on turf/obj = Place objects"))
to_chat(c, span_notice("Right Mouse Button = Delete objects"))
to_chat(c, "")
to_chat(c, "<span class='notice'>Use the button in the upper left corner to</span>")
to_chat(c, "<span class='notice'>change the direction of built objects.</span>")
to_chat(c, "<span class='notice'>***********************************************************</span>")
to_chat(c, span_notice("Use the button in the upper left corner to"))
to_chat(c, span_notice("change the direction of built objects."))
to_chat(c, span_notice("***********************************************************"))
/datum/buildmode_mode/advanced/change_settings(client/c)
var/target_path = input(c, "Enter typepath:", "Typepath", "/obj/structure/closet")
@@ -38,9 +38,9 @@
if(left_click && alt_click)
if (istype(object, /turf) || istype(object, /obj) || istype(object, /mob))
objholder = object.type
to_chat(c, "<span class='notice'>[initial(object.name)] ([object.type]) selected.</span>")
to_chat(c, span_notice("[initial(object.name)] ([object.type]) selected."))
else
to_chat(c, "<span class='notice'>[initial(object.name)] is not a turf, object, or mob! Please select again.</span>")
to_chat(c, span_notice("[initial(object.name)] is not a turf, object, or mob! Please select again."))
else if(left_click)
if(ispath(objholder,/turf))
var/turf/T = get_turf(object)
@@ -56,7 +56,7 @@
A.setDir(BM.build_dir)
log_admin("Build Mode: [key_name(c)] modified [A]'s [COORD(A)] dir to [BM.build_dir]")
else
to_chat(c, "<span class='warning'>Select object type first.</span>")
to_chat(c, span_warning("Select object type first."))
else if(right_click)
if(isobj(object))
log_admin("Build Mode: [key_name(c)] deleted [object] at [AREACOORD(object)]")
+6 -6
View File
@@ -22,12 +22,12 @@
return ..()
/datum/buildmode_mode/area_edit/show_help(client/c)
to_chat(c, "<span class='notice'>***********************************************************</span>")
to_chat(c, "<span class='notice'>Left Mouse Button on obj/turf/mob = Select corner</span>")
to_chat(c, span_notice("***********************************************************"))
to_chat(c, span_notice("Left Mouse Button on obj/turf/mob = Select corner"))
to_chat(c, "<span class='notice'>Left Mouse Button + Alt on turf/obj/mob = Paint area/span>")
to_chat(c, "<span class='notice'>Right Mouse Button on obj/turf/mob = Select area to paint</span>")
to_chat(c, "<span class='notice'>Right Mouse Button on buildmode button = Create new area</span>")
to_chat(c, "<span class='notice'>***********************************************************</span>")
to_chat(c, span_notice("Right Mouse Button on obj/turf/mob = Select area to paint"))
to_chat(c, span_notice("Right Mouse Button on buildmode button = Create new area"))
to_chat(c, span_notice("***********************************************************"))
/datum/buildmode_mode/area_edit/change_settings(client/c)
var/target_path = input(c, "Enter typepath:", "Typepath", "/area")
@@ -49,7 +49,7 @@
if(LAZYACCESS(modifiers, LEFT_CLICK))
if(!storedarea)
to_chat(c, "<span class='warning'>Configure or select the area you want to paint first!</span>")
to_chat(c, span_warning("Configure or select the area you want to paint first!"))
return
if(LAZYACCESS(modifiers, ALT_CLICK))
var/turf/T = get_turf(object)
+8 -8
View File
@@ -2,15 +2,15 @@
key = "basic"
/datum/buildmode_mode/basic/show_help(client/c)
to_chat(c, "<span class='notice'>***********************************************************</span>")
to_chat(c, "<span class='notice'>Left Mouse Button = Construct / Upgrade</span>")
to_chat(c, "<span class='notice'>Right Mouse Button = Deconstruct / Delete / Downgrade</span>")
to_chat(c, "<span class='notice'>Left Mouse Button + ctrl = R-Window</span>")
to_chat(c, "<span class='notice'>Left Mouse Button + alt = Airlock</span>")
to_chat(c, span_notice("***********************************************************"))
to_chat(c, span_notice("Left Mouse Button = Construct / Upgrade"))
to_chat(c, span_notice("Right Mouse Button = Deconstruct / Delete / Downgrade"))
to_chat(c, span_notice("Left Mouse Button + ctrl = R-Window"))
to_chat(c, span_notice("Left Mouse Button + alt = Airlock"))
to_chat(c, "")
to_chat(c, "<span class='notice'>Use the button in the upper left corner to</span>")
to_chat(c, "<span class='notice'>change the direction of built objects.</span>")
to_chat(c, "<span class='notice'>***********************************************************</span>")
to_chat(c, span_notice("Use the button in the upper left corner to"))
to_chat(c, span_notice("change the direction of built objects."))
to_chat(c, span_notice("***********************************************************"))
/datum/buildmode_mode/basic/handle_click(client/c, params, obj/object)
var/list/modifiers = params2list(params)
+4 -4
View File
@@ -8,10 +8,10 @@
var/flames = -1
/datum/buildmode_mode/boom/show_help(client/c)
to_chat(c, "<span class='notice'>***********************************************************</span>")
to_chat(c, "<span class='notice'>Mouse Button on obj = Kaboom</span>")
to_chat(c, "<span class='notice'>NOTE: Using the \"Config/Launch Supplypod\" verb allows you to do this in an IC way (i.e., making a cruise missile come down from the sky and explode wherever you click!)</span>")
to_chat(c, "<span class='notice'>***********************************************************</span>")
to_chat(c, span_notice("***********************************************************"))
to_chat(c, span_notice("Mouse Button on obj = Kaboom"))
to_chat(c, span_notice("NOTE: Using the \"Config/Launch Supplypod\" verb allows you to do this in an IC way (i.e., making a cruise missile come down from the sky and explode wherever you click!)"))
to_chat(c, span_notice("***********************************************************"))
/datum/buildmode_mode/boom/change_settings(client/c)
devastation = input(c, "Range of total devastation. -1 to none", text("Input")) as num|null
+5 -5
View File
@@ -7,10 +7,10 @@
return ..()
/datum/buildmode_mode/copy/show_help(client/c)
to_chat(c, "<span class='notice'>***********************************************************</span>")
to_chat(c, "<span class='notice'>Left Mouse Button on obj/turf/mob = Spawn a Copy of selected target</span>")
to_chat(c, "<span class='notice'>Right Mouse Button on obj/mob = Select target to copy</span>")
to_chat(c, "<span class='notice'>***********************************************************</span>")
to_chat(c, span_notice("***********************************************************"))
to_chat(c, span_notice("Left Mouse Button on obj/turf/mob = Spawn a Copy of selected target"))
to_chat(c, span_notice("Right Mouse Button on obj/mob = Select target to copy"))
to_chat(c, span_notice("***********************************************************"))
/datum/buildmode_mode/copy/handle_click(client/c, params, obj/object)
var/list/modifiers = params2list(params)
@@ -22,5 +22,5 @@
log_admin("Build Mode: [key_name(c)] copied [stored] to [AREACOORD(object)]")
else if(LAZYACCESS(modifiers, RIGHT_CLICK))
if(ismovable(object)) // No copying turfs for now.
to_chat(c, "<span class='notice'>[object] set as template.</span>")
to_chat(c, span_notice("[object] set as template."))
stored = object
+2 -2
View File
@@ -45,7 +45,7 @@
to_chat(usr, "No instances of this type exist")
return
log_admin("[key_name(usr)] deleted all instances of type [O_type] ([i] instances deleted) ")
message_admins("<span class='notice'>[key_name(usr)] deleted all instances of type [O_type] ([i] instances deleted) </span>")
message_admins(span_notice("[key_name(usr)] deleted all instances of type [O_type] ([i] instances deleted) "))
if("Type and subtypes")
var/i = 0
for(var/Obj in world)
@@ -57,4 +57,4 @@
to_chat(usr, "No instances of this type exist")
return
log_admin("[key_name(usr)] deleted all instances of type or subtype of [O_type] ([i] instances deleted) ")
message_admins("<span class='notice'>[key_name(usr)] deleted all instances of type or subtype of [O_type] ([i] instances deleted) </span>")
message_admins(span_notice("[key_name(usr)] deleted all instances of type or subtype of [O_type] ([i] instances deleted) "))
+6 -6
View File
@@ -7,11 +7,11 @@
var/atom/objholder = null
/datum/buildmode_mode/fill/show_help(client/c)
to_chat(c, "<span class='notice'>***********************************************************</span>")
to_chat(c, "<span class='notice'>Left Mouse Button on turf/obj/mob = Select corner</span>")
to_chat(c, "<span class='notice'>Left Mouse Button + Alt on turf/obj/mob = Delete region</span>")
to_chat(c, "<span class='notice'>Right Mouse Button on buildmode button = Select object type</span>")
to_chat(c, "<span class='notice'>***********************************************************</span>")
to_chat(c, span_notice("***********************************************************"))
to_chat(c, span_notice("Left Mouse Button on turf/obj/mob = Select corner"))
to_chat(c, span_notice("Left Mouse Button + Alt on turf/obj/mob = Delete region"))
to_chat(c, span_notice("Right Mouse Button on buildmode button = Select object type"))
to_chat(c, span_notice("***********************************************************"))
/datum/buildmode_mode/fill/change_settings(client/c)
var/target_path = input(c, "Enter typepath:" ,"Typepath","/obj/structure/closet")
@@ -29,7 +29,7 @@
/datum/buildmode_mode/fill/handle_click(client/c, params, obj/object)
if(isnull(objholder))
to_chat(c, "<span class='warning'>Select an object type first.</span>")
to_chat(c, span_warning("Select an object type first."))
deselect_region()
return
..()
+6 -6
View File
@@ -5,10 +5,10 @@
var/generator_path
/datum/buildmode_mode/mapgen/show_help(client/c)
to_chat(c, "<span class='notice'>***********************************************************</span>")
to_chat(c, "<span class='notice'>Left Mouse Button on turf/obj/mob = Select corner</span>")
to_chat(c, "<span class='notice'>Right Mouse Button on buildmode button = Select generator</span>")
to_chat(c, "<span class='notice'>***********************************************************</span>")
to_chat(c, span_notice("***********************************************************"))
to_chat(c, span_notice("Left Mouse Button on turf/obj/mob = Select corner"))
to_chat(c, span_notice("Right Mouse Button on buildmode button = Select generator"))
to_chat(c, span_notice("***********************************************************"))
/datum/buildmode_mode/mapgen/change_settings(client/c)
var/list/gen_paths = subtypesof(/datum/map_generator)
@@ -25,7 +25,7 @@
/datum/buildmode_mode/mapgen/handle_click(client/c, params, obj/object)
if(isnull(generator_path))
to_chat(c, "<span class='warning'>Select generator type first.</span>")
to_chat(c, span_warning("Select generator type first."))
deselect_region()
return
..()
@@ -37,7 +37,7 @@
var/datum/map_generator/G = new generator_path
if(istype(G, /datum/map_generator/repair/reload_station_map))
if(GLOB.reloading_map)
to_chat(c, "<span class='boldwarning'>You are already reloading an area! Please wait for it to fully finish loading before trying to load another!</span>")
to_chat(c, span_boldwarning("You are already reloading an area! Please wait for it to fully finish loading before trying to load another!"))
deselect_region()
return
G.defineRegion(cornerA, cornerB, 1)
+1 -1
View File
@@ -29,7 +29,7 @@
if(LAZYACCESS(modifiers, LEFT_CLICK))
if(isnull(dressuptime))
to_chat(c, "<span class='warning'>Pick an outfit first.</span>")
to_chat(c, span_warning("Pick an outfit first."))
return
for (var/item in dollie.get_equipped_items(TRUE))
+1 -1
View File
@@ -34,7 +34,7 @@
return
if (selected_smite == null)
to_chat(user, "<span class='notice'>No smite selected.</span>")
to_chat(user, span_notice("No smite selected."))
return
selected_smite.effect(user, object)
+6 -6
View File
@@ -1,17 +1,17 @@
/datum/buildmode_mode/throwing
key = "throw"
var/atom/movable/throw_atom = null
/datum/buildmode_mode/throwing/Destroy()
throw_atom = null
return ..()
/datum/buildmode_mode/throwing/show_help(client/c)
to_chat(c, "<span class='notice'>***********************************************************</span>")
to_chat(c, "<span class='notice'>Left Mouse Button on turf/obj/mob = Select</span>")
to_chat(c, "<span class='notice'>Right Mouse Button on turf/obj/mob = Throw</span>")
to_chat(c, "<span class='notice'>***********************************************************</span>")
to_chat(c, span_notice("***********************************************************"))
to_chat(c, span_notice("Left Mouse Button on turf/obj/mob = Select"))
to_chat(c, span_notice("Right Mouse Button on turf/obj/mob = Throw"))
to_chat(c, span_notice("***********************************************************"))
/datum/buildmode_mode/throwing/handle_click(client/c, params, obj/object)
var/list/modifiers = params2list(params)
@@ -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]'"))