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
+1 -1
View File
@@ -91,7 +91,7 @@
/obj/effect/anomaly/attackby(obj/item/I, mob/user, params)
if(I.tool_behaviour == TOOL_ANALYZER)
to_chat(user, "<span class='notice'>Analyzing... [src]'s unstable field is fluctuating along frequency [format_frequency(aSignal.frequency)], code [aSignal.code].</span>")
to_chat(user, span_notice("Analyzing... [src]'s unstable field is fluctuating along frequency [format_frequency(aSignal.frequency)], code [aSignal.code]."))
///////////////////////
+9 -9
View File
@@ -103,10 +103,10 @@
if(I.tool_behaviour == TOOL_WIRECUTTER)
I.play_tool_sound(src, 100)
if(ruined)
to_chat(user, "<span class='notice'>You remove the remnants of the poster.</span>")
to_chat(user, span_notice("You remove the remnants of the poster."))
qdel(src)
else
to_chat(user, "<span class='notice'>You carefully remove the poster from the wall.</span>")
to_chat(user, span_notice("You carefully remove the poster from the wall."))
roll_and_drop(user.loc)
/obj/structure/sign/poster/attack_hand(mob/user, list/modifiers)
@@ -115,7 +115,7 @@
return
if(ruined)
return
visible_message("<span class='notice'>[user] rips [src] in a single, decisive motion!</span>" )
visible_message(span_notice("[user] rips [src] in a single, decisive motion!") )
playsound(src.loc, 'sound/items/poster_ripped.ogg', 100, TRUE)
var/obj/structure/sign/poster/ripped/R = new(loc)
@@ -134,7 +134,7 @@
//separated to reduce code duplication. Moved here for ease of reference and to unclutter r_wall/attackby()
/turf/closed/wall/proc/place_poster(obj/item/poster/P, mob/user)
if(!P.poster_structure)
to_chat(user, "<span class='warning'>[P] has no poster... inside it? Inform a coder!</span>")
to_chat(user, span_warning("[P] has no poster... inside it? Inform a coder!"))
return
// Deny placing posters on currently-diagonal walls, although the wall may change in the future.
@@ -147,14 +147,14 @@
var/stuff_on_wall = 0
for(var/obj/O in contents) //Let's see if it already has a poster on it or too much stuff
if(istype(O, /obj/structure/sign/poster))
to_chat(user, "<span class='warning'>The wall is far too cluttered to place a poster!</span>")
to_chat(user, span_warning("The wall is far too cluttered to place a poster!"))
return
stuff_on_wall++
if(stuff_on_wall == 3)
to_chat(user, "<span class='warning'>The wall is far too cluttered to place a poster!</span>")
to_chat(user, span_warning("The wall is far too cluttered to place a poster!"))
return
to_chat(user, "<span class='notice'>You start placing the poster on the wall...</span>" )
to_chat(user, span_notice("You start placing the poster on the wall...") )
var/obj/structure/sign/poster/D = P.poster_structure
@@ -169,10 +169,10 @@
return
if(iswallturf(src) && user && user.loc == temp_loc) //Let's check if everything is still there
to_chat(user, "<span class='notice'>You place the poster!</span>")
to_chat(user, span_notice("You place the poster!"))
return
to_chat(user, "<span class='notice'>The poster falls down!</span>")
to_chat(user, span_notice("The poster falls down!"))
D.roll_and_drop(get_turf(user))
// Various possible posters follow
@@ -53,12 +53,12 @@
if(src.reagents && W.reagents)
. = 1 //so the containers don't splash their content on the src while scooping.
if(!src.reagents.total_volume)
to_chat(user, "<span class='notice'>[src] isn't thick enough to scoop up!</span>")
to_chat(user, span_notice("[src] isn't thick enough to scoop up!"))
return
if(W.reagents.total_volume >= W.reagents.maximum_volume)
to_chat(user, "<span class='notice'>[W] is full!</span>")
to_chat(user, span_notice("[W] is full!"))
return
to_chat(user, "<span class='notice'>You scoop up [src] into [W]!</span>")
to_chat(user, span_notice("You scoop up [src] into [W]!"))
reagents.trans_to(W, reagents.total_volume, transfered_by = user)
if(!reagents.total_volume) //scooped up all of it
qdel(src)
@@ -69,7 +69,7 @@
else
var/hotness = W.get_temperature()
reagents.expose_temperature(hotness)
to_chat(user, "<span class='notice'>You heat [name] with [W]!</span>")
to_chat(user, span_notice("You heat [name] with [W]!"))
else
return ..()
@@ -40,7 +40,7 @@
/obj/effect/decal/cleanable/food/salt/Bumped(atom/movable/AM)
. = ..()
if(is_species(AM, /datum/species/snail))
to_chat(AM, "<span class='danger'>Your path is obstructed by <span class='phobia'>salt</span>.</span>")
to_chat(AM, span_danger("Your path is obstructed by [span_phobia("salt")]."))
/obj/effect/decal/cleanable/food/salt/on_entered(datum/source, atom/movable/AM)
. = ..()
@@ -145,7 +145,7 @@
var/mob/living/carbon/human/H = user
if(isflyperson(H))
playsound(get_turf(src), 'sound/items/drink.ogg', 50, TRUE) //slurp
H.visible_message("<span class='alert'>[H] extends a small proboscis into the vomit pool, sucking it with a slurping sound.</span>")
H.visible_message(span_alert("[H] extends a small proboscis into the vomit pool, sucking it with a slurping sound."))
if(reagents)
for(var/datum/reagent/R in reagents.reagent_list)
if (istype(R, /datum/reagent/consumable))
@@ -77,7 +77,7 @@
/obj/effect/decal/cleanable/oil/attackby(obj/item/I, mob/living/user)
var/attacked_by_hot_thing = I.get_temperature()
if(attacked_by_hot_thing)
visible_message("<span class='warning'>[user] tries to ignite [src] with [I]!</span>", "<span class='warning'>You try to ignite [src] with [I].</span>")
visible_message(span_warning("[user] tries to ignite [src] with [I]!"), span_warning("You try to ignite [src] with [I]."))
log_combat(user, src, (attacked_by_hot_thing < 480) ? "tried to ignite" : "ignited", I)
fire_act(attacked_by_hot_thing)
return
@@ -86,7 +86,7 @@
/obj/effect/decal/cleanable/oil/fire_act(exposed_temperature, exposed_volume)
if(exposed_temperature < 480)
return
visible_message("<span class='danger'>[src] catches fire!</span>")
visible_message(span_danger("[src] catches fire!"))
var/turf/T = get_turf(src)
qdel(src)
new /obj/effect/hotspot(T)
+1 -1
View File
@@ -4,7 +4,7 @@
icon = 'icons/effects/blood.dmi'
/obj/effect/decal/remains/acid_act()
visible_message("<span class='warning'>[src] dissolve[gender==PLURAL?"":"s"] into a puddle of sizzling goop!</span>")
visible_message(span_warning("[src] dissolve[gender==PLURAL?"":"s"] into a puddle of sizzling goop!"))
playsound(src, 'sound/items/welder.ogg', 150, TRUE)
new /obj/effect/decal/cleanable/greenglow(drop_location())
qdel(src)
@@ -301,7 +301,7 @@
return
user.changeNext_move(CLICK_CD_MELEE)
user.do_attack_animation(src, ATTACK_EFFECT_PUNCH)
to_chat(user, "<span class='warning'>You hit [src] but bounce off it!</span>")
to_chat(user, span_warning("You hit [src] but bounce off it!"))
playsound(src.loc, 'sound/weapons/tap.ogg', 100, TRUE)
/obj/structure/foamedmetal/iron
@@ -338,7 +338,7 @@
if(!U.welded)
U.welded = TRUE
U.update_appearance()
U.visible_message("<span class='danger'>[U] sealed shut!</span>")
U.visible_message(span_danger("[U] sealed shut!"))
for(var/mob/living/L in O)
L.extinguish_mob()
for(var/obj/item/Item in O)
@@ -102,7 +102,7 @@
/datum/effect_system/reagents_explosion/start()
if(explosion_message)
location.visible_message("<span class='danger'>The solution violently explodes!</span>", \
"<span class='hear'>You hear an explosion!</span>")
location.visible_message(span_danger("The solution violently explodes!"), \
span_hear("You hear an explosion!"))
dyn_explosion(location, amount, flash_range = flashing_factor)
@@ -186,7 +186,7 @@
if(!isnull(U.welded) && !U.welded) //must be an unwelded vent pump or vent scrubber.
U.welded = TRUE
U.update_appearance()
U.visible_message("<span class='danger'>[U] is frozen shut!</span>")
U.visible_message(span_danger("[U] is frozen shut!"))
for(var/mob/living/L in T)
L.extinguish_mob()
for(var/obj/item/Item in T)
+1 -1
View File
@@ -233,7 +233,7 @@
take_damage(5, BURN, 0, 0)
/obj/structure/glowshroom/acid_act(acidpwr, acid_volume)
visible_message("<span class='danger'>[src] melts away!</span>")
visible_message(span_danger("[src] melts away!"))
var/obj/effect/decal/cleanable/molten_object/I = new (get_turf(src))
I.desc = "Looks like this was \an [src] some time ago."
qdel(src)
+6 -6
View File
@@ -30,7 +30,7 @@
/// The effect of the mine
/obj/effect/mine/proc/mineEffect(mob/victim)
to_chat(victim, "<span class='danger'>*click*</span>")
to_chat(victim, span_danger("*click*"))
/// If the landmine was previously inactive, this beeps and displays a message marking it active
/obj/effect/mine/proc/now_armed()
@@ -61,9 +61,9 @@
if(triggered) //too busy detonating to detonate again
return
if(triggerer)
visible_message("<span class='danger'>[triggerer] sets off [icon2html(src, viewers(src))] [src]!</span>")
visible_message(span_danger("[triggerer] sets off [icon2html(src, viewers(src))] [src]!"))
else
visible_message("<span class='danger'>[icon2html(src, viewers(src))] [src] detonates!</span>")
visible_message(span_danger("[icon2html(src, viewers(src))] [src] detonates!"))
var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread
s.set_up(3, 1, src)
@@ -103,7 +103,7 @@
/obj/effect/mine/kickmine/mineEffect(mob/victim)
if(isliving(victim) && victim.client)
to_chat(victim, "<span class='userdanger'>You have been kicked FOR NO REISIN!</span>")
to_chat(victim, span_userdanger("You have been kicked FOR NO REISIN!"))
qdel(victim.client)
@@ -195,7 +195,7 @@
playsound(src, 'sound/weapons/armbomb.ogg', 70, TRUE)
to_chat(user, "<span class='warning'>You arm \the [src], causing it to shake! It will deploy in 3 seconds.</span>")
to_chat(user, span_warning("You arm \the [src], causing it to shake! It will deploy in 3 seconds."))
active = TRUE
addtimer(CALLBACK(src, .proc/deploy_mine), 3 SECONDS)
@@ -204,7 +204,7 @@
do_alert_animation()
playsound(loc, 'sound/machines/chime.ogg', 30, FALSE, -3)
var/obj/effect/mine/new_mine = new mine_type(get_turf(src))
visible_message("<span class='danger'>\The [src] releases a puff of smoke, revealing \a [new_mine]!</span>")
visible_message(span_danger("\The [src] releases a puff of smoke, revealing \a [new_mine]!"))
var/obj/effect/particle_effect/smoke/poof = new (get_turf(src))
poof.lifetime = 3
qdel(src)
+3 -3
View File
@@ -24,7 +24,7 @@
else //this ONLY happens if someone uses a phasing effect to try to land in a NOTELEPORT zone after it is created, AKA trying to exploit.
if(isliving(phasing_in))
var/mob/living/living_cheaterson = phasing_in
to_chat(living_cheaterson, "<span class='userdanger'>This area has a heavy universal force occupying it, and you are scattered to the cosmos!</span>")
to_chat(living_cheaterson, span_userdanger("This area has a heavy universal force occupying it, and you are scattered to the cosmos!"))
if(ishuman(living_cheaterson))
shake_camera(living_cheaterson, 20, 1)
addtimer(CALLBACK(living_cheaterson, /mob/living/carbon.proc/vomit), 2 SECONDS)
@@ -55,10 +55,10 @@
var/area/destination_area = newloc.loc
movedelay = world.time + movespeed
if(newloc.flags_1 & NOJAUNT)
to_chat(user, "<span class='warning'>Some strange aura is blocking the way.</span>")
to_chat(user, span_warning("Some strange aura is blocking the way."))
return
if(destination_area.area_flags & NOTELEPORT)
to_chat(user, "<span class='danger'>Some dull, universal force is blocking the way. It's overwhelmingly oppressive force feels dangerous.</span>")
to_chat(user, span_danger("Some dull, universal force is blocking the way. It's overwhelmingly oppressive force feels dangerous."))
return
return newloc
+1 -1
View File
@@ -47,7 +47,7 @@
else
qdel(src)
if(pickup_message)
to_chat(target, "<span class='notice'>[pickup_message]</span>")
to_chat(target, span_notice("[pickup_message]"))
if(pickup_sound)
playsound(get_turf(target), pickup_sound, 50, TRUE, -1)
return TRUE
+10 -10
View File
@@ -40,7 +40,7 @@
return
if(!HAS_TRAIT(user,TRAIT_WEB_WEAVER))
return
user.visible_message("<span class='notice'>[user] begins weaving [src] into cloth.</span>", "<span class='notice'>You begin weaving [src] into cloth.</span>")
user.visible_message(span_notice("[user] begins weaving [src] into cloth."), span_notice("You begin weaving [src] into cloth."))
if(!do_after(user, 2 SECONDS))
return
qdel(src)
@@ -62,7 +62,7 @@
if(istype(mover.pulledby, /mob/living/simple_animal/hostile/giant_spider))
return TRUE
if(prob(50))
to_chat(mover, "<span class='danger'>You get stuck in \the [src] for a moment.</span>")
to_chat(mover, span_danger("You get stuck in \the [src] for a moment."))
return FALSE
else if(istype(mover, /obj/projectile))
return prob(30)
@@ -83,7 +83,7 @@
if(mover.pulledby == allowed_mob)
return TRUE
if(prob(50))
to_chat(mover, "<span class='danger'>You get stuck in \the [src] for a moment.</span>")
to_chat(mover, span_danger("You get stuck in \the [src] for a moment."))
return FALSE
else if(istype(mover, /obj/projectile))
return prob(30)
@@ -149,7 +149,7 @@
var/datum/radial_menu_choice/option = new
option.image = image(icon = initial(spider.icon), icon_state = initial(spider.icon_state))
option.info = "<span class='boldnotice'>[initial(spider.menu_description)]</span>"
option.info = span_boldnotice("[initial(spider.menu_description)]")
display_spiders[initial(spider.name)] = option
@@ -248,7 +248,7 @@
return
if(prob(50))
audible_message("<span class='hear'>You hear something scampering through the ventilation ducts.</span>")
audible_message(span_hear("You hear something scampering through the ventilation ducts."))
addtimer(CALLBACK(src, .proc/finish_vent_move, exit_vent), travel_time)
@@ -276,7 +276,7 @@
var/obj/machinery/atmospherics/components/unary/vent_pump/exit_vent = pick(vents)
if(prob(50))
visible_message("<B>[src] scrambles into the ventilation ducts!</B>", \
"<span class='hear'>You hear something scampering through the ventilation ducts.</span>")
span_hear("You hear something scampering through the ventilation ducts."))
addtimer(CALLBACK(src, .proc/vent_move, exit_vent), rand(20,60))
@@ -288,7 +288,7 @@
var/target_atom = pick(nearby)
walk_to(src, target_atom)
if(prob(40))
src.visible_message("<span class='notice'>\The [src] skitters[pick(" away"," around","")].</span>")
src.visible_message(span_notice("\The [src] skitters[pick(" away"," around","")]."))
else if(prob(10))
//ventcrawl!
for(var/obj/machinery/atmospherics/components/unary/vent_pump/v in view(7,src))
@@ -323,8 +323,8 @@
var/breakout_time = 600
user.changeNext_move(CLICK_CD_BREAKOUT)
user.last_special = world.time + CLICK_CD_BREAKOUT
to_chat(user, "<span class='notice'>You struggle against the tight bonds... (This will take about [DisplayTimeText(breakout_time)].)</span>")
visible_message("<span class='notice'>You see something struggling and writhing in \the [src]!</span>")
to_chat(user, span_notice("You struggle against the tight bonds... (This will take about [DisplayTimeText(breakout_time)].)"))
visible_message(span_notice("You see something struggling and writhing in \the [src]!"))
if(do_after(user,(breakout_time), target = src))
if(!user || user.stat != CONSCIOUS || user.loc != src)
return
@@ -332,7 +332,7 @@
/obj/structure/spider/cocoon/Destroy()
var/turf/T = get_turf(src)
src.visible_message("<span class='warning'>\The [src] splits open.</span>")
src.visible_message(span_warning("\The [src] splits open."))
for(var/atom/movable/A in contents)
A.forceMove(T)
return ..()
+1 -1
View File
@@ -43,7 +43,7 @@
/obj/effect/step_trigger/message/Trigger(mob/M)
if(M.client)
to_chat(M, "<span class='info'>[message]</span>")
to_chat(M, span_info("[message]"))
if(once)
qdel(src)