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
@@ -149,7 +149,7 @@
/obj/structure/academy_wizard_spawner/deconstruct(disassembled = TRUE)
if(!broken)
broken = 1
visible_message("<span class='warning'>[src] breaks down!</span>")
visible_message(span_warning("[src] breaks down!"))
icon_state = "forge_off"
STOP_PROCESSING(SSobj, src)
@@ -202,7 +202,7 @@
/obj/item/dice/d20/fate/diceroll(mob/user)
if(!COOLDOWN_FINISHED(src, roll_cd))
to_chat(user, "<span class='warning'>Hold on, [src] isn't caught up with your last roll!</span>")
to_chat(user, span_warning("Hold on, [src] isn't caught up with your last roll!"))
return
. = ..()
@@ -210,14 +210,14 @@
return
if(!ishuman(user) || !user.mind || IS_WIZARD(user))
to_chat(user, "<span class='warning'>You feel the magic of the dice is restricted to ordinary humans!</span>")
to_chat(user, span_warning("You feel the magic of the dice is restricted to ordinary humans!"))
return
if(!reusable)
used = TRUE
var/turf/T = get_turf(src)
T.visible_message("<span class='userdanger'>[src] flares briefly.</span>")
T.visible_message(span_userdanger("[src] flares briefly."))
addtimer(CALLBACK(src, .proc/effect, user, .), 1 SECONDS)
COOLDOWN_START(src, roll_cd, 2.5 SECONDS)
@@ -225,7 +225,7 @@
/obj/item/dice/d20/fate/equipped(mob/user, slot)
. = ..()
if(!ishuman(user) || !user.mind || IS_WIZARD(user))
to_chat(user, "<span class='warning'>You feel the magic of the dice is restricted to ordinary humans! You should leave it alone.</span>")
to_chat(user, span_warning("You feel the magic of the dice is restricted to ordinary humans! You should leave it alone."))
user.dropItemToGround(src)
@@ -234,35 +234,35 @@
switch(roll)
if(1)
//Dust
T.visible_message("<span class='userdanger'>[user] turns to dust!</span>")
T.visible_message(span_userdanger("[user] turns to dust!"))
user.dust()
if(2)
//Death
T.visible_message("<span class='userdanger'>[user] suddenly dies!</span>")
T.visible_message(span_userdanger("[user] suddenly dies!"))
user.death()
if(3)
//Swarm of creatures
T.visible_message("<span class='userdanger'>A swarm of creatures surrounds [user]!</span>")
T.visible_message(span_userdanger("A swarm of creatures surrounds [user]!"))
for(var/direction in GLOB.alldirs)
new /mob/living/simple_animal/hostile/netherworld(get_step(get_turf(user),direction))
if(4)
//Destroy Equipment
T.visible_message("<span class='userdanger'>Everything [user] is holding and wearing disappears!</span>")
T.visible_message(span_userdanger("Everything [user] is holding and wearing disappears!"))
for(var/obj/item/I in user)
if(istype(I, /obj/item/implant))
continue
qdel(I)
if(5)
//Monkeying
T.visible_message("<span class='userdanger'>[user] transforms into a monkey!</span>")
T.visible_message(span_userdanger("[user] transforms into a monkey!"))
user.monkeyize()
if(6)
//Cut speed
T.visible_message("<span class='userdanger'>[user] starts moving slower!</span>")
T.visible_message(span_userdanger("[user] starts moving slower!"))
user.add_movespeed_modifier(/datum/movespeed_modifier/die_of_fate)
if(7)
//Throw
T.visible_message("<span class='userdanger'>Unseen forces throw [user]!</span>")
T.visible_message(span_userdanger("Unseen forces throw [user]!"))
user.Stun(60)
user.adjustBruteLoss(50)
var/throw_dir = pick(GLOB.cardinals)
@@ -270,29 +270,29 @@
user.throw_at(throw_target, 200, 4)
if(8)
//Fuel tank Explosion
T.visible_message("<span class='userdanger'>An explosion bursts into existence around [user]!</span>")
T.visible_message(span_userdanger("An explosion bursts into existence around [user]!"))
explosion(get_turf(user), devastation_range = -1, light_impact_range = 2, flame_range = 2)
if(9)
//Cold
var/datum/disease/D = new /datum/disease/cold()
T.visible_message("<span class='userdanger'>[user] looks a little under the weather!</span>")
T.visible_message(span_userdanger("[user] looks a little under the weather!"))
user.ForceContractDisease(D, FALSE, TRUE)
if(10)
//Nothing
T.visible_message("<span class='userdanger'>Nothing seems to happen.</span>")
T.visible_message(span_userdanger("Nothing seems to happen."))
if(11)
//Cookie
T.visible_message("<span class='userdanger'>A cookie appears out of thin air!</span>")
T.visible_message(span_userdanger("A cookie appears out of thin air!"))
var/obj/item/food/cookie/C = new(drop_location())
do_smoke(0, drop_location())
C.name = "Cookie of Fate"
if(12)
//Healing
T.visible_message("<span class='userdanger'>[user] looks very healthy!</span>")
T.visible_message(span_userdanger("[user] looks very healthy!"))
user.revive(full_heal = TRUE, admin_revive = TRUE)
if(13)
//Mad Dosh
T.visible_message("<span class='userdanger'>Mad dosh shoots out of [src]!</span>")
T.visible_message(span_userdanger("Mad dosh shoots out of [src]!"))
var/turf/Start = get_turf(src)
for(var/direction in GLOB.alldirs)
var/turf/dirturf = get_step(Start,direction)
@@ -304,17 +304,17 @@
new /obj/item/coin/gold(M)
if(14)
//Free Gun
T.visible_message("<span class='userdanger'>An impressive gun appears!</span>")
T.visible_message(span_userdanger("An impressive gun appears!"))
do_smoke(0, drop_location())
new /obj/item/gun/ballistic/revolver/mateba(drop_location())
if(15)
//Random One-use spellbook
T.visible_message("<span class='userdanger'>A magical looking book drops to the floor!</span>")
T.visible_message(span_userdanger("A magical looking book drops to the floor!"))
do_smoke(0, drop_location())
new /obj/item/book/granter/spell/random(drop_location())
if(16)
//Servant & Servant Summon
T.visible_message("<span class='userdanger'>A Dice Servant appears in a cloud of smoke!</span>")
T.visible_message(span_userdanger("A Dice Servant appears in a cloud of smoke!"))
var/mob/living/carbon/human/H = new(drop_location())
do_smoke(0, drop_location())
@@ -337,23 +337,23 @@
if(17)
//Tator Kit
T.visible_message("<span class='userdanger'>A suspicious box appears!</span>")
T.visible_message(span_userdanger("A suspicious box appears!"))
new /obj/item/storage/box/syndicate/bundle_a(drop_location())
do_smoke(0, drop_location())
if(18)
//Captain ID
T.visible_message("<span class='userdanger'>A golden identification card appears!</span>")
T.visible_message(span_userdanger("A golden identification card appears!"))
new /obj/item/card/id/advanced/gold/captains_spare(drop_location())
do_smoke(0, drop_location())
if(19)
//Instrinct Resistance
T.visible_message("<span class='userdanger'>[user] looks very robust!</span>")
T.visible_message(span_userdanger("[user] looks very robust!"))
user.physiology.brute_mod *= 0.5
user.physiology.burn_mod *= 0.5
if(20)
//Free wizard!
T.visible_message("<span class='userdanger'>Magic flows out of [src] and into [user]!</span>")
T.visible_message(span_userdanger("Magic flows out of [src] and into [user]!"))
user.mind.make_wizard()
/datum/outfit/butler
@@ -402,7 +402,7 @@
AddElement(/datum/element/update_icon_blocker)
/obj/structure/ladder/unbreakable/rune/show_fluff_message(up,mob/user)
user.visible_message("<span class='notice'>[user] activates \the [src].</span>", "<span class='notice'>You activate \the [src].</span>")
user.visible_message(span_notice("[user] activates \the [src]."), span_notice("You activate \the [src]."))
/obj/structure/ladder/unbreakable/rune/use(mob/user, is_ghost=FALSE)
if(is_ghost || !IS_WIZARD(user))
@@ -169,10 +169,10 @@
/turf/open/lava/plasma/attackby(obj/item/I, mob/user, params)
var/obj/item/reagent_containers/glass/C = I
if(C.reagents.total_volume >= C.volume)
to_chat(user, "<span class='danger'>[C] is full.</span>")
to_chat(user, span_danger("[C] is full."))
return
C.reagents.add_reagent(/datum/reagent/toxin/plasma, rand(5, 10))
user.visible_message("<span class='notice'>[user] scoops some plasma from the [src] with \the [C].</span>", "<span class='notice'>You scoop out some plasma from the [src] using \the [C].</span>")
user.visible_message(span_notice("[user] scoops some plasma from the [src] with \the [C]."), span_notice("You scoop out some plasma from the [src] using \the [C]."))
/turf/open/lava/plasma/burn_stuff(AM)
. = 0
@@ -235,13 +235,13 @@
PP.emote("scream")
ADD_TRAIT(NB, TRAIT_PLASMABURNT, src)
PP.update_body_parts()
PP.visible_message("<span class='warning'>[L] screams in pain as [L.p_their()] [NB] melts down to the bone!</span>", \
"<span class='userdanger'>You scream out in pain as your [NB] melts down to the bone, leaving an eerie plasma-like glow where flesh used to be!</span>")
PP.visible_message(span_warning("[L] screams in pain as [L.p_their()] [NB] melts down to the bone!"), \
span_userdanger("You scream out in pain as your [NB] melts down to the bone, leaving an eerie plasma-like glow where flesh used to be!"))
if(!plasma_parts.len && !robo_parts.len) //a person with no potential organic limbs left AND no robotic limbs, time to turn them into a plasmaman
PP.IgniteMob()
PP.set_species(/datum/species/plasmaman)
PP.visible_message("<span class='warning'>[L] bursts into a brilliant purple flame as [L.p_their()] entire body is that of a skeleton!</span>", \
"<span class='userdanger'>Your senses numb as all of your remaining flesh is turned into a purple slurry, sloshing off your body and leaving only your bones to show in a vibrant purple!</span>")
PP.visible_message(span_warning("[L] bursts into a brilliant purple flame as [L.p_their()] entire body is that of a skeleton!"), \
span_userdanger("Your senses numb as all of your remaining flesh is turned into a purple slurry, sloshing off your body and leaving only your bones to show in a vibrant purple!"))
//mafia specific tame happy plasma (normal atmos, no slowdown)
/turf/open/lava/plasma/mafia
@@ -147,7 +147,7 @@
var/mob/living/carbon/human/M = AM
if(M.stat != DEAD && M.ckey)
visible_message("<span class='warning'>[M] triggered [src]!</span>")
visible_message(span_warning("[M] triggered [src]!"))
triggered = 1
var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread
@@ -164,10 +164,10 @@
var/mob/living/carbon/C = usr
if(!C.stat)
to_chat(C, "<span class='notice'>You're not dead yet!</span>")
to_chat(C, span_notice("You're not dead yet!"))
return
if(C.has_status_effect(STATUS_EFFECT_WISH_GRANTERS_GIFT))
to_chat(C, "<span class='warning'>You're already resurrecting!</span>")
to_chat(C, span_warning("You're already resurrecting!"))
return
C.apply_status_effect(STATUS_EFFECT_WISH_GRANTERS_GIFT)
return 1