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
+13 -13
View File
@@ -46,20 +46,20 @@
if(!I.tool_start_check(user, amount=2))
return
to_chat(user, "<span class='notice'>You begin repairing [src].</span>")
to_chat(user, span_notice("You begin repairing [src]."))
if(I.use_tool(src, user, 40, volume=50, amount=2))
obj_integrity = max_integrity
update_appearance()
to_chat(user, "<span class='notice'>You repair [src].</span>")
to_chat(user, span_notice("You repair [src]."))
else
to_chat(user, "<span class='warning'>[src] is already in good condition!</span>")
to_chat(user, span_warning("[src] is already in good condition!"))
return
else if(istype(I, /obj/item/stack/sheet/glass) && broken)
var/obj/item/stack/sheet/glass/G = I
if(G.get_amount() < 2)
to_chat(user, "<span class='warning'>You need two glass sheets to fix [src]!</span>")
to_chat(user, span_warning("You need two glass sheets to fix [src]!"))
return
to_chat(user, "<span class='notice'>You start fixing [src]...</span>")
to_chat(user, span_notice("You start fixing [src]..."))
if(do_after(user, 20, target = src) && G.use(2))
broken = FALSE
obj_integrity = max_integrity
@@ -68,12 +68,12 @@
if(istype(I, /obj/item/fireaxe) && !fireaxe)
var/obj/item/fireaxe/F = I
if(F?.wielded)
to_chat(user, "<span class='warning'>Unwield the [F.name] first.</span>")
to_chat(user, span_warning("Unwield the [F.name] first."))
return
if(!user.transferItemToLoc(F, src))
return
fireaxe = F
to_chat(user, "<span class='notice'>You place the [F.name] back in the [name].</span>")
to_chat(user, span_notice("You place the [F.name] back in the [name]."))
update_appearance()
return
else if(!broken)
@@ -129,12 +129,12 @@
if(fireaxe)
user.put_in_hands(fireaxe)
fireaxe = null
to_chat(user, "<span class='notice'>You take the fire axe from the [name].</span>")
to_chat(user, span_notice("You take the fire axe from the [name]."))
src.add_fingerprint(user)
update_appearance()
return
if(locked)
to_chat(user, "<span class='warning'>The [name] won't budge!</span>")
to_chat(user, span_warning("The [name] won't budge!"))
return
else
open = !open
@@ -152,7 +152,7 @@
/obj/structure/fireaxecabinet/attack_tk(mob/user)
. = COMPONENT_CANCEL_ATTACK_CHAIN
if(locked)
to_chat(user, "<span class='warning'>The [name] won't budge!</span>")
to_chat(user, span_warning("The [name] won't budge!"))
return
open = !open
update_appearance()
@@ -182,10 +182,10 @@
. += locked ? "locked" : "unlocked"
/obj/structure/fireaxecabinet/proc/toggle_lock(mob/user)
to_chat(user, "<span class='notice'>Resetting circuitry...</span>")
to_chat(user, span_notice("Resetting circuitry..."))
playsound(src, 'sound/machines/locktoggle.ogg', 50, TRUE)
if(do_after(user, 20, target = src))
to_chat(user, "<span class='notice'>You [locked ? "disable" : "re-enable"] the locking modules.</span>")
to_chat(user, span_notice("You [locked ? "disable" : "re-enable"] the locking modules."))
locked = !locked
update_appearance()
@@ -195,7 +195,7 @@
set src in oview(1)
if(locked)
to_chat(usr, "<span class='warning'>The [name] won't budge!</span>")
to_chat(usr, span_warning("The [name] won't budge!"))
return
else
open = !open