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:
@@ -29,23 +29,23 @@
|
||||
return
|
||||
|
||||
if(SEND_SIGNAL(loc, COMSIG_CONTAINS_STORAGE) && SEND_SIGNAL(I, COMSIG_CONTAINS_STORAGE))
|
||||
to_chat(user, "<span class='warning'>No matter what way you try, you can't get [I] to fit inside [src].</span>")
|
||||
to_chat(user, span_warning("No matter what way you try, you can't get [I] to fit inside [src]."))
|
||||
return TRUE //begone infinite storage ghosts, begone from me
|
||||
|
||||
if(istype(I, /obj/item/evidencebag))
|
||||
to_chat(user, "<span class='warning'>You find putting an evidence bag in another evidence bag to be slightly absurd.</span>")
|
||||
to_chat(user, span_warning("You find putting an evidence bag in another evidence bag to be slightly absurd."))
|
||||
return TRUE //now this is podracing
|
||||
|
||||
if(loc in I.GetAllContents()) // fixes tg #39452, evidence bags could store their own location, causing I to be stored in the bag while being present inworld still, and able to be teleported when removed.
|
||||
to_chat(user, "<span class='warning'>You find putting [I] in [src] while it's still inside it quite difficult!</span>")
|
||||
to_chat(user, span_warning("You find putting [I] in [src] while it's still inside it quite difficult!"))
|
||||
return
|
||||
|
||||
if(I.w_class > WEIGHT_CLASS_NORMAL)
|
||||
to_chat(user, "<span class='warning'>[I] won't fit in [src]!</span>")
|
||||
to_chat(user, span_warning("[I] won't fit in [src]!"))
|
||||
return
|
||||
|
||||
if(contents.len)
|
||||
to_chat(user, "<span class='warning'>[src] already has something inside it!</span>")
|
||||
to_chat(user, span_warning("[src] already has something inside it!"))
|
||||
return
|
||||
|
||||
if(!isturf(I.loc)) //If it isn't on the floor. Do some checks to see if it's in our hands or a box. Otherwise give up.
|
||||
@@ -54,8 +54,8 @@
|
||||
if(!user.dropItemToGround(I))
|
||||
return
|
||||
|
||||
user.visible_message("<span class='notice'>[user] puts [I] into [src].</span>", "<span class='notice'>You put [I] inside [src].</span>",\
|
||||
"<span class='hear'>You hear a rustle as someone puts something into a plastic bag.</span>")
|
||||
user.visible_message(span_notice("[user] puts [I] into [src]."), span_notice("You put [I] inside [src]."),\
|
||||
span_hear("You hear a rustle as someone puts something into a plastic bag."))
|
||||
|
||||
icon_state = "evidence"
|
||||
|
||||
@@ -75,8 +75,8 @@
|
||||
/obj/item/evidencebag/attack_self(mob/user)
|
||||
if(contents.len)
|
||||
var/obj/item/I = contents[1]
|
||||
user.visible_message("<span class='notice'>[user] takes [I] out of [src].</span>", "<span class='notice'>You take [I] out of [src].</span>",\
|
||||
"<span class='hear'>You hear someone rustle around in a plastic bag, and remove something.</span>")
|
||||
user.visible_message(span_notice("[user] takes [I] out of [src]."), span_notice("You take [I] out of [src]."),\
|
||||
span_hear("You hear someone rustle around in a plastic bag, and remove something."))
|
||||
cut_overlays() //remove the overlays
|
||||
user.put_in_hands(I)
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
@@ -84,7 +84,7 @@
|
||||
desc = "An empty evidence bag."
|
||||
|
||||
else
|
||||
to_chat(user, "<span class='notice'>[src] is empty.</span>")
|
||||
to_chat(user, span_notice("[src] is empty."))
|
||||
icon_state = "evidenceobj"
|
||||
return
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
spillable = FALSE
|
||||
|
||||
/obj/item/reagent_containers/glass/rag/suicide_act(mob/user)
|
||||
user.visible_message("<span class='suicide'>[user] is smothering [user.p_them()]self with [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
user.visible_message(span_suicide("[user] is smothering [user.p_them()]self with [src]! It looks like [user.p_theyre()] trying to commit suicide!"))
|
||||
return (OXYLOSS)
|
||||
|
||||
/obj/item/reagent_containers/glass/rag/afterattack(atom/A as obj|turf|area, mob/living/user,proximity)
|
||||
@@ -25,16 +25,16 @@
|
||||
var/log_object = "containing [reagentlist]"
|
||||
if(user.combat_mode && !C.is_mouth_covered())
|
||||
reagents.trans_to(C, reagents.total_volume, transfered_by = user, methods = INGEST)
|
||||
C.visible_message("<span class='danger'>[user] smothers \the [C] with \the [src]!</span>", "<span class='userdanger'>[user] smothers you with \the [src]!</span>", "<span class='hear'>You hear some struggling and muffled cries of surprise.</span>")
|
||||
C.visible_message(span_danger("[user] smothers \the [C] with \the [src]!"), span_userdanger("[user] smothers you with \the [src]!"), span_hear("You hear some struggling and muffled cries of surprise."))
|
||||
log_combat(user, C, "smothered", src, log_object)
|
||||
else
|
||||
reagents.expose(C, TOUCH)
|
||||
reagents.clear_reagents()
|
||||
C.visible_message("<span class='notice'>[user] touches \the [C] with \the [src].</span>")
|
||||
C.visible_message(span_notice("[user] touches \the [C] with \the [src]."))
|
||||
log_combat(user, C, "touched", src, log_object)
|
||||
|
||||
else if(istype(A) && (src in user))
|
||||
user.visible_message("<span class='notice'>[user] starts to wipe down [A] with [src]!</span>", "<span class='notice'>You start to wipe down [A] with [src]...</span>")
|
||||
user.visible_message(span_notice("[user] starts to wipe down [A] with [src]!"), span_notice("You start to wipe down [A] with [src]..."))
|
||||
if(do_after(user,30, target = A))
|
||||
user.visible_message("<span class='notice'>[user] finishes wiping off [A]!</span>", "<span class='notice'>You finish wiping off [A].</span>")
|
||||
user.visible_message(span_notice("[user] finishes wiping off [A]!"), span_notice("You finish wiping off [A]."))
|
||||
A.wash(CLEAN_SCRUB)
|
||||
|
||||
@@ -33,10 +33,10 @@
|
||||
/obj/item/detective_scanner/attack_self(mob/user)
|
||||
if(log.len && !scanning)
|
||||
scanning = TRUE
|
||||
to_chat(user, "<span class='notice'>Printing report, please wait...</span>")
|
||||
to_chat(user, span_notice("Printing report, please wait..."))
|
||||
addtimer(CALLBACK(src, .proc/PrintReport), 100)
|
||||
else
|
||||
to_chat(user, "<span class='notice'>The scanner has no logs or is in use.</span>")
|
||||
to_chat(user, span_notice("The scanner has no logs or is in use."))
|
||||
|
||||
/obj/item/detective_scanner/attack(mob/living/M, mob/user)
|
||||
return
|
||||
@@ -57,7 +57,7 @@
|
||||
if(ismob(loc))
|
||||
var/mob/M = loc
|
||||
M.put_in_hands(P)
|
||||
to_chat(M, "<span class='notice'>Report printed. Log cleared.</span>")
|
||||
to_chat(M, span_notice("Report printed. Log cleared."))
|
||||
|
||||
// Clear the logs
|
||||
log = list()
|
||||
@@ -77,8 +77,8 @@
|
||||
|
||||
scanning = TRUE
|
||||
|
||||
user.visible_message("<span class='notice'>\The [user] points the [src.name] at \the [A] and performs a forensic scan.</span>")
|
||||
to_chat(user, "<span class='notice'>You scan \the [A]. The scanner is now analysing the results...</span>")
|
||||
user.visible_message(span_notice("\The [user] points the [src.name] at \the [A] and performs a forensic scan."))
|
||||
to_chat(user, span_notice("You scan \the [A]. The scanner is now analysing the results..."))
|
||||
|
||||
|
||||
// GATHER INFORMATION
|
||||
@@ -126,7 +126,7 @@
|
||||
// Fingerprints
|
||||
if(length(fingerprints))
|
||||
sleep(30)
|
||||
add_log("<span class='info'><B>Prints:</B></span>")
|
||||
add_log(span_info("<B>Prints:</B>"))
|
||||
for(var/finger in fingerprints)
|
||||
add_log("[finger]")
|
||||
found_something = TRUE
|
||||
@@ -134,7 +134,7 @@
|
||||
// Blood
|
||||
if (length(blood))
|
||||
sleep(30)
|
||||
add_log("<span class='info'><B>Blood:</B></span>")
|
||||
add_log(span_info("<B>Blood:</B>"))
|
||||
found_something = TRUE
|
||||
for(var/B in blood)
|
||||
add_log("Type: <font color='red'>[blood[B]]</font> DNA (UE): <font color='red'>[B]</font>")
|
||||
@@ -142,7 +142,7 @@
|
||||
//Fibers
|
||||
if(length(fibers))
|
||||
sleep(30)
|
||||
add_log("<span class='info'><B>Fibers:</B></span>")
|
||||
add_log(span_info("<B>Fibers:</B>"))
|
||||
for(var/fiber in fibers)
|
||||
add_log("[fiber]")
|
||||
found_something = TRUE
|
||||
@@ -150,7 +150,7 @@
|
||||
//Reagents
|
||||
if(length(reagents))
|
||||
sleep(30)
|
||||
add_log("<span class='info'><B>Reagents:</B></span>")
|
||||
add_log(span_info("<B>Reagents:</B>"))
|
||||
for(var/R in reagents)
|
||||
add_log("Reagent: <font color='red'>[R]</font> Volume: <font color='red'>[reagents[R]]</font>")
|
||||
found_something = TRUE
|
||||
@@ -163,10 +163,10 @@
|
||||
if(!found_something)
|
||||
add_log("<I># No forensic traces found #</I>", 0) // Don't display this to the holder user
|
||||
if(holder)
|
||||
to_chat(holder, "<span class='warning'>Unable to locate any fingerprints, materials, fibers, or blood on \the [target_name]!</span>")
|
||||
to_chat(holder, span_warning("Unable to locate any fingerprints, materials, fibers, or blood on \the [target_name]!"))
|
||||
else
|
||||
if(holder)
|
||||
to_chat(holder, "<span class='notice'>You finish scanning \the [target_name].</span>")
|
||||
to_chat(holder, span_notice("You finish scanning \the [target_name]."))
|
||||
|
||||
add_log("---------------------------------------------------------", 0)
|
||||
scanning = FALSE
|
||||
@@ -189,27 +189,27 @@
|
||||
if(!user.canUseTopic(src, be_close=TRUE))
|
||||
return
|
||||
if(!LAZYLEN(log))
|
||||
to_chat(user, "<span class='notice'>Cannot clear logs, the scanner has no logs.</span>")
|
||||
to_chat(user, span_notice("Cannot clear logs, the scanner has no logs."))
|
||||
return
|
||||
if(scanning)
|
||||
to_chat(user, "<span class='notice'>Cannot clear logs, the scanner is in use.</span>")
|
||||
to_chat(user, span_notice("Cannot clear logs, the scanner is in use."))
|
||||
return
|
||||
to_chat(user, "<span class='notice'>The scanner logs are cleared.</span>")
|
||||
to_chat(user, span_notice("The scanner logs are cleared."))
|
||||
log = list()
|
||||
|
||||
/obj/item/detective_scanner/examine(mob/user)
|
||||
. = ..()
|
||||
if(LAZYLEN(log) && !scanning)
|
||||
. += "<span class='notice'>Alt-click to clear scanner logs.</span>"
|
||||
. += span_notice("Alt-click to clear scanner logs.")
|
||||
|
||||
/obj/item/detective_scanner/proc/displayDetectiveScanResults(mob/living/user)
|
||||
// No need for can-use checks since the action button should do proper checks
|
||||
if(!LAZYLEN(log))
|
||||
to_chat(user, "<span class='notice'>Cannot display logs, the scanner has no logs.</span>")
|
||||
to_chat(user, span_notice("Cannot display logs, the scanner has no logs."))
|
||||
return
|
||||
if(scanning)
|
||||
to_chat(user, "<span class='notice'>Cannot display logs, the scanner is in use.</span>")
|
||||
to_chat(user, span_notice("Cannot display logs, the scanner is in use."))
|
||||
return
|
||||
to_chat(user, "<span class='notice'><B>Scanner Report</B></span>")
|
||||
to_chat(user, span_notice("<B>Scanner Report</B>"))
|
||||
for(var/iterLog in log)
|
||||
to_chat(user, iterLog)
|
||||
|
||||
Reference in New Issue
Block a user