mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 06:29:23 +01:00
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:
@@ -23,7 +23,7 @@
|
||||
var/force_opens = FALSE
|
||||
|
||||
/obj/item/crowbar/suicide_act(mob/user)
|
||||
user.visible_message("<span class='suicide'>[user] is beating [user.p_them()]self to death with [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
user.visible_message(span_suicide("[user] is beating [user.p_them()]self to death with [src]! It looks like [user.p_theyre()] trying to commit suicide!"))
|
||||
playsound(loc, 'sound/weapons/genhit.ogg', 50, TRUE, -1)
|
||||
return (BRUTELOSS)
|
||||
|
||||
@@ -86,10 +86,10 @@
|
||||
|
||||
/obj/item/crowbar/power/suicide_act(mob/user)
|
||||
if(tool_behaviour == TOOL_CROWBAR)
|
||||
user.visible_message("<span class='suicide'>[user] is putting [user.p_their()] head in [src], it looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
user.visible_message(span_suicide("[user] is putting [user.p_their()] head in [src], it looks like [user.p_theyre()] trying to commit suicide!"))
|
||||
playsound(loc, 'sound/items/jaws_pry.ogg', 50, TRUE, -1)
|
||||
else
|
||||
user.visible_message("<span class='suicide'>[user] is wrapping \the [src] around [user.p_their()] neck. It looks like [user.p_theyre()] trying to rip [user.p_their()] head off!</span>")
|
||||
user.visible_message(span_suicide("[user] is wrapping \the [src] around [user.p_their()] neck. It looks like [user.p_theyre()] trying to rip [user.p_their()] head off!"))
|
||||
playsound(loc, 'sound/items/jaws_cut.ogg', 50, TRUE, -1)
|
||||
if(iscarbon(user))
|
||||
var/mob/living/carbon/C = user
|
||||
@@ -103,13 +103,13 @@
|
||||
playsound(get_turf(user), 'sound/items/change_jaws.ogg', 50, TRUE)
|
||||
if(tool_behaviour == TOOL_CROWBAR)
|
||||
tool_behaviour = TOOL_WIRECUTTER
|
||||
to_chat(user, "<span class='notice'>You attach the cutting jaws to [src].</span>")
|
||||
to_chat(user, span_notice("You attach the cutting jaws to [src]."))
|
||||
usesound = 'sound/items/jaws_cut.ogg'
|
||||
update_appearance()
|
||||
|
||||
else
|
||||
tool_behaviour = TOOL_CROWBAR
|
||||
to_chat(user, "<span class='notice'>You attach the prying jaws to [src].</span>")
|
||||
to_chat(user, span_notice("You attach the prying jaws to [src]."))
|
||||
usesound = 'sound/items/jaws_pry.ogg'
|
||||
update_appearance()
|
||||
|
||||
@@ -129,13 +129,13 @@
|
||||
|
||||
/obj/item/crowbar/power/attack(mob/living/carbon/C, mob/user)
|
||||
if(istype(C) && C.handcuffed && tool_behaviour == TOOL_WIRECUTTER)
|
||||
user.visible_message("<span class='notice'>[user] cuts [C]'s restraints with [src]!</span>")
|
||||
user.visible_message(span_notice("[user] cuts [C]'s restraints with [src]!"))
|
||||
qdel(C.handcuffed)
|
||||
return
|
||||
else if(istype(C) && C.has_status_effect(STATUS_EFFECT_CHOKINGSTRAND) && tool_behaviour == TOOL_WIRECUTTER)
|
||||
user.visible_message("<span class='notice'>[user] attempts to cut the durathread strand from around [C]'s neck.</span>")
|
||||
user.visible_message(span_notice("[user] attempts to cut the durathread strand from around [C]'s neck."))
|
||||
if(do_after(user, 1.5 SECONDS, C))
|
||||
user.visible_message("<span class='notice'>[user] succesfully cuts the durathread strand from around [C]'s neck.</span>")
|
||||
user.visible_message(span_notice("[user] succesfully cuts the durathread strand from around [C]'s neck."))
|
||||
C.remove_status_effect(STATUS_EFFECT_CHOKINGSTRAND)
|
||||
playsound(loc, usesound, 50, TRUE, -1)
|
||||
return
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
)
|
||||
|
||||
/obj/item/screwdriver/suicide_act(mob/user)
|
||||
user.visible_message("<span class='suicide'>[user] is stabbing [src] into [user.p_their()] [pick("temple", "heart")]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
user.visible_message(span_suicide("[user] is stabbing [src] into [user.p_their()] [pick("temple", "heart")]! It looks like [user.p_theyre()] trying to commit suicide!"))
|
||||
return(BRUTELOSS)
|
||||
|
||||
/obj/item/screwdriver/Initialize()
|
||||
@@ -98,9 +98,9 @@
|
||||
|
||||
/obj/item/screwdriver/power/suicide_act(mob/user)
|
||||
if(tool_behaviour == TOOL_SCREWDRIVER)
|
||||
user.visible_message("<span class='suicide'>[user] is putting [src] to [user.p_their()] temple. It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
user.visible_message(span_suicide("[user] is putting [src] to [user.p_their()] temple. It looks like [user.p_theyre()] trying to commit suicide!"))
|
||||
else
|
||||
user.visible_message("<span class='suicide'>[user] is pressing [src] against [user.p_their()] head! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
user.visible_message(span_suicide("[user] is pressing [src] against [user.p_their()] head! It looks like [user.p_theyre()] trying to commit suicide!"))
|
||||
playsound(loc, 'sound/items/drill_use.ogg', 50, TRUE, -1)
|
||||
return(BRUTELOSS)
|
||||
|
||||
@@ -108,11 +108,11 @@
|
||||
playsound(get_turf(user), 'sound/items/change_drill.ogg', 50, TRUE)
|
||||
if(tool_behaviour == TOOL_SCREWDRIVER)
|
||||
tool_behaviour = TOOL_WRENCH
|
||||
to_chat(user, "<span class='notice'>You attach the bolt bit to [src].</span>")
|
||||
to_chat(user, span_notice("You attach the bolt bit to [src]."))
|
||||
icon_state = "drill_bolt"
|
||||
else
|
||||
tool_behaviour = TOOL_SCREWDRIVER
|
||||
to_chat(user, "<span class='notice'>You attach the screw bit to [src].</span>")
|
||||
to_chat(user, span_notice("You attach the screw bit to [src]."))
|
||||
icon_state = "drill_screw"
|
||||
|
||||
/obj/item/screwdriver/cyborg
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
|
||||
|
||||
/obj/item/weldingtool/suicide_act(mob/user)
|
||||
user.visible_message("<span class='suicide'>[user] welds [user.p_their()] every orifice closed! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
user.visible_message(span_suicide("[user] welds [user.p_their()] every orifice closed! It looks like [user.p_theyre()] trying to commit suicide!"))
|
||||
return (FIRELOSS)
|
||||
|
||||
|
||||
@@ -122,8 +122,8 @@
|
||||
if(affecting && affecting.status == BODYPART_ROBOTIC && !user.combat_mode)
|
||||
if(src.use_tool(H, user, 0, volume=50, amount=1))
|
||||
if(user == H)
|
||||
user.visible_message("<span class='notice'>[user] starts to fix some of the dents on [H]'s [affecting.name].</span>",
|
||||
"<span class='notice'>You start fixing some of the dents on [H == user ? "your" : "[H]'s"] [affecting.name].</span>")
|
||||
user.visible_message(span_notice("[user] starts to fix some of the dents on [H]'s [affecting.name]."),
|
||||
span_notice("You start fixing some of the dents on [H == user ? "your" : "[H]'s"] [affecting.name]."))
|
||||
if(!do_mob(user, H, 50))
|
||||
return
|
||||
item_heal_robotic(H, user, 15, 0)
|
||||
@@ -146,7 +146,7 @@
|
||||
|
||||
if(!status && O.is_refillable())
|
||||
reagents.trans_to(O, reagents.total_volume, transfered_by = user)
|
||||
to_chat(user, "<span class='notice'>You empty [src]'s fuel tank into [O].</span>")
|
||||
to_chat(user, span_notice("You empty [src]'s fuel tank into [O]."))
|
||||
update_appearance()
|
||||
|
||||
/obj/item/weldingtool/attack_qdeleted(atom/O, mob/user, proximity)
|
||||
@@ -221,12 +221,12 @@
|
||||
//Switches the welder on
|
||||
/obj/item/weldingtool/proc/switched_on(mob/user)
|
||||
if(!status)
|
||||
to_chat(user, "<span class='warning'>[src] can't be turned on while unsecured!</span>")
|
||||
to_chat(user, span_warning("[src] can't be turned on while unsecured!"))
|
||||
return
|
||||
set_welding(!welding)
|
||||
if(welding)
|
||||
if(get_fuel() >= 1)
|
||||
to_chat(user, "<span class='notice'>You switch [src] on.</span>")
|
||||
to_chat(user, span_notice("You switch [src] on."))
|
||||
playsound(loc, acti_sound, 50, TRUE)
|
||||
force = 15
|
||||
damtype = BURN
|
||||
@@ -234,10 +234,10 @@
|
||||
update_appearance()
|
||||
START_PROCESSING(SSobj, src)
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need more fuel!</span>")
|
||||
to_chat(user, span_warning("You need more fuel!"))
|
||||
switched_off(user)
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You switch [src] off.</span>")
|
||||
to_chat(user, span_notice("You switch [src] off."))
|
||||
playsound(loc, deac_sound, 50, TRUE)
|
||||
switched_off(user)
|
||||
|
||||
@@ -265,26 +265,26 @@
|
||||
// If welding tool ran out of fuel during a construction task, construction fails.
|
||||
/obj/item/weldingtool/tool_use_check(mob/living/user, amount)
|
||||
if(!isOn() || !check_fuel())
|
||||
to_chat(user, "<span class='warning'>[src] has to be on to complete this task!</span>")
|
||||
to_chat(user, span_warning("[src] has to be on to complete this task!"))
|
||||
return FALSE
|
||||
|
||||
if(get_fuel() >= amount)
|
||||
return TRUE
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need more welding fuel to complete this task!</span>")
|
||||
to_chat(user, span_warning("You need more welding fuel to complete this task!"))
|
||||
return FALSE
|
||||
|
||||
|
||||
/obj/item/weldingtool/proc/flamethrower_screwdriver(obj/item/I, mob/user)
|
||||
if(welding)
|
||||
to_chat(user, "<span class='warning'>Turn it off first!</span>")
|
||||
to_chat(user, span_warning("Turn it off first!"))
|
||||
return
|
||||
status = !status
|
||||
if(status)
|
||||
to_chat(user, "<span class='notice'>You resecure [src] and close the fuel tank.</span>")
|
||||
to_chat(user, span_notice("You resecure [src] and close the fuel tank."))
|
||||
reagents.flags &= ~(OPENCONTAINER)
|
||||
else
|
||||
to_chat(user, "<span class='notice'>[src] can now be attached, modified, and refuelled.</span>")
|
||||
to_chat(user, span_notice("[src] can now be attached, modified, and refuelled."))
|
||||
reagents.flags |= OPENCONTAINER
|
||||
add_fingerprint(user)
|
||||
|
||||
@@ -297,14 +297,14 @@
|
||||
user.transferItemToLoc(src, F, TRUE)
|
||||
F.weldtool = src
|
||||
add_fingerprint(user)
|
||||
to_chat(user, "<span class='notice'>You add a rod to a welder, starting to build a flamethrower.</span>")
|
||||
to_chat(user, span_notice("You add a rod to a welder, starting to build a flamethrower."))
|
||||
user.put_in_hands(F)
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need one rod to start building a flamethrower!</span>")
|
||||
to_chat(user, span_warning("You need one rod to start building a flamethrower!"))
|
||||
|
||||
/obj/item/weldingtool/ignition_effect(atom/A, mob/user)
|
||||
if(use_tool(A, user, 0, amount=1))
|
||||
return "<span class='notice'>[user] casually lights [A] with [src], what a badass.</span>"
|
||||
return span_notice("[user] casually lights [A] with [src], what a badass.")
|
||||
else
|
||||
return ""
|
||||
|
||||
|
||||
@@ -46,13 +46,13 @@
|
||||
|
||||
/obj/item/wirecutters/attack(mob/living/carbon/C, mob/user)
|
||||
if(istype(C) && C.handcuffed && istype(C.handcuffed, /obj/item/restraints/handcuffs/cable))
|
||||
user.visible_message("<span class='notice'>[user] cuts [C]'s restraints with [src]!</span>")
|
||||
user.visible_message(span_notice("[user] cuts [C]'s restraints with [src]!"))
|
||||
qdel(C.handcuffed)
|
||||
return
|
||||
else if(istype(C) && C.has_status_effect(STATUS_EFFECT_CHOKINGSTRAND))
|
||||
user.visible_message("<span class='notice'>[user] attempts to cut the durathread strand from around [C]'s neck.</span>")
|
||||
user.visible_message(span_notice("[user] attempts to cut the durathread strand from around [C]'s neck."))
|
||||
if(do_after(user, 1.5 SECONDS, C))
|
||||
user.visible_message("<span class='notice'>[user] succesfully cuts the durathread strand from around [C]'s neck.</span>")
|
||||
user.visible_message(span_notice("[user] succesfully cuts the durathread strand from around [C]'s neck."))
|
||||
C.remove_status_effect(STATUS_EFFECT_CHOKINGSTRAND)
|
||||
playsound(loc, usesound, 50, TRUE, -1)
|
||||
return
|
||||
@@ -60,7 +60,7 @@
|
||||
..()
|
||||
|
||||
/obj/item/wirecutters/suicide_act(mob/user)
|
||||
user.visible_message("<span class='suicide'>[user] is cutting at [user.p_their()] arteries with [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
user.visible_message(span_suicide("[user] is cutting at [user.p_their()] arteries with [src]! It looks like [user.p_theyre()] trying to commit suicide!"))
|
||||
playsound(loc, usesound, 50, TRUE, -1)
|
||||
return (BRUTELOSS)
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 0, RAD = 0, FIRE = 50, ACID = 30)
|
||||
|
||||
/obj/item/wrench/suicide_act(mob/user)
|
||||
user.visible_message("<span class='suicide'>[user] is beating [user.p_them()]self to death with [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
user.visible_message(span_suicide("[user] is beating [user.p_them()]self to death with [src]! It looks like [user.p_theyre()] trying to commit suicide!"))
|
||||
playsound(loc, 'sound/weapons/genhit.ogg', 50, TRUE, -1)
|
||||
return (BRUTELOSS)
|
||||
|
||||
@@ -50,10 +50,10 @@
|
||||
/obj/item/wrench/medical/examine(mob/user)
|
||||
. = ..()
|
||||
if(suicider)
|
||||
. += "<span class='notice'>For some reason, it reminds you of [suicider].</span>"
|
||||
. += span_notice("For some reason, it reminds you of [suicider].")
|
||||
|
||||
/obj/item/wrench/medical/suicide_act(mob/living/user)
|
||||
user.visible_message("<span class='suicide'>[user] is praying to the medical wrench to take [user.p_their()] soul. It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
user.visible_message(span_suicide("[user] is praying to the medical wrench to take [user.p_their()] soul. It looks like [user.p_theyre()] trying to commit suicide!"))
|
||||
user.Stun(100, ignore_canstun = TRUE)// Stun stops them from wandering off
|
||||
user.set_light_color(COLOR_VERY_SOFT_YELLOW)
|
||||
user.set_light(2)
|
||||
@@ -102,7 +102,7 @@
|
||||
tool_behaviour = initial(tool_behaviour)
|
||||
toolspeed = initial(toolspeed)
|
||||
playsound(user, 'sound/weapons/saberoff.ogg', 5, TRUE)
|
||||
to_chat(user, "<span class='warning'>[src] can now be kept at bay.</span>")
|
||||
to_chat(user, span_warning("[src] can now be kept at bay."))
|
||||
else
|
||||
on = TRUE
|
||||
force = 6
|
||||
@@ -111,7 +111,7 @@
|
||||
tool_behaviour = TOOL_WRENCH
|
||||
toolspeed = 1
|
||||
playsound(user, 'sound/weapons/saberon.ogg', 5, TRUE)
|
||||
to_chat(user, "<span class='warning'>[src] is now active. Woe onto your enemies!</span>")
|
||||
to_chat(user, span_warning("[src] is now active. Woe onto your enemies!"))
|
||||
update_appearance()
|
||||
|
||||
/obj/item/wrench/combat/update_icon_state()
|
||||
|
||||
Reference in New Issue
Block a user