mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 20:48:56 +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:
@@ -38,7 +38,7 @@
|
||||
var/price = I.price + shipping[method]
|
||||
// I can't get the price of the item and shipping in a clean way to the UI, so I have to do this.
|
||||
if(uplink.money < price)
|
||||
to_chat("<span class='warning'>You don't have enough credits in [uplink] for [I] with [method] shipping.</span>")
|
||||
to_chat(span_warning("You don't have enough credits in [uplink] for [I] with [method] shipping."))
|
||||
return FALSE
|
||||
|
||||
if(I.buy(uplink, user, method))
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
if(istype(I, /obj/item/holochip) || istype(I, /obj/item/stack/spacecash) || istype(I, /obj/item/coin))
|
||||
var/worth = I.get_item_credit_value()
|
||||
if(!worth)
|
||||
to_chat(user, "<span class='warning'>[I] doesn't seem to be worth anything!</span>")
|
||||
to_chat(user, span_warning("[I] doesn't seem to be worth anything!"))
|
||||
money += worth
|
||||
to_chat(user, "<span class='notice'>You slot [I] into [src] and it reports a total of [money] credits inserted.</span>")
|
||||
to_chat(user, span_notice("You slot [I] into [src] and it reports a total of [money] credits inserted."))
|
||||
qdel(I)
|
||||
return
|
||||
. = ..()
|
||||
@@ -44,14 +44,14 @@
|
||||
if(!amount_to_remove || amount_to_remove < 0)
|
||||
return
|
||||
if(amount_to_remove > money)
|
||||
to_chat(user, "<span class='warning'>There is only [money] credits in [src]</span>")
|
||||
to_chat(user, span_warning("There is only [money] credits in [src]"))
|
||||
return
|
||||
|
||||
var/obj/item/holochip/holochip = new (user.drop_location(), amount_to_remove)
|
||||
money -= amount_to_remove
|
||||
holochip.name = "washed " + holochip.name
|
||||
user.put_in_hands(holochip)
|
||||
to_chat(user, "<span class='notice'>You withdraw [amount_to_remove] credits into a holochip.</span>")
|
||||
to_chat(user, span_notice("You withdraw [amount_to_remove] credits into a holochip."))
|
||||
|
||||
/obj/item/blackmarket_uplink/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
desc = "The small text reads, 'You will be slaughtered'... That doesn't sound right, does it?"
|
||||
if(ismob(loc))
|
||||
var/mob/M = loc
|
||||
to_chat(M, "<span class='warning'>The coupon reads '<b>fuck you</b>' in large, bold text... is- is that a prize, or?</span>")
|
||||
to_chat(M, span_warning("The coupon reads '<b>fuck you</b>' in large, bold text... is- is that a prize, or?"))
|
||||
M.AddComponent(/datum/component/omen, TRUE, src)
|
||||
else
|
||||
discount_pct_off = text2num(discount_pct_off)
|
||||
@@ -34,7 +34,7 @@
|
||||
if(!istype(O, /obj/machinery/computer/cargo))
|
||||
return ..()
|
||||
if(discount_pct_off == COUPON_OMEN)
|
||||
to_chat(user, "<span class='warning'>\The [O] validates the coupon as authentic, but refuses to accept it...</span>")
|
||||
to_chat(user, span_warning("\The [O] validates the coupon as authentic, but refuses to accept it..."))
|
||||
O.say("Coupon fulfillment already in progress...")
|
||||
return
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
for(var/x in ex.total_amount)
|
||||
price += ex.total_value[x]
|
||||
if(price)
|
||||
to_chat(user, "<span class='notice'>Scanned [O], value: <b>[price]</b> credits[O.contents.len ? " (contents included)" : ""].</span>")
|
||||
to_chat(user, span_notice("Scanned [O], value: <b>[price]</b> credits[O.contents.len ? " (contents included)" : ""]."))
|
||||
else
|
||||
to_chat(user, "<span class='warning'>Scanned [O], no export value.</span>")
|
||||
to_chat(user, span_warning("Scanned [O], no export value."))
|
||||
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/scan_human = user
|
||||
@@ -31,10 +31,10 @@
|
||||
var/obj/item/bounty_cube/cube = O
|
||||
|
||||
if(!istype(get_area(cube), /area/shuttle/supply))
|
||||
to_chat(user, "<span class='warning'>Shuttle placement not detected. Handling tip not registered.</span>")
|
||||
to_chat(user, span_warning("Shuttle placement not detected. Handling tip not registered."))
|
||||
|
||||
else if(cube.bounty_handler_account)
|
||||
to_chat(user, "<span class='warning'>Bank account for handling tip already registered!</span>")
|
||||
to_chat(user, span_warning("Bank account for handling tip already registered!"))
|
||||
|
||||
else if(scan_human.get_bank_account() && cube.GetComponent(/datum/component/pricetag))
|
||||
var/datum/component/pricetag/pricetag = cube.GetComponent(/datum/component/pricetag)
|
||||
@@ -48,4 +48,4 @@
|
||||
cube.bounty_holder_account.bank_card_talk("<b>[cube]</b> was scanned in \the <b>[get_area(cube)]</b> by <b>[scan_human] ([scan_human.job])</b>.")
|
||||
|
||||
else
|
||||
to_chat(user, "<span class='warning'>Bank account not detected. Handling tip not registered.</span>")
|
||||
to_chat(user, span_warning("Bank account not detected. Handling tip not registered."))
|
||||
|
||||
@@ -43,11 +43,11 @@
|
||||
/obj/machinery/computer/cargo/express/attackby(obj/item/W, mob/living/user, params)
|
||||
if(W.GetID() && allowed(user))
|
||||
locked = !locked
|
||||
to_chat(user, "<span class='notice'>You [locked ? "lock" : "unlock"] the interface.</span>")
|
||||
to_chat(user, span_notice("You [locked ? "lock" : "unlock"] the interface."))
|
||||
return
|
||||
else if(istype(W, /obj/item/disk/cargo/bluespace_pod))
|
||||
podType = /obj/structure/closet/supplypod/bluespacepod//doesnt effect circuit board, making reversal possible
|
||||
to_chat(user, "<span class='notice'>You insert the disk into [src], allowing for advanced supply delivery vehicles.</span>")
|
||||
to_chat(user, span_notice("You insert the disk into [src], allowing for advanced supply delivery vehicles."))
|
||||
qdel(W)
|
||||
return TRUE
|
||||
else if(istype(W, /obj/item/supplypod_beacon))
|
||||
@@ -56,15 +56,15 @@
|
||||
sb.link_console(src, user)
|
||||
return TRUE
|
||||
else
|
||||
to_chat(user, "<span class='alert'>[src] is already linked to [sb].</span>")
|
||||
to_chat(user, span_alert("[src] is already linked to [sb]."))
|
||||
..()
|
||||
|
||||
/obj/machinery/computer/cargo/express/emag_act(mob/living/user)
|
||||
if(obj_flags & EMAGGED)
|
||||
return
|
||||
if(user)
|
||||
user.visible_message("<span class='warning'>[user] swipes a suspicious card through [src]!</span>",
|
||||
"<span class='notice'>You change the routing protocols, allowing the Supply Pod to land anywhere on the station.</span>")
|
||||
user.visible_message(span_warning("[user] swipes a suspicious card through [src]!"),
|
||||
span_notice("You change the routing protocols, allowing the Supply Pod to land anywhere on the station."))
|
||||
obj_flags |= EMAGGED
|
||||
contraband = TRUE
|
||||
// This also sets this on the circuit board
|
||||
|
||||
@@ -49,9 +49,9 @@
|
||||
/mob/living/simple_animal/pet/gondola/gondolapod/examine(mob/user)
|
||||
. = ..()
|
||||
if (contents.len)
|
||||
. += "<span class='notice'>It looks like it hasn't made its delivery yet.</b></span>"
|
||||
. += span_notice("It looks like it hasn't made its delivery yet.</b>")
|
||||
else
|
||||
. += "<span class='notice'>It looks like it has already made its delivery.</b></span>"
|
||||
. += span_notice("It looks like it has already made its delivery.</b>")
|
||||
|
||||
/mob/living/simple_animal/pet/gondola/gondolapod/verb/check()
|
||||
set name = "Count Contents"
|
||||
@@ -59,9 +59,9 @@
|
||||
set desc = "Take a deep look inside youself, and count up what's inside"
|
||||
var/total = contents.len
|
||||
if (total)
|
||||
to_chat(src, "<span class='notice'>You detect [total] object\s within your incredibly vast belly.</span>")
|
||||
to_chat(src, span_notice("You detect [total] object\s within your incredibly vast belly."))
|
||||
else
|
||||
to_chat(src, "<span class='notice'>A closer look inside yourself reveals... nothing.</span>")
|
||||
to_chat(src, span_notice("A closer look inside yourself reveals... nothing."))
|
||||
|
||||
/mob/living/simple_animal/pet/gondola/gondolapod/setOpened()
|
||||
opened = TRUE
|
||||
|
||||
@@ -72,8 +72,8 @@
|
||||
if(obj_flags & EMAGGED)
|
||||
return
|
||||
if(user)
|
||||
user.visible_message("<span class='warning'>[user] swipes a suspicious card through [src]!</span>",
|
||||
"<span class='notice'>You adjust [src]'s routing and receiver spectrum, unlocking special supplies and contraband.</span>")
|
||||
user.visible_message(span_warning("[user] swipes a suspicious card through [src]!"),
|
||||
span_notice("You adjust [src]'s routing and receiver spectrum, unlocking special supplies and contraband."))
|
||||
|
||||
obj_flags |= EMAGGED
|
||||
contraband = TRUE
|
||||
|
||||
@@ -210,7 +210,7 @@
|
||||
bluespace = TRUE //Make it so that the pod doesn't stay in centcom forever
|
||||
pod_flags &= ~FIRST_SOUNDS //Make it so we play sounds now
|
||||
if (!effectQuiet && style != STYLE_SEETHROUGH)
|
||||
audible_message("<span class='notice'>The pod hisses, closing and launching itself away from the station.</span>", "<span class='notice'>The ground vibrates, and you hear the sound of engines firing.</span>")
|
||||
audible_message(span_notice("The pod hisses, closing and launching itself away from the station."), span_notice("The ground vibrates, and you hear the sound of engines firing."))
|
||||
stay_after_drop = FALSE
|
||||
holder.pixel_z = initial(holder.pixel_z)
|
||||
holder.alpha = initial(holder.alpha)
|
||||
|
||||
@@ -50,9 +50,9 @@
|
||||
/obj/item/supplypod_beacon/examine(user)
|
||||
. = ..()
|
||||
if(!express_console)
|
||||
. += "<span class='notice'>[src] is not currently linked to an Express Supply console.</span>"
|
||||
. += span_notice("[src] is not currently linked to an Express Supply console.")
|
||||
else
|
||||
. += "<span class='notice'>Alt-click to unlink it from the Express Supply console.</span>"
|
||||
. += span_notice("Alt-click to unlink it from the Express Supply console.")
|
||||
|
||||
/obj/item/supplypod_beacon/Destroy()
|
||||
if(express_console)
|
||||
@@ -76,7 +76,7 @@
|
||||
update_status(SP_LINKED)
|
||||
if (express_console.usingBeacon)
|
||||
update_status(SP_READY)
|
||||
to_chat(user, "<span class='notice'>[src] linked to [C].</span>")
|
||||
to_chat(user, span_notice("[src] linked to [C]."))
|
||||
|
||||
/obj/item/supplypod_beacon/AltClick(mob/user)
|
||||
if (!user.canUseTopic(src, !issilicon(user)))
|
||||
@@ -84,7 +84,7 @@
|
||||
if (express_console)
|
||||
unlink_console()
|
||||
else
|
||||
to_chat(user, "<span class='alert'>There is no linked console.</span>")
|
||||
to_chat(user, span_alert("There is no linked console."))
|
||||
|
||||
/obj/item/supplypod_beacon/attackby(obj/item/W, mob/user)
|
||||
if(istype(W, /obj/item/pen)) //give a tag that is visible from the linked express console
|
||||
|
||||
Reference in New Issue
Block a user