mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 12:41:09 +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:
@@ -11,7 +11,7 @@
|
||||
/obj/item/implant/abductor/activate()
|
||||
. = ..()
|
||||
if(on_cooldown)
|
||||
to_chat(imp_in, "<span class='warning'>You must wait [timeleft(on_cooldown)*0.1] seconds to use [src] again!</span>")
|
||||
to_chat(imp_in, span_warning("You must wait [timeleft(on_cooldown)*0.1] seconds to use [src] again!"))
|
||||
return
|
||||
|
||||
home.Retrieve(imp_in,1)
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
else
|
||||
injectamount = cause
|
||||
reagents.trans_to(R, injectamount)
|
||||
to_chat(R, "<span class='hear'>You hear a faint beep.</span>")
|
||||
to_chat(R, span_hear("You hear a faint beep."))
|
||||
if(!reagents.total_volume)
|
||||
to_chat(R, "<span class='hear'>You hear a faint click from your chest.</span>")
|
||||
to_chat(R, span_hear("You hear a faint click from your chest."))
|
||||
qdel(src)
|
||||
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
|
||||
// Deliberately the same message framing as nanite message + ghost deathrattle
|
||||
var/mob/living/recipient = implant.imp_in
|
||||
to_chat(recipient, "<i>You hear a strange, robotic voice in your head...</i> \"<span class='robot'><b>[name]</b> has died at <b>[area]</b>.</span>\"")
|
||||
to_chat(recipient, "<i>You hear a strange, robotic voice in your head...</i> \"[span_robot("<b>[name]</b> has died at <b>[area]</b>.")]\"")
|
||||
recipient.playsound_local(get_turf(recipient), sound, vol = 75, vary = FALSE, pressure_affected = FALSE, use_reverb = FALSE)
|
||||
|
||||
/obj/item/implant/deathrattle
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
heavy = round(heavy)
|
||||
medium = round(medium)
|
||||
weak = round(weak)
|
||||
to_chat(imp_in, "<span class='notice'>You activate your [name].</span>")
|
||||
to_chat(imp_in, span_notice("You activate your [name]."))
|
||||
active = TRUE
|
||||
var/turf/boomturf = get_turf(imp_in)
|
||||
message_admins("[ADMIN_LOOKUPFLW(imp_in)] has activated their [name] at [ADMIN_VERBOSEJMP(boomturf)], with cause of [cause].")
|
||||
@@ -74,11 +74,11 @@
|
||||
RegisterSignal(target, COMSIG_LIVING_DEATH, .proc/on_death)
|
||||
|
||||
/obj/item/implant/explosive/proc/timed_explosion()
|
||||
imp_in.visible_message("<span class='warning'>[imp_in] starts beeping ominously!</span>")
|
||||
imp_in.visible_message(span_warning("[imp_in] starts beeping ominously!"))
|
||||
playsound(loc, 'sound/items/timer.ogg', 30, FALSE)
|
||||
sleep(delay*0.25)
|
||||
if(imp_in && !imp_in.stat)
|
||||
imp_in.visible_message("<span class='warning'>[imp_in] doubles over in pain!</span>")
|
||||
imp_in.visible_message(span_warning("[imp_in] doubles over in pain!"))
|
||||
imp_in.Paralyze(140)
|
||||
playsound(loc, 'sound/items/timer.ogg', 30, FALSE)
|
||||
sleep(delay*0.25)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
/obj/item/implant/freedom/activate()
|
||||
. = ..()
|
||||
uses--
|
||||
to_chat(imp_in, "<span class='hear'>You feel a faint click.</span>")
|
||||
to_chat(imp_in, span_hear("You feel a faint click."))
|
||||
if(iscarbon(imp_in))
|
||||
var/mob/living/carbon/C_imp_in = imp_in
|
||||
C_imp_in.uncuff()
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
if(target.mind.has_antag_datum(/datum/antagonist/rev/head)|| target.mind.unconvertable)
|
||||
if(!silent)
|
||||
target.visible_message("<span class='warning'>[target] seems to resist the implant!</span>", "<span class='warning'>You feel something interfering with your mental conditioning, but you resist it!</span>")
|
||||
target.visible_message(span_warning("[target] seems to resist the implant!"), span_warning("You feel something interfering with your mental conditioning, but you resist it!"))
|
||||
removed(target, 1)
|
||||
qdel(src)
|
||||
return TRUE //the implant is still used
|
||||
@@ -40,9 +40,9 @@
|
||||
rev.remove_revolutionary(FALSE, user)
|
||||
if(!silent)
|
||||
if(target.mind.has_antag_datum(/datum/antagonist/cult))
|
||||
to_chat(target, "<span class='warning'>You feel something interfering with your mental conditioning, but you resist it!</span>")
|
||||
to_chat(target, span_warning("You feel something interfering with your mental conditioning, but you resist it!"))
|
||||
else
|
||||
to_chat(target, "<span class='notice'>You feel a sense of peace and security. You are now protected from brainwashing.</span>")
|
||||
to_chat(target, span_notice("You feel a sense of peace and security. You are now protected from brainwashing."))
|
||||
ADD_TRAIT(target, TRAIT_MINDSHIELD, IMPLANT_TRAIT)
|
||||
target.sec_hud_set_implants()
|
||||
if(deconverted)
|
||||
@@ -58,7 +58,7 @@
|
||||
REMOVE_TRAIT(L, TRAIT_MINDSHIELD, IMPLANT_TRAIT)
|
||||
L.sec_hud_set_implants()
|
||||
if(target.stat != DEAD && !silent)
|
||||
to_chat(target, "<span class='boldnotice'>Your mind suddenly feels terribly vulnerable. You are no longer safe from brainwashing.</span>")
|
||||
to_chat(target, span_boldnotice("Your mind suddenly feels terribly vulnerable. You are no longer safe from brainwashing."))
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
if (.)
|
||||
target.RemoveSpell(spell)
|
||||
if(target.stat != DEAD && !silent)
|
||||
to_chat(target, "<span class='boldnotice'>The knowledge of how to cast [spell] slips out from your mind.</span>")
|
||||
to_chat(target, span_boldnotice("The knowledge of how to cast [spell] slips out from your mind."))
|
||||
|
||||
/obj/item/implanter/spell
|
||||
name = "implanter (spell)"
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
for (var/obj/item/I in lostimplant.contents())
|
||||
I.add_mob_blood(implantee)
|
||||
lostimplant.do_quick_empty()
|
||||
implantee.visible_message("<span class='warning'>A bluespace pocket opens around [src] as it exits [implantee], spewing out its contents and rupturing the surrounding tissue!</span>")
|
||||
implantee.visible_message(span_warning("A bluespace pocket opens around [src] as it exits [implantee], spewing out its contents and rupturing the surrounding tissue!"))
|
||||
implantee.apply_damage(20, BRUTE, BODY_ZONE_CHEST)
|
||||
qdel(lostimplant)
|
||||
return ..()
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
/obj/item/implantcase/attackby(obj/item/W, mob/user, params)
|
||||
if(istype(W, /obj/item/pen))
|
||||
if(!user.is_literate())
|
||||
to_chat(user, "<span class='notice'>You scribble illegibly on the side of [src]!</span>")
|
||||
to_chat(user, span_notice("You scribble illegibly on the side of [src]!"))
|
||||
return
|
||||
var/t = stripped_input(user, "What would you like the label to be?", name, null)
|
||||
if(user.get_active_held_item() != W)
|
||||
|
||||
@@ -91,12 +91,12 @@
|
||||
if(istype(I, /obj/item/implant))
|
||||
var/obj/item/implant/P = I
|
||||
if(P.implant(M))
|
||||
visible_message("<span class='warning'>[M] is implanted by [src].</span>")
|
||||
visible_message(span_warning("[M] is implanted by [src]."))
|
||||
return TRUE
|
||||
else if(istype(I, /obj/item/organ))
|
||||
var/obj/item/organ/P = I
|
||||
P.Insert(M, FALSE, FALSE)
|
||||
visible_message("<span class='warning'>[M] is implanted by [src].</span>")
|
||||
visible_message(span_warning("[M] is implanted by [src]."))
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/implantchair/update_icon_state()
|
||||
@@ -127,20 +127,20 @@
|
||||
/obj/machinery/implantchair/container_resist_act(mob/living/user)
|
||||
user.changeNext_move(CLICK_CD_BREAKOUT)
|
||||
user.last_special = world.time + CLICK_CD_BREAKOUT
|
||||
user.visible_message("<span class='notice'>You see [user] kicking against the door of [src]!</span>", \
|
||||
"<span class='notice'>You lean on the back of [src] and start pushing the door open... (this will take about [DisplayTimeText(breakout_time)].)</span>", \
|
||||
"<span class='hear'>You hear a metallic creaking from [src].</span>")
|
||||
user.visible_message(span_notice("You see [user] kicking against the door of [src]!"), \
|
||||
span_notice("You lean on the back of [src] and start pushing the door open... (this will take about [DisplayTimeText(breakout_time)].)"), \
|
||||
span_hear("You hear a metallic creaking from [src]."))
|
||||
if(do_after(user,(breakout_time), target = src))
|
||||
if(!user || user.stat != CONSCIOUS || user.loc != src || state_open)
|
||||
return
|
||||
user.visible_message("<span class='warning'>[user] successfully broke out of [src]!</span>", \
|
||||
"<span class='notice'>You successfully break out of [src]!</span>")
|
||||
user.visible_message(span_warning("[user] successfully broke out of [src]!"), \
|
||||
span_notice("You successfully break out of [src]!"))
|
||||
open_machine()
|
||||
|
||||
/obj/machinery/implantchair/relaymove(mob/living/user, direction)
|
||||
if(message_cooldown <= world.time)
|
||||
message_cooldown = world.time + 50
|
||||
to_chat(user, "<span class='warning'>[src]'s door won't budge!</span>")
|
||||
to_chat(user, span_warning("[src]'s door won't budge!"))
|
||||
|
||||
|
||||
/obj/machinery/implantchair/MouseDrop_T(mob/target, mob/user)
|
||||
|
||||
@@ -24,25 +24,25 @@
|
||||
return
|
||||
if(user && imp)
|
||||
if(M != user)
|
||||
M.visible_message("<span class='warning'>[user] is attempting to implant [M].</span>")
|
||||
M.visible_message(span_warning("[user] is attempting to implant [M]."))
|
||||
|
||||
var/turf/T = get_turf(M)
|
||||
if(T && (M == user || do_mob(user, M, 50)))
|
||||
if(src && imp)
|
||||
if(imp.implant(M, user))
|
||||
if (M == user)
|
||||
to_chat(user, "<span class='notice'>You implant yourself.</span>")
|
||||
to_chat(user, span_notice("You implant yourself."))
|
||||
else
|
||||
M.visible_message("<span class='notice'>[user] implants [M].</span>", "<span class='notice'>[user] implants you.</span>")
|
||||
M.visible_message(span_notice("[user] implants [M]."), span_notice("[user] implants you."))
|
||||
imp = null
|
||||
update_appearance()
|
||||
else
|
||||
to_chat(user, "<span class='warning'>[src] fails to implant [M].</span>")
|
||||
to_chat(user, span_warning("[src] fails to implant [M]."))
|
||||
|
||||
/obj/item/implanter/attackby(obj/item/W, mob/user, params)
|
||||
if(istype(W, /obj/item/pen))
|
||||
if(!user.is_literate())
|
||||
to_chat(user, "<span class='notice'>You prod at [src] with [W]!</span>")
|
||||
to_chat(user, span_notice("You prod at [src] with [W]!"))
|
||||
return
|
||||
var/t = stripped_input(user, "What would you like the label to be?", name, null)
|
||||
if(user.get_active_held_item() != W)
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
if(Adjacent(user))
|
||||
. += "It [case ? "contains \a [case]" : "is currently empty"]."
|
||||
if(case)
|
||||
. += "<span class='info'>Alt-click to remove [case].</span>"
|
||||
. += span_info("Alt-click to remove [case].")
|
||||
else
|
||||
if(case)
|
||||
. += "<span class='warning'>There seems to be something inside it, but you can't quite tell what from here...</span>"
|
||||
. += span_warning("There seems to be something inside it, but you can't quite tell what from here...")
|
||||
|
||||
/obj/item/implantpad/handle_atom_del(atom/A)
|
||||
if(A == case)
|
||||
@@ -37,7 +37,7 @@
|
||||
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
|
||||
return
|
||||
if(!case)
|
||||
to_chat(user, "<span class='warning'>There's no implant to remove from [src].</span>")
|
||||
to_chat(user, span_warning("There's no implant to remove from [src]."))
|
||||
return
|
||||
|
||||
user.put_in_hands(case)
|
||||
|
||||
Reference in New Issue
Block a user