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
+10 -10
View File
@@ -60,29 +60,29 @@
/obj/structure/fence/attackby(obj/item/W, mob/user)
if(W.tool_behaviour == TOOL_WIRECUTTER)
if(!cuttable)
to_chat(user, "<span class='warning'>This section of the fence can't be cut!</span>")
to_chat(user, span_warning("This section of the fence can't be cut!"))
return
if(invulnerable)
to_chat(user, "<span class='warning'>This fence is too strong to cut through!</span>")
to_chat(user, span_warning("This fence is too strong to cut through!"))
return
var/current_stage = hole_size
if(current_stage >= MAX_HOLE_SIZE)
to_chat(user, "<span class='warning'>This fence has too much cut out of it already!</span>")
to_chat(user, span_warning("This fence has too much cut out of it already!"))
return
user.visible_message("<span class='danger'>\The [user] starts cutting through \the [src] with \the [W].</span>",\
"<span class='danger'>You start cutting through \the [src] with \the [W].</span>")
user.visible_message(span_danger("\The [user] starts cutting through \the [src] with \the [W]."),\
span_danger("You start cutting through \the [src] with \the [W]."))
if(do_after(user, CUT_TIME*W.toolspeed, target = src))
if(current_stage == hole_size)
switch(++hole_size)
if(MEDIUM_HOLE)
visible_message("<span class='notice'>\The [user] cuts into \the [src] some more.</span>")
to_chat(user, "<span class='info'>You could probably fit yourself through that hole now. Although climbing through would be much faster if you made it even bigger.</span>")
visible_message(span_notice("\The [user] cuts into \the [src] some more."))
to_chat(user, span_info("You could probably fit yourself through that hole now. Although climbing through would be much faster if you made it even bigger."))
AddElement(/datum/element/climbable)
if(LARGE_HOLE)
visible_message("<span class='notice'>\The [user] completely cuts through \the [src].</span>")
to_chat(user, "<span class='info'>The hole in \the [src] is now big enough to walk through.</span>")
visible_message(span_notice("\The [user] completely cuts through \the [src]."))
to_chat(user, span_info("The hole in \the [src] is now big enough to walk through."))
RemoveElement(/datum/element/climbable)
update_cut_status()
@@ -129,7 +129,7 @@
/obj/structure/fence/door/proc/toggle(mob/user)
open = !open
visible_message("<span class='notice'>\The [user] [open ? "opens" : "closes"] \the [src].</span>")
visible_message(span_notice("\The [user] [open ? "opens" : "closes"] \the [src]."))
update_door_status()
playsound(src, 'sound/machines/click.ogg', 100, TRUE)