mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-19 20:15:47 +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:
@@ -215,7 +215,7 @@
|
||||
|
||||
/obj/item/modular_computer/emag_act(mob/user)
|
||||
if(!enabled)
|
||||
to_chat(user, "<span class='warning'>You'd need to turn the [src] on first.</span>")
|
||||
to_chat(user, span_warning("You'd need to turn the [src] on first."))
|
||||
return FALSE
|
||||
obj_flags |= EMAGGED //Mostly for consistancy purposes; the programs will do their own emag handling
|
||||
var/newemag = FALSE
|
||||
@@ -226,17 +226,17 @@
|
||||
if(app.run_emag())
|
||||
newemag = TRUE
|
||||
if(newemag)
|
||||
to_chat(user, "<span class='notice'>You swipe \the [src]. A console window momentarily fills the screen, with white text rapidly scrolling past.</span>")
|
||||
to_chat(user, span_notice("You swipe \the [src]. A console window momentarily fills the screen, with white text rapidly scrolling past."))
|
||||
return TRUE
|
||||
to_chat(user, "<span class='notice'>You swipe \the [src]. A console window fills the screen, but it quickly closes itself after only a few lines are written to it.</span>")
|
||||
to_chat(user, span_notice("You swipe \the [src]. A console window fills the screen, but it quickly closes itself after only a few lines are written to it."))
|
||||
return FALSE
|
||||
|
||||
/obj/item/modular_computer/examine(mob/user)
|
||||
. = ..()
|
||||
if(obj_integrity <= integrity_failure * max_integrity)
|
||||
. += "<span class='danger'>It is heavily damaged!</span>"
|
||||
. += span_danger("It is heavily damaged!")
|
||||
else if(obj_integrity < max_integrity)
|
||||
. += "<span class='warning'>It is damaged.</span>"
|
||||
. += span_warning("It is damaged.")
|
||||
|
||||
. += get_modular_computer_parts_examine(user)
|
||||
|
||||
@@ -267,9 +267,9 @@
|
||||
var/issynth = issilicon(user) // Robots and AIs get different activation messages.
|
||||
if(obj_integrity <= integrity_failure * max_integrity)
|
||||
if(issynth)
|
||||
to_chat(user, "<span class='warning'>You send an activation signal to \the [src], but it responds with an error code. It must be damaged.</span>")
|
||||
to_chat(user, span_warning("You send an activation signal to \the [src], but it responds with an error code. It must be damaged."))
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You press the power button, but the computer fails to boot up, displaying variety of errors before shutting down again.</span>")
|
||||
to_chat(user, span_warning("You press the power button, but the computer fails to boot up, displaying variety of errors before shutting down again."))
|
||||
return FALSE
|
||||
|
||||
// If we have a recharger, enable it automatically. Lets computer without a battery work.
|
||||
@@ -279,9 +279,9 @@
|
||||
|
||||
if(all_components[MC_CPU] && use_power()) // use_power() checks if the PC is powered
|
||||
if(issynth)
|
||||
to_chat(user, "<span class='notice'>You send an activation signal to \the [src], turning it on.</span>")
|
||||
to_chat(user, span_notice("You send an activation signal to \the [src], turning it on."))
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You press the power button and start up \the [src].</span>")
|
||||
to_chat(user, span_notice("You press the power button and start up \the [src]."))
|
||||
if(looping_sound)
|
||||
soundloop.start()
|
||||
enabled = 1
|
||||
@@ -290,9 +290,9 @@
|
||||
return TRUE
|
||||
else // Unpowered
|
||||
if(issynth)
|
||||
to_chat(user, "<span class='warning'>You send an activation signal to \the [src] but it does not respond.</span>")
|
||||
to_chat(user, span_warning("You send an activation signal to \the [src] but it does not respond."))
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You press the power button but \the [src] does not respond.</span>")
|
||||
to_chat(user, span_warning("You press the power button but \the [src] does not respond."))
|
||||
return FALSE
|
||||
|
||||
// Process currently calls handle_power(), may be expanded in future if more things are added.
|
||||
@@ -348,10 +348,10 @@
|
||||
if(!caller || !caller.alert_able || caller.alert_silenced || !alerttext) //Yeah, we're checking alert_able. No, you don't get to make alerts that the user can't silence.
|
||||
return
|
||||
playsound(src, sound, 50, TRUE)
|
||||
visible_message("<span class='notice'>The [src] displays a [caller.filedesc] notification: [alerttext]</span>")
|
||||
visible_message(span_notice("The [src] displays a [caller.filedesc] notification: [alerttext]"))
|
||||
var/mob/living/holder = loc
|
||||
if(istype(holder))
|
||||
to_chat(holder, "[icon2html(src)] <span class='notice'>The [src] displays a [caller.filedesc] notification: [alerttext]</span>")
|
||||
to_chat(holder, "[icon2html(src)] [span_notice("The [src] displays a [caller.filedesc] notification: [alerttext]")]")
|
||||
|
||||
// Function used by NanoUI's to obtain data for header. All relevant entries begin with "PC_"
|
||||
/obj/item/modular_computer/proc/get_header_data()
|
||||
@@ -446,7 +446,7 @@
|
||||
if(looping_sound)
|
||||
soundloop.stop()
|
||||
if(loud)
|
||||
physical.visible_message("<span class='notice'>\The [src] shuts down.</span>")
|
||||
physical.visible_message(span_notice("\The [src] shuts down."))
|
||||
enabled = 0
|
||||
update_appearance()
|
||||
|
||||
@@ -484,7 +484,7 @@
|
||||
|
||||
/obj/item/modular_computer/screwdriver_act(mob/user, obj/item/tool)
|
||||
if(!all_components.len)
|
||||
to_chat(user, "<span class='warning'>This device doesn't have any components installed.</span>")
|
||||
to_chat(user, span_warning("This device doesn't have any components installed."))
|
||||
return
|
||||
var/list/component_names = list()
|
||||
for(var/h in all_components)
|
||||
@@ -526,26 +526,26 @@
|
||||
|
||||
if(W.tool_behaviour == TOOL_WRENCH)
|
||||
if(all_components.len)
|
||||
to_chat(user, "<span class='warning'>Remove all components from \the [src] before disassembling it.</span>")
|
||||
to_chat(user, span_warning("Remove all components from \the [src] before disassembling it."))
|
||||
return
|
||||
new /obj/item/stack/sheet/iron( get_turf(src.loc), steel_sheet_cost )
|
||||
physical.visible_message("<span class='notice'>\The [src] is disassembled by [user].</span>")
|
||||
physical.visible_message(span_notice("\The [src] is disassembled by [user]."))
|
||||
relay_qdel()
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
if(W.tool_behaviour == TOOL_WELDER)
|
||||
if(obj_integrity == max_integrity)
|
||||
to_chat(user, "<span class='warning'>\The [src] does not require repairs.</span>")
|
||||
to_chat(user, span_warning("\The [src] does not require repairs."))
|
||||
return
|
||||
|
||||
if(!W.tool_start_check(user, amount=1))
|
||||
return
|
||||
|
||||
to_chat(user, "<span class='notice'>You begin repairing damage to \the [src]...</span>")
|
||||
to_chat(user, span_notice("You begin repairing damage to \the [src]..."))
|
||||
if(W.use_tool(src, user, 20, volume=50, amount=1))
|
||||
obj_integrity = max_integrity
|
||||
to_chat(user, "<span class='notice'>You repair \the [src].</span>")
|
||||
to_chat(user, span_notice("You repair \the [src]."))
|
||||
return
|
||||
|
||||
var/obj/item/computer_hardware/card_slot/card_slot = all_components[MC_CARD]
|
||||
|
||||
Reference in New Issue
Block a user