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
+7 -7
View File
@@ -13,10 +13,10 @@
return
if(user.has_language(language))
to_chat(user, "<span class='boldwarning'>You start skimming through [src], but you already know [initial(language.name)].</span>")
to_chat(user, span_boldwarning("You start skimming through [src], but you already know [initial(language.name)]."))
return
to_chat(user, "<span class='boldannounce'>You start skimming through [src], and [flavour_text].</span>")
to_chat(user, span_boldannounce("You start skimming through [src], and [flavour_text]."))
user.grant_language(language, TRUE, TRUE, LANGUAGE_MIND)
use_charge(user)
@@ -31,11 +31,11 @@
playsound(loc, "punch", 25, TRUE, -1)
if(M.stat == DEAD)
M.visible_message("<span class='danger'>[user] smacks [M]'s lifeless corpse with [src].</span>", "<span class='userdanger'>[user] smacks your lifeless corpse with [src].</span>", "<span class='hear'>You hear smacking.</span>")
M.visible_message(span_danger("[user] smacks [M]'s lifeless corpse with [src]."), span_userdanger("[user] smacks your lifeless corpse with [src]."), span_hear("You hear smacking."))
else if(M.has_language(language))
M.visible_message("<span class='danger'>[user] beats [M] over the head with [src]!</span>", "<span class='userdanger'>[user] beats you over the head with [src]!</span>", "<span class='hear'>You hear smacking.</span>")
M.visible_message(span_danger("[user] beats [M] over the head with [src]!"), span_userdanger("[user] beats you over the head with [src]!"), span_hear("You hear smacking."))
else
M.visible_message("<span class='notice'>[user] teaches [M] by beating [M.p_them()] over the head with [src]!</span>", "<span class='boldnotice'>As [user] hits you with [src], [flavour_text].</span>", "<span class='hear'>You hear smacking.</span>")
M.visible_message(span_notice("[user] teaches [M] by beating [M.p_them()] over the head with [src]!"), span_boldnotice("As [user] hits you with [src], [flavour_text]."), span_hear("You hear smacking."))
M.grant_language(language, TRUE, TRUE, LANGUAGE_MIND)
use_charge(user)
@@ -43,7 +43,7 @@
charges--
if(!charges)
var/turf/T = get_turf(src)
T.visible_message("<span class='warning'>The cover and contents of [src] start shifting and changing!</span>")
T.visible_message(span_warning("The cover and contents of [src] start shifting and changing!"))
qdel(src)
var/obj/item/book/manual/random/book = new(T)
@@ -99,7 +99,7 @@
/obj/item/language_manual/dronespeak_manual/attack(mob/living/M, mob/living/user)
// If they are not drone or silicon, we don't want them to learn this language.
if(!(isdrone(M) || issilicon(M)))
M.visible_message("<span class='danger'>[user] beats [M] over the head with [src]!</span>", "<span class='userdanger'>[user] beats you over the head with [src]!</span>", "<span class='hear'>You hear smacking.</span>")
M.visible_message(span_danger("[user] beats [M] over the head with [src]!"), span_userdanger("[user] beats you over the head with [src]!"), span_hear("You hear smacking."))
return
return ..()