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
+24 -24
View File
@@ -39,12 +39,12 @@
/obj/item/assembly/flash/suicide_act(mob/living/user)
if(burnt_out)
user.visible_message("<span class='suicide'>[user] raises \the [src] up to [user.p_their()] eyes and activates it ... but it's burnt out!</span>")
user.visible_message(span_suicide("[user] raises \the [src] up to [user.p_their()] eyes and activates it ... but it's burnt out!"))
return SHAME
else if(user.is_blind())
user.visible_message("<span class='suicide'>[user] raises \the [src] up to [user.p_their()] eyes and activates it ... but [user.p_theyre()] blind!</span>")
user.visible_message(span_suicide("[user] raises \the [src] up to [user.p_their()] eyes and activates it ... but [user.p_theyre()] blind!"))
return SHAME
user.visible_message("<span class='suicide'>[user] raises \the [src] up to [user.p_their()] eyes and activates it! It looks like [user.p_theyre()] trying to commit suicide!</span>")
user.visible_message(span_suicide("[user] raises \the [src] up to [user.p_their()] eyes and activates it! It looks like [user.p_theyre()] trying to commit suicide!"))
attack(user,user)
return FIRELOSS
@@ -82,7 +82,7 @@
/obj/item/assembly/flash/proc/burn_out() //Made so you can override it if you want to have an invincible flash from R&D or something.
if(!burnt_out)
burnt_out = TRUE
loc?.visible_message("<span class='danger'>[src] burns out!</span>","<span class='userdanger'>[src] burns out!</span>")
loc?.visible_message(span_danger("[src] burns out!"),span_userdanger("[src] burns out!"))
update_appearance()
/obj/item/assembly/flash/proc/flash_recharge(interval = 10)
@@ -155,7 +155,7 @@
M.log_message("was [targeted? "flashed(targeted)" : "flashed(AOE)"]",LOG_ATTACK)
if(generic_message && M != user)
to_chat(M, "<span class='danger'>[src] emits a blinding light!</span>")
to_chat(M, span_danger("[src] emits a blinding light!"))
var/deviation = calculate_deviation(M, user ? user : src)
@@ -175,18 +175,18 @@
// Did we try to flash them from behind?
if(deviation == DEVIATION_FULL)
// Headrevs can use a tacticool leaning technique so that they don't have to worry about facing for their conversions.
to_chat(user, "<span class='notice'>You use the tacticool tier, lean over the shoulder technique to blind [M] with a flash!</span>")
to_chat(user, span_notice("You use the tacticool tier, lean over the shoulder technique to blind [M] with a flash!"))
deviation = DEVIATION_PARTIAL
// Convert them. Terribly.
terrible_conversion_proc(M, user)
visible_message("<span class='danger'>[user] blinds [M] with the flash!</span>","<span class='userdanger'>[user] blinds you with the flash!</span>")
visible_message(span_danger("[user] blinds [M] with the flash!"),span_userdanger("[user] blinds you with the flash!"))
//easy way to make sure that you can only long stun someone who is facing in your direction
M.adjustStaminaLoss(rand(80,120)*(1-(deviation*0.5)))
M.Paralyze(rand(25,50)*(1-(deviation*0.5)))
else if(user)
visible_message("<span class='warning'>[user] fails to blind [M] with the flash!</span>","<span class='danger'>[user] fails to blind you with the flash!</span>")
visible_message(span_warning("[user] fails to blind [M] with the flash!"),span_danger("[user] fails to blind you with the flash!"))
else
to_chat(M, "<span class='danger'>[src] fails to blind you!</span>")
to_chat(M, span_danger("[src] fails to blind you!"))
else
if(M.flash_act())
var/diff = power * CONFUSION_STACK_MAX_MULTIPLIER - M.get_confusion()
@@ -253,22 +253,22 @@
log_combat(user, flashed_borgo, "flashed", src)
update_icon(ALL, TRUE)
if(!flashed_borgo.flash_act(affect_silicon = TRUE))
user.visible_message("<span class='warning'>[user] fails to blind [flashed_borgo] with the flash!</span>", "<span class='warning'>You fail to blind [flashed_borgo] with the flash!</span>")
user.visible_message(span_warning("[user] fails to blind [flashed_borgo] with the flash!"), span_warning("You fail to blind [flashed_borgo] with the flash!"))
return
flashed_borgo.Paralyze(rand(80,120))
var/diff = 5 * CONFUSION_STACK_MAX_MULTIPLIER - M.get_confusion()
flashed_borgo.add_confusion(min(5, diff))
user.visible_message("<span class='warning'>[user] overloads [flashed_borgo]'s sensors with the flash!</span>", "<span class='danger'>You overload [flashed_borgo]'s sensors with the flash!</span>")
user.visible_message(span_warning("[user] overloads [flashed_borgo]'s sensors with the flash!"), span_danger("You overload [flashed_borgo]'s sensors with the flash!"))
return
user.visible_message("<span class='warning'>[user] fails to blind [M] with the flash!</span>", "<span class='warning'>You fail to blind [M] with the flash!</span>")
user.visible_message(span_warning("[user] fails to blind [M] with the flash!"), span_warning("You fail to blind [M] with the flash!"))
/obj/item/assembly/flash/attack_self(mob/living/carbon/user, flag = 0, emp = 0)
if(holder)
return FALSE
if(!AOE_flash(FALSE, 3, 5, FALSE, user))
return FALSE
to_chat(user, "<span class='danger'>[src] emits a blinding light!</span>")
to_chat(user, span_danger("[src] emits a blinding light!"))
/obj/item/assembly/flash/emp_act(severity)
. = ..()
@@ -297,10 +297,10 @@
if(!aggressor.mind)
return
if(!victim.client)
to_chat(aggressor, "<span class='warning'>This mind is so vacant that it is not susceptible to influence!</span>")
to_chat(aggressor, span_warning("This mind is so vacant that it is not susceptible to influence!"))
return
if(victim.stat != CONSCIOUS)
to_chat(aggressor, "<span class='warning'>They must be conscious before you can convert [victim.p_them()]!</span>")
to_chat(aggressor, span_warning("They must be conscious before you can convert [victim.p_them()]!"))
return
//If this proc fires the mob must be a revhead
var/datum/antagonist/rev/head/converter = aggressor.mind.has_antag_datum(/datum/antagonist/rev/head)
@@ -309,7 +309,7 @@
victim.say("You son of a bitch! I'm in.", forced = "That son of a bitch! They're in.")
times_used -- //Flashes less likely to burn out for headrevs when used for conversion
else
to_chat(aggressor, "<span class='warning'>This mind seems resistant to the flash!</span>")
to_chat(aggressor, span_warning("This mind seems resistant to the flash!"))
/obj/item/assembly/flash/cyborg
@@ -347,7 +347,7 @@
/obj/item/assembly/flash/armimplant/burn_out()
var/obj/item/organ/cyberimp/arm/flash/real_arm = arm.resolve()
if(real_arm?.owner)
to_chat(real_arm.owner, "<span class='warning'>Your photon projector implant overheats and deactivates!</span>")
to_chat(real_arm.owner, span_warning("Your photon projector implant overheats and deactivates!"))
real_arm.Retract()
overheat = TRUE
addtimer(CALLBACK(src, .proc/cooldown), flashcd * 2)
@@ -356,7 +356,7 @@
if(overheat)
var/obj/item/organ/cyberimp/arm/flash/real_arm = arm.resolve()
if(real_arm?.owner)
to_chat(real_arm.owner, "<span class='warning'>Your photon projector is running too hot to be used again so quickly!</span>")
to_chat(real_arm.owner, span_warning("Your photon projector is running too hot to be used again so quickly!"))
return FALSE
overheat = TRUE
addtimer(CALLBACK(src, .proc/cooldown), flashcd)
@@ -385,17 +385,17 @@
else //caused by emp/remote signal
M.log_message("was [targeted? "hypno-flashed(targeted)" : "hypno-flashed(AOE)"]",LOG_ATTACK)
if(generic_message && M != user)
to_chat(M, "<span class='notice'>[src] emits a soothing light...</span>")
to_chat(M, span_notice("[src] emits a soothing light..."))
if(targeted)
if(M.flash_act(1, 1))
var/hypnosis = FALSE
if(M.hypnosis_vulnerable())
hypnosis = TRUE
if(user)
user.visible_message("<span class='danger'>[user] blinds [M] with the flash!</span>", "<span class='danger'>You hypno-flash [M]!</span>")
user.visible_message(span_danger("[user] blinds [M] with the flash!"), span_danger("You hypno-flash [M]!"))
if(!hypnosis)
to_chat(M, "<span class='hypnophrase'>The light makes you feel oddly relaxed...</span>")
to_chat(M, span_hypnophrase("The light makes you feel oddly relaxed..."))
M.add_confusion(min(M.get_confusion() + 10, 20))
M.dizziness += min(M.dizziness + 10, 20)
M.drowsyness += min(M.drowsyness + 10, 20)
@@ -404,12 +404,12 @@
M.apply_status_effect(/datum/status_effect/trance, 200, TRUE)
else if(user)
user.visible_message("<span class='warning'>[user] fails to blind [M] with the flash!</span>", "<span class='warning'>You fail to hypno-flash [M]!</span>")
user.visible_message(span_warning("[user] fails to blind [M] with the flash!"), span_warning("You fail to hypno-flash [M]!"))
else
to_chat(M, "<span class='danger'>[src] fails to blind you!</span>")
to_chat(M, span_danger("[src] fails to blind you!"))
else if(M.flash_act())
to_chat(M, "<span class='notice'>Such a pretty light...</span>")
to_chat(M, span_notice("Such a pretty light..."))
M.add_confusion(min(M.get_confusion() + 4, 20))
M.dizziness += min(M.dizziness + 4, 20)
M.drowsyness += min(M.drowsyness + 4, 20)