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
@@ -39,14 +39,14 @@
/obj/structure/plaque/wrench_act(mob/living/user, obj/item/wrench/I)
. = ..()
user.visible_message("<span class='notice'>[user] starts removing [src]...</span>", \
"<span class='notice'>You start unfastening [src].</span>")
user.visible_message(span_notice("[user] starts removing [src]..."), \
span_notice("You start unfastening [src]."))
I.play_tool_sound(src)
if(!I.use_tool(src, user, 4 SECONDS))
return TRUE
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
user.visible_message("<span class='notice'>[user] unfastens [src].</span>", \
"<span class='notice'>You unfasten [src].</span>")
user.visible_message(span_notice("[user] unfastens [src]."), \
span_notice("You unfasten [src]."))
var/obj/item/plaque/unwrenched_plaque = new (get_turf(user))
if(engraved) //If it's still just a basic unengraved plaque, we can (and should) skip some of the below variable transfers.
unwrenched_plaque.name = name //Copy over the plaque structure variables to the plaque item we're creating when we unwrench it.
@@ -63,16 +63,16 @@
if(user.combat_mode)
return FALSE
if(obj_integrity == max_integrity)
to_chat(user, "<span class='warning'>This plaque is already in perfect condition.</span>")
to_chat(user, span_warning("This plaque is already in perfect condition."))
return TRUE
if(!I.tool_start_check(user, amount=0))
return TRUE
user.visible_message("<span class='notice'>[user] starts repairing [src]...</span>", \
"<span class='notice'>You start repairing [src].</span>")
user.visible_message(span_notice("[user] starts repairing [src]..."), \
span_notice("You start repairing [src]."))
if(!I.use_tool(src, user, 4 SECONDS, volume = 50))
return TRUE
user.visible_message("<span class='notice'>[user] finishes repairing [src].</span>", \
"<span class='notice'>You finish repairing [src].</span>")
user.visible_message(span_notice("[user] finishes repairing [src]."), \
span_notice("You finish repairing [src]."))
obj_integrity = max_integrity
return TRUE
@@ -81,23 +81,23 @@
if(user.combat_mode)
return FALSE
if(obj_integrity == max_integrity)
to_chat(user, "<span class='warning'>This plaque is already in perfect condition.</span>")
to_chat(user, span_warning("This plaque is already in perfect condition."))
return TRUE
if(!I.tool_start_check(user, amount=0))
return TRUE
user.visible_message("<span class='notice'>[user] starts repairing [src]...</span>", \
"<span class='notice'>You start repairing [src].</span>")
user.visible_message(span_notice("[user] starts repairing [src]..."), \
span_notice("You start repairing [src]."))
if(!I.use_tool(src, user, 4 SECONDS, volume = 50))
return TRUE
user.visible_message("<span class='notice'>[user] finishes repairing [src].</span>", \
"<span class='notice'>You finish repairing [src].</span>")
user.visible_message(span_notice("[user] finishes repairing [src]."), \
span_notice("You finish repairing [src]."))
obj_integrity = max_integrity
return TRUE
/obj/structure/plaque/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/pen/fountain))
if(engraved)
to_chat(user, "<span class='warning'>This plaque has already been engraved.</span>")
to_chat(user, span_warning("This plaque has already been engraved."))
return
var/namechoice = input(user, "Title this plaque. (e.g. 'Best HoP Award', 'Great Ashwalker War Memorial')", "Plaque Customization")
if(!namechoice)
@@ -106,30 +106,30 @@
if(!descriptionchoice)
return
if(!Adjacent(user)) //Make sure user is adjacent still
to_chat(user, "<span class='warning'>You need to stand next to the plaque to engrave it!</span>")
to_chat(user, span_warning("You need to stand next to the plaque to engrave it!"))
return
user.visible_message("<span class='notice'>[user] begins engraving [src].</span>", \
"<span class='notice'>You begin engraving [src].</span>")
user.visible_message(span_notice("[user] begins engraving [src]."), \
span_notice("You begin engraving [src]."))
if(!do_after(user, 4 SECONDS, target = src)) //This spits out a visible message that somebody is engraving a plaque, then has a delay.
return
name = "\improper [namechoice]" //We want improper here so examine doesn't get weird if somebody capitalizes the plaque title.
desc = "The plaque reads: '[descriptionchoice]'"
engraved = TRUE //The plaque now has a name, description, and can't be altered again.
user.visible_message("<span class='notice'>[user] engraves [src].</span>", \
"<span class='notice'>You engrave [src].</span>")
user.visible_message(span_notice("[user] engraves [src]."), \
span_notice("You engrave [src]."))
return
if(istype(I, /obj/item/pen))
if(engraved)
to_chat(user, "<span class='warning'>This plaque has already been engraved, and your pen isn't fancy enough to engrave it anyway! Find a fountain pen.</span>")
to_chat(user, span_warning("This plaque has already been engraved, and your pen isn't fancy enough to engrave it anyway! Find a fountain pen."))
return
to_chat(user, "<span class='warning'>Your pen isn't fancy enough to engrave this! Find a fountain pen.</span>") //Go steal the Curator's.
to_chat(user, span_warning("Your pen isn't fancy enough to engrave this! Find a fountain pen.")) //Go steal the Curator's.
return
return ..()
/obj/item/plaque/attackby(obj/item/I, mob/user, params) //Same as part of the above, except for the item in hand instead of the structure.
if(istype(I, /obj/item/pen/fountain))
if(engraved)
to_chat(user, "<span class='warning'>This plaque has already been engraved.</span>")
to_chat(user, span_warning("This plaque has already been engraved."))
return
var/namechoice = input(user, "Title this plaque. (e.g. 'Best HoP Award', 'Great Ashwalker War Memorial')", "Plaque Customization")
if(!namechoice)
@@ -138,23 +138,23 @@
if(!descriptionchoice)
return
if(!Adjacent(user)) //Make sure user is adjacent still
to_chat(user, "<span class='warning'>You need to stand next to the plaque to engrave it!</span>")
to_chat(user, span_warning("You need to stand next to the plaque to engrave it!"))
return
user.visible_message("<span class='notice'>[user] begins engraving [src].</span>", \
"<span class='notice'>You begin engraving [src].</span>")
user.visible_message(span_notice("[user] begins engraving [src]."), \
span_notice("You begin engraving [src]."))
if(!do_after(user, 40, target = src)) //This spits out a visible message that somebody is engraving a plaque, then has a delay.
return
name = "\improper [namechoice]" //We want improper here so examine doesn't get weird if somebody capitalizes the plaque title.
desc = "The plaque reads: '[descriptionchoice]'"
engraved = TRUE //The plaque now has a name, description, and can't be altered again.
user.visible_message("<span class='notice'>[user] engraves [src].</span>", \
"<span class='notice'>You engrave [src].</span>")
user.visible_message(span_notice("[user] engraves [src]."), \
span_notice("You engrave [src]."))
return
if(istype(I, /obj/item/pen))
if(engraved)
to_chat(user, "<span class='warning'>This plaque has already been engraved, and your pen isn't fancy enough to engrave it anyway! Find a fountain pen.</span>")
to_chat(user, span_warning("This plaque has already been engraved, and your pen isn't fancy enough to engrave it anyway! Find a fountain pen."))
return
to_chat(user, "<span class='warning'>Your pen isn't fancy enough to engrave this! Find a fountain pen.</span>") //Go steal the Curator's.
to_chat(user, span_warning("Your pen isn't fancy enough to engrave this! Find a fountain pen.")) //Go steal the Curator's.
return
return ..()
@@ -175,8 +175,8 @@
placed_plaque.pixel_x = 32
else if(dir & WEST)
placed_plaque.pixel_x = -32
user.visible_message("<span class='notice'>[user] fastens [src] to [target_turf].</span>", \
"<span class='notice'>You attach [src] to [target_turf].</span>")
user.visible_message(span_notice("[user] fastens [src] to [target_turf]."), \
span_notice("You attach [src] to [target_turf]."))
playsound(target_turf, 'sound/items/deconstruct.ogg', 50, TRUE)
if(engraved)
placed_plaque.name = name