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
+2 -2
View File
@@ -287,7 +287,7 @@ and clear when youre done! if you dont i will use :newspaper2: on you
atom_contents.forceMove(target_turf)
if(!silent)
visible_message("<span class='notice'>[holo_atom] fades away!</span>")
visible_message(span_notice("[holo_atom] fades away!"))
qdel(holo_atom)
@@ -373,7 +373,7 @@ and clear when youre done! if you dont i will use :newspaper2: on you
return
playsound(src, "sparks", 75, TRUE)
obj_flags |= EMAGGED
to_chat(user, "<span class='warning'>You vastly increase projector power and override the safety and security protocols.</span>")
to_chat(user, span_warning("You vastly increase projector power and override the safety and security protocols."))
say("Warning. Automatic shutoff and derezzing protocols have been corrupted. Please call Nanotrasen maintenance and do not use the simulator.")
log_game("[key_name(user)] emagged the Holodeck Control Console")
nerf(!(obj_flags & EMAGGED),FALSE)
+14 -14
View File
@@ -55,14 +55,14 @@
w_class = WEIGHT_CLASS_BULKY
hitsound = 'sound/weapons/blade1.ogg'
playsound(user, 'sound/weapons/saberon.ogg', 20, TRUE)
to_chat(user, "<span class='notice'>[src] is now active.</span>")
to_chat(user, span_notice("[src] is now active."))
else
force = 3
icon_state = "sword0"
w_class = WEIGHT_CLASS_SMALL
hitsound = "swing_hit"
playsound(user, 'sound/weapons/saberoff.ogg', 20, TRUE)
to_chat(user, "<span class='notice'>[src] can now be concealed.</span>")
to_chat(user, span_notice("[src] can now be concealed."))
return
//BASKETBALL OBJECTS
@@ -89,7 +89,7 @@
M.apply_damage(10, STAMINA)
if(prob(5))
M.Paralyze(60)
visible_message("<span class='danger'>[M] is knocked right off [M.p_their()] feet!</span>")
visible_message(span_danger("[M] is knocked right off [M.p_their()] feet!"))
//
// Structures
@@ -106,7 +106,7 @@
/obj/structure/holohoop/attackby(obj/item/W, mob/user, params)
if(get_dist(src,user)<2)
if(user.transferItemToLoc(W, drop_location()))
visible_message("<span class='warning'>[user] dunks [W] into \the [src]!</span>")
visible_message(span_warning("[user] dunks [W] into \the [src]!"))
/obj/structure/holohoop/attack_hand(mob/living/user, list/modifiers)
. = ..()
@@ -115,11 +115,11 @@
if(user.pulling && isliving(user.pulling))
var/mob/living/L = user.pulling
if(user.grab_state < GRAB_AGGRESSIVE)
to_chat(user, "<span class='warning'>You need a better grip to do that!</span>")
to_chat(user, span_warning("You need a better grip to do that!"))
return
L.forceMove(loc)
L.Paralyze(100)
visible_message("<span class='danger'>[user] dunks [L] into \the [src]!</span>")
visible_message(span_danger("[user] dunks [L] into \the [src]!"))
user.stop_pulling()
else
..()
@@ -128,10 +128,10 @@
if (isitem(AM) && !istype(AM,/obj/projectile))
if(prob(50))
AM.forceMove(get_turf(src))
visible_message("<span class='warning'>Swish! [AM] lands in [src].</span>")
visible_message(span_warning("Swish! [AM] lands in [src]."))
return
else
visible_message("<span class='danger'>[AM] bounces off of [src]'s rim!</span>")
visible_message(span_danger("[AM] bounces off of [src]'s rim!"))
return ..()
else
return ..()
@@ -157,22 +157,22 @@
power_channel = AREA_USAGE_ENVIRON
/obj/machinery/readybutton/attack_ai(mob/user)
to_chat(user, "<span class='warning'>The station AI is not to interact with these devices!</span>")
to_chat(user, span_warning("The station AI is not to interact with these devices!"))
return
/obj/machinery/readybutton/attack_paw(mob/user, list/modifiers)
to_chat(user, "<span class='warning'>You are too primitive to use this device!</span>")
to_chat(user, span_warning("You are too primitive to use this device!"))
return
/obj/machinery/readybutton/attackby(obj/item/W, mob/user, params)
to_chat(user, "<span class='warning'>The device is a solid button, there's nothing you can do with it!</span>")
to_chat(user, span_warning("The device is a solid button, there's nothing you can do with it!"))
/obj/machinery/readybutton/attack_hand(mob/user, list/modifiers)
. = ..()
if(.)
return
if(user.stat || machine_stat & (NOPOWER|BROKEN))
to_chat(user, "<span class='warning'>This device is not powered!</span>")
to_chat(user, span_warning("This device is not powered!"))
return
currentarea = get_area(src.loc)
@@ -180,7 +180,7 @@
qdel(src)
if(eventstarted)
to_chat(usr, "<span class='warning'>The event has already begun!</span>")
to_chat(usr, span_warning("The event has already begun!"))
return
ready = !ready
@@ -210,7 +210,7 @@
qdel(W)
for(var/mob/M in currentarea)
to_chat(M, "<span class='userdanger'>FIGHT!</span>")
to_chat(M, span_userdanger("FIGHT!"))
/obj/machinery/conveyor/holodeck