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
+8 -8
View File
@@ -17,9 +17,9 @@
if(W.get_sharpness() && W.force > 0)
if(W.hitsound)
playsound(get_turf(src), W.hitsound, 100, FALSE, FALSE)
user.visible_message("<span class='notice'>[user] begins to cut down [src] with [W].</span>","<span class='notice'>You begin to cut down [src] with [W].</span>", "<span class='hear'>You hear the sound of sawing.</span>")
user.visible_message(span_notice("[user] begins to cut down [src] with [W]."),span_notice("You begin to cut down [src] with [W]."), span_hear("You hear the sound of sawing."))
if(do_after(user, 1000/W.force, target = src)) //5 seconds with 20 force, 8 seconds with a hatchet, 20 seconds with a shard.
user.visible_message("<span class='notice'>[user] fells [src] with the [W].</span>","<span class='notice'>You fell [src] with the [W].</span>", "<span class='hear'>You hear the sound of a tree falling.</span>")
user.visible_message(span_notice("[user] fells [src] with the [W]."),span_notice("You fell [src] with the [W]."), span_hear("You hear the sound of a tree falling."))
playsound(get_turf(src), 'sound/effects/meteorimpact.ogg', 100 , FALSE, FALSE)
user.log_message("cut down [src] at [AREACOORD(src)]", LOG_ATTACK)
for(var/i=1 to log_amount)
@@ -78,9 +78,9 @@
return
if(took_presents[user.ckey] && !unlimited)
to_chat(user, "<span class='warning'>There are no presents with your name on.</span>")
to_chat(user, span_warning("There are no presents with your name on."))
return
to_chat(user, "<span class='warning'>After a bit of rummaging, you locate a gift with your name on it!</span>")
to_chat(user, span_warning("After a bit of rummaging, you locate a gift with your name on it!"))
if(!unlimited)
took_presents[user.ckey] = TRUE
@@ -326,9 +326,9 @@
/obj/item/kirbyplants/attackby(obj/item/I, mob/living/user, params)
. = ..()
if(trimmable && HAS_TRAIT(user,TRAIT_BONSAI) && isturf(loc) && I.get_sharpness())
to_chat(user,"<span class='notice'>You start trimming [src].</span>")
to_chat(user,span_notice("You start trimming [src]."))
if(do_after(user,3 SECONDS,target=src))
to_chat(user,"<span class='notice'>You finish trimming [src].</span>")
to_chat(user,span_notice("You finish trimming [src]."))
change_visual()
/// Cycle basic plant visuals
@@ -415,9 +415,9 @@
return ..()
if(flags_1 & NODECONSTRUCT_1)
return ..()
to_chat(user, "<span class='notice'>You start mining...</span>")
to_chat(user, span_notice("You start mining..."))
if(W.use_tool(src, user, 40, volume=50))
to_chat(user, "<span class='notice'>You finish mining the rock.</span>")
to_chat(user, span_notice("You finish mining the rock."))
if(mineResult && mineAmount)
new mineResult(loc, mineAmount)
SSblackbox.record_feedback("tally", "pick_used_mining", 1, W.type)