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
@@ -12,7 +12,7 @@
/datum/smite/berforate/effect(client/user, mob/living/target)
. = ..()
if (!iscarbon(target))
to_chat(user, "<span class='warning'>This must be used on a carbon mob.</span>", confidential = TRUE)
to_chat(user, span_warning("This must be used on a carbon mob."), confidential = TRUE)
return
var/repetitions
+1 -1
View File
@@ -5,7 +5,7 @@
/datum/smite/bloodless/effect(client/user, mob/living/target)
. = ..()
if (!iscarbon(target))
to_chat(user, "<span class='warning'>This must be used on a carbon mob.</span>", confidential = TRUE)
to_chat(user, span_warning("This must be used on a carbon mob."), confidential = TRUE)
return
var/mob/living/carbon/carbon_target = target
for(var/_limb in carbon_target.bodyparts)
+1 -1
View File
@@ -6,7 +6,7 @@
. = ..()
if (!iscarbon(target))
to_chat(user, "<span class='warning'>This must be used on a carbon mob.</span>", confidential = TRUE)
to_chat(user, span_warning("This must be used on a carbon mob."), confidential = TRUE)
return
var/mob/living/carbon/carbon_target = target
+5 -5
View File
@@ -5,24 +5,24 @@
/datum/smite/dock_pay/effect(client/user, mob/living/target)
. = ..()
if (!iscarbon(target))
to_chat(user, "<span class='warning'>This must be used on a carbon mob.</span>", confidential = TRUE)
to_chat(user, span_warning("This must be used on a carbon mob."), confidential = TRUE)
return
var/mob/living/carbon/dude = target
var/obj/item/card/id/card = dude.get_idcard(TRUE)
if (!card)
to_chat(user, "<span class='warning'>[dude] does not have an ID card on!</span>", confidential = TRUE)
to_chat(user, span_warning("[dude] does not have an ID card on!"), confidential = TRUE)
return
if (!card.registered_account)
to_chat(user, "<span class='warning'>[dude] does not have an ID card with an account!</span>", confidential = TRUE)
to_chat(user, span_warning("[dude] does not have an ID card with an account!"), confidential = TRUE)
return
if (card.registered_account.account_balance == 0)
to_chat(user, "<span class='warning'>ID Card lacks any funds. No pay to dock.</span>")
to_chat(user, span_warning("ID Card lacks any funds. No pay to dock."))
return
var/new_cost = input("How much pay are we docking? Current balance: [card.registered_account.account_balance] credits.", "BUDGET CUTS") as num|null
if (!new_cost)
return
if (!(card.registered_account.has_money(new_cost)))
to_chat(user, "<span class='warning'>ID Card lacked funds. Emptying account.</span>")
to_chat(user, span_warning("ID Card lacked funds. Emptying account."))
card.registered_account.bank_card_talk("[new_cost] credits deducted from your account based on performance review.")
card.registered_account.account_balance = 0
else
+2 -2
View File
@@ -5,11 +5,11 @@
/datum/smite/knot_shoes/effect(client/user, mob/living/target)
. = ..()
if (!iscarbon(target))
to_chat(user, "<span class='warning'>This must be used on a carbon mob.</span>", confidential = TRUE)
to_chat(user, span_warning("This must be used on a carbon mob."), confidential = TRUE)
return
var/mob/living/carbon/dude = target
var/obj/item/clothing/shoes/sick_kicks = dude.shoes
if (!sick_kicks?.can_be_tied)
to_chat(user, "<span class='warning'>[dude] does not have knottable shoes!</span>", confidential = TRUE)
to_chat(user, span_warning("[dude] does not have knottable shoes!"), confidential = TRUE)
return
sick_kicks.adjust_laces(SHOES_KNOTTED)
+1 -1
View File
@@ -11,4 +11,4 @@
if(ishuman(target))
var/mob/living/carbon/human/human_target = target
human_target.electrocution_animation(LIGHTNING_BOLT_ELECTROCUTION_ANIMATION_LENGTH)
to_chat(target, "<span class='userdanger'>The gods have punished you for your sins!</span>", confidential = TRUE)
to_chat(target, span_userdanger("The gods have punished you for your sins!"), confidential = TRUE)
+1 -1
View File
@@ -6,7 +6,7 @@
. = ..()
if (!iscarbon(target))
to_chat(user, "<span class='warning'>This must be used on a carbon mob.</span>", confidential = TRUE)
to_chat(user, span_warning("This must be used on a carbon mob."), confidential = TRUE)
return
var/mob/living/carbon/carbon_target = target
+1 -1
View File
@@ -5,4 +5,4 @@
/datum/smite/puzzle/effect(client/user, mob/living/target)
. = ..()
if(!puzzle_imprison(target))
to_chat(user, "<span class='warning'>Imprisonment failed!</span>", confidential = TRUE)
to_chat(user, span_warning("Imprisonment failed!"), confidential = TRUE)
+2 -2
View File
@@ -5,8 +5,8 @@
/datum/smite/scarify/effect(client/user, mob/living/target)
. = ..()
if(!iscarbon(target))
to_chat(user, "<span class='warning'>This must be used on a carbon mob.</span>", confidential = TRUE)
to_chat(user, span_warning("This must be used on a carbon mob."), confidential = TRUE)
return
var/mob/living/carbon/dude = target
dude.generate_fake_scars(rand(1, 4))
to_chat(dude, "<span class='warning'>You feel your body grow jaded and torn...</span>")
to_chat(dude, span_warning("You feel your body grow jaded and torn..."))