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
@@ -85,7 +85,7 @@
/obj/machinery/skill_station/attackby(obj/item/I, mob/living/user, params)
if(istype(I,/obj/item/skillchip))
if(inserted_skillchip)
to_chat(user,"<span class='notice'>There's already a skillchip inside.</span>")
to_chat(user,span_notice("There's already a skillchip inside."))
return
if(!user.transferItemToLoc(I, src))
return
@@ -125,9 +125,9 @@
var/mob/living/carbon/carbon_occupant = occupant
var/implant_msg = carbon_occupant.implant_skillchip(inserted_skillchip, FALSE)
if(implant_msg)
to_chat(carbon_occupant,"<span class='notice'>Operation failed! [implant_msg]</span>")
to_chat(carbon_occupant,span_notice("Operation failed! [implant_msg]"))
else
to_chat(carbon_occupant,"<span class='notice'>Operation complete!</span>")
to_chat(carbon_occupant,span_notice("Operation complete!"))
inserted_skillchip = null
update_appearance()
@@ -138,7 +138,7 @@
return
if(to_be_removed.is_on_cooldown())
to_chat(occupant, "<span class='notice'>DANGER! Operation cannot be completed, removal is unsafe.</span>")
to_chat(occupant, span_notice("DANGER! Operation cannot be completed, removal is unsafe."))
CRASH("Unusual error - [usr] attempted to start removal of [to_be_removed] when the interface state should not have allowed it.")
working = TRUE
@@ -154,15 +154,15 @@
var/mob/living/carbon/carbon_occupant = occupant
if(to_be_removed.is_on_cooldown())
to_chat(carbon_occupant,"<span class='notice'>Safety mechanisms activated! Skillchip cannot be safely removed.</span>")
to_chat(carbon_occupant,span_notice("Safety mechanisms activated! Skillchip cannot be safely removed."))
return
if(!istype(carbon_occupant))
to_chat(carbon_occupant,"<span class='notice'>Occupant does not appear to be a carbon-based lifeform!</span>")
to_chat(carbon_occupant,span_notice("Occupant does not appear to be a carbon-based lifeform!"))
return
if(!carbon_occupant.remove_skillchip(to_be_removed))
to_chat(carbon_occupant,"<span class='notice'>Failed to remove skillchip!</span>")
to_chat(carbon_occupant,span_notice("Failed to remove skillchip!"))
return
if(to_be_removed.removable)
@@ -170,29 +170,29 @@
else
qdel(to_be_removed)
to_chat(carbon_occupant, "<span class='notice'>Operation complete!</span>")
to_chat(carbon_occupant, span_notice("Operation complete!"))
/obj/machinery/skill_station/proc/toggle_chip_active(obj/item/skillchip/to_be_toggled)
var/mob/living/carbon/carbon_occupant = occupant
if(to_be_toggled.is_on_cooldown())
to_chat(carbon_occupant,"<span class='notice'>Safety mechanisms activated! Skillchip cannot be safely modified.</span>")
to_chat(carbon_occupant,span_notice("Safety mechanisms activated! Skillchip cannot be safely modified."))
return
if(!istype(carbon_occupant))
to_chat(carbon_occupant,"<span class='notice'>Occupant does not appear to be a carbon-based lifeform!</span>")
to_chat(carbon_occupant,span_notice("Occupant does not appear to be a carbon-based lifeform!"))
return
if(to_be_toggled.is_active())
var/active_msg = to_be_toggled.try_deactivate_skillchip(FALSE, FALSE)
if(active_msg)
to_chat(carbon_occupant,"<span class='notice'>Failed to deactivate skillchip! [active_msg]</span>")
to_chat(carbon_occupant,span_notice("Failed to deactivate skillchip! [active_msg]"))
return
// This code will fire when to_be_toggled.active is FALSE
var/active_msg = to_be_toggled.try_activate_skillchip(FALSE, FALSE)
if(active_msg)
to_chat(carbon_occupant,"<span class='notice'>Failed to activate skillchip! [active_msg]</span>")
to_chat(carbon_occupant,span_notice("Failed to activate skillchip! [active_msg]"))
/obj/machinery/skill_station/ui_data(mob/user)
. = ..()
@@ -285,7 +285,7 @@
stack_trace("[usr] tried to toggle skillchip activation when [src] was in an invalid state.")
return TRUE
if(inserted_skillchip)
to_chat(occupant,"<span class='notice'>You eject the skillchip.</span>")
to_chat(occupant,span_notice("You eject the skillchip."))
var/mob/living/carbon/human/H = occupant
H.put_in_hands(inserted_skillchip)
inserted_skillchip = null