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
@@ -55,7 +55,7 @@
R.transfer_fingerprints_to(TP)
TP.add_fingerprint(user)
TP.setDir(turn(src.dir, -90))
user.visible_message("<span class='notice'>[user] inserts [R].</span>", "<span class='notice'>You insert [R].</span>")
user.visible_message(span_notice("[user] inserts [R]."), span_notice("You insert [R]."))
qdel(R)
@@ -69,10 +69,10 @@
var/mob/living/GM = user.pulling
if(user.grab_state >= GRAB_AGGRESSIVE)
if(GM.buckled || GM.has_buckled_mobs())
to_chat(user, "<span class='warning'>[GM] is attached to something!</span>")
to_chat(user, span_warning("[GM] is attached to something!"))
return
for(var/obj/structure/transit_tube_pod/pod in loc)
pod.visible_message("<span class='warning'>[user] starts putting [GM] into the [pod]!</span>")
pod.visible_message(span_warning("[user] starts putting [GM] into the [pod]!"))
if(do_after(user, 15, target = src))
if(open_status == STATION_TUBE_OPEN && GM && user.grab_state >= GRAB_AGGRESSIVE && user.pulling == GM && !GM.buckled && !GM.has_buckled_mobs())
GM.Paralyze(100)
@@ -86,7 +86,7 @@
else if(open_status == STATION_TUBE_OPEN)
if(pod.contents.len && user.loc != pod)
user.visible_message("<span class='notice'>[user] starts emptying [pod]'s contents onto the floor.</span>", "<span class='notice'>You start emptying [pod]'s contents onto the floor...</span>")
user.visible_message(span_notice("[user] starts emptying [pod]'s contents onto the floor."), span_notice("You start emptying [pod]'s contents onto the floor..."))
if(do_after(user, 10, target = src)) //So it doesn't default to close_animation() on fail
if(pod && pod.loc == loc)
for(var/atom/movable/AM in pod)
@@ -249,13 +249,13 @@
/obj/structure/transit_tube/station/dispenser/examine(mob/user)
. = ..()
. += "<span class='notice'>This station will create a pod for you to ride, no need to wait for one.</span>"
. += span_notice("This station will create a pod for you to ride, no need to wait for one.")
/obj/structure/transit_tube/station/dispenser/Bumped(atom/movable/AM)
if(!(istype(AM) && AM.dir == boarding_dir))
return
var/obj/structure/transit_tube_pod/dispensed/pod = new(loc)
AM.visible_message("<span class='notice'>[pod] forms around [AM].</span>", "<span class='notice'>[pod] materializes around you.</span>")
AM.visible_message(span_notice("[pod] forms around [AM]."), span_notice("[pod] materializes around you."))
playsound(src, 'sound/weapons/emitter2.ogg', 50, TRUE)
pod.setDir(turn(src.dir, -90))
AM.forceMove(pod)
@@ -35,11 +35,11 @@
if(W.tool_behaviour == TOOL_WRENCH)
if(tube_construction)
for(var/obj/structure/transit_tube_pod/pod in src.loc)
to_chat(user, "<span class='warning'>Remove the pod first!</span>")
to_chat(user, span_warning("Remove the pod first!"))
return
user.visible_message("<span class='notice'>[user] starts to detach \the [src].</span>", "<span class='notice'>You start to detach the [name]...</span>")
user.visible_message(span_notice("[user] starts to detach \the [src]."), span_notice("You start to detach the [name]..."))
if(W.use_tool(src, user, 2 SECONDS, volume=50))
to_chat(user, "<span class='notice'>You detach the [name].</span>")
to_chat(user, span_notice("You detach the [name]."))
var/obj/structure/c_transit_tube/R = new tube_construction(loc)
R.setDir(dir)
transfer_fingerprints_to(R)
@@ -20,7 +20,7 @@
for(var/obj/structure/transit_tube/tube in source_turf)
existing_tubes +=1
if(existing_tubes >= 2)
to_chat(user, "<span class='warning'>You cannot wrench any more transit tubes!</span> ")
to_chat(user, "[span_warning("You cannot wrench any more transit tubes!")] ")
return FALSE
return TRUE
@@ -43,10 +43,10 @@
..()
if(!can_wrench_in_loc(user))
return
to_chat(user, "<span class='notice'>You start attaching the [name]...</span>")
to_chat(user, span_notice("You start attaching the [name]..."))
add_fingerprint(user)
if(I.use_tool(src, user, 2 SECONDS, volume=50, extra_checks=CALLBACK(src, .proc/can_wrench_in_loc, user)))
to_chat(user, "<span class='notice'>You attach the [name].</span>")
to_chat(user, span_notice("You attach the [name]."))
var/obj/structure/transit_tube/R = new build_type(loc, dir)
transfer_fingerprints_to(R)
qdel(src)
@@ -39,7 +39,7 @@
if(!moving)
I.play_tool_sound(src)
if(contents.len)
user.visible_message("<span class='notice'>[user] empties \the [src].</span>", "<span class='notice'>You empty \the [src].</span>")
user.visible_message(span_notice("[user] empties \the [src]."), span_notice("You empty \the [src]."))
empty_pod()
else
deconstruct(TRUE, user)
@@ -52,7 +52,7 @@
if(user)
location = user.loc
add_fingerprint(user)
user.visible_message("<span class='notice'>[user] removes [src].</span>", "<span class='notice'>You remove [src].</span>")
user.visible_message(span_notice("[user] removes [src]."), span_notice("You remove [src]."))
var/obj/structure/c_transit_tube_pod/R = new/obj/structure/c_transit_tube_pod(location)
transfer_fingerprints_to(R)
R.setDir(dir)
@@ -85,9 +85,9 @@
if(!moving)
user.changeNext_move(CLICK_CD_BREAKOUT)
user.last_special = world.time + CLICK_CD_BREAKOUT
to_chat(user, "<span class='notice'>You start trying to escape from the pod...</span>")
to_chat(user, span_notice("You start trying to escape from the pod..."))
if(do_after(user, 1 MINUTES, target = src))
to_chat(user, "<span class='notice'>You manage to open the pod.</span>")
to_chat(user, span_notice("You manage to open the pod."))
empty_pod()
/obj/structure/transit_tube_pod/proc/empty_pod(atom/location)
@@ -167,7 +167,7 @@
var/list/savedcontents = contents.Copy()
var/saveddir = dir
var/turf/destination = get_edge_target_turf(src,saveddir)
visible_message("<span class='warning'>[src] ejects its insides out!</span>")
visible_message(span_warning("[src] ejects its insides out!"))
deconstruct(FALSE)//we automatically deconstruct the pod
for(var/i in savedcontents)
var/atom/movable/AM = i