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
+7 -7
View File
@@ -34,11 +34,11 @@
var/udder_filled_percentage = PERCENT(udder.reagents.total_volume / udder.reagents.maximum_volume)
switch(udder_filled_percentage)
if(0 to 10)
examine_list += "<span class='notice'>[parent]'s [udder] is dry.</span>"
examine_list += span_notice("[parent]'s [udder] is dry.")
if(11 to 99)
examine_list += "<span class='notice'>[parent]'s [udder] can be milked if you have something to contain it.</span>"
examine_list += span_notice("[parent]'s [udder] can be milked if you have something to contain it.")
if(100)
examine_list += "<span class='notice'>[parent]'s [udder] is round and full, and can be milked if you have something to contain it.</span>"
examine_list += span_notice("[parent]'s [udder] is round and full, and can be milked if you have something to contain it.")
///signal called on parent being attacked with an item
@@ -111,13 +111,13 @@
*/
/obj/item/udder/proc/milk(obj/item/reagent_containers/glass/milk_holder, mob/user)
if(milk_holder.reagents.total_volume >= milk_holder.volume)
to_chat(user, "<span class='warning'>[milk_holder] is full.</span>")
to_chat(user, span_warning("[milk_holder] is full."))
return
var/transfered = reagents.trans_to(milk_holder, rand(5,10))
if(transfered)
user.visible_message("<span class='notice'>[user] milks [src] using \the [milk_holder].</span>", "<span class='notice'>You milk [src] using \the [milk_holder].</span>")
user.visible_message(span_notice("[user] milks [src] using \the [milk_holder]."), span_notice("You milk [src] using \the [milk_holder]."))
else
to_chat(user, "<span class='warning'>The udder is dry. Wait a bit longer...</span>")
to_chat(user, span_warning("The udder is dry. Wait a bit longer..."))
/**
* # gutlunch udder subtype
@@ -146,7 +146,7 @@
/obj/item/udder/proc/on_mob_attacking(mob/living/simple_animal/hostile/gutlunch, atom/target)
if(is_type_in_typecache(target, gutlunch.wanted_objects)) //we eats
generate()
gutlunch.visible_message("<span class='notice'>[src] slurps up [target].</span>")
gutlunch.visible_message(span_notice("[src] slurps up [target]."))
qdel(target)
return COMPONENT_HOSTILE_NO_ATTACK //there is no longer a target to attack