mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-16 10:35:41 +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:
@@ -92,7 +92,7 @@
|
||||
/datum/computer_file/program/proc/is_supported_by_hardware(hardware_flag = 0, loud = 0, mob/user = null)
|
||||
if(!(hardware_flag & usage_flags))
|
||||
if(loud && computer && user)
|
||||
to_chat(user, "<span class='danger'>\The [computer] flashes a \"Hardware Error - Incompatible software\" warning.</span>")
|
||||
to_chat(user, span_danger("\The [computer] flashes a \"Hardware Error - Incompatible software\" warning."))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
@@ -144,14 +144,14 @@
|
||||
|
||||
if(!D)
|
||||
if(loud)
|
||||
to_chat(user, "<span class='danger'>\The [computer] flashes an \"RFID Error - Unable to scan ID\" warning.</span>")
|
||||
to_chat(user, span_danger("\The [computer] flashes an \"RFID Error - Unable to scan ID\" warning."))
|
||||
return FALSE
|
||||
access = D.GetAccess()
|
||||
|
||||
if(access_to_check in access)
|
||||
return TRUE
|
||||
if(loud)
|
||||
to_chat(user, "<span class='danger'>\The [computer] flashes an \"Access Denied\" warning.</span>")
|
||||
to_chat(user, span_danger("\The [computer] flashes an \"Access Denied\" warning."))
|
||||
return FALSE
|
||||
|
||||
// This attempts to retrieve header data for UIs. If implementing completely new device of different type than existing ones
|
||||
|
||||
@@ -13,6 +13,6 @@
|
||||
/datum/computer_file/program/proc/event_networkfailure(background)
|
||||
kill_program(forced = TRUE)
|
||||
if(background)
|
||||
computer.visible_message("<span class='danger'>\The [computer]'s screen displays a \"Process [filename].[filetype] (PID [rand(100,999)]) terminated - Network Error\" error</span>")
|
||||
computer.visible_message(span_danger("\The [computer]'s screen displays a \"Process [filename].[filetype] (PID [rand(100,999)]) terminated - Network Error\" error"))
|
||||
else
|
||||
computer.visible_message("<span class='danger'>\The [computer]'s screen briefly freezes and then shows \"NETWORK ERROR - NTNet connection lost. Please retry. If problem persists contact your system administrator.\" error.</span>")
|
||||
computer.visible_message(span_danger("\The [computer]'s screen briefly freezes and then shows \"NETWORK ERROR - NTNet connection lost. Please retry. If problem persists contact your system administrator.\" error."))
|
||||
|
||||
@@ -92,9 +92,9 @@
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(H.put_in_hands(crystals))
|
||||
to_chat(H, "<span class='notice'>Your payment materializes into your hands!</span>")
|
||||
to_chat(H, span_notice("Your payment materializes into your hands!"))
|
||||
else
|
||||
to_chat(user, "<span class='notice'>Your payment materializes onto the floor.</span>")
|
||||
to_chat(user, span_notice("Your payment materializes onto the floor."))
|
||||
|
||||
hard_drive.traitor_data.contractor_hub.contract_TC_payed_out += hard_drive.traitor_data.contractor_hub.contract_TC_to_redeem
|
||||
hard_drive.traitor_data.contractor_hub.contract_TC_to_redeem = 0
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
if(computer)
|
||||
if(istype(computer, /obj/item/modular_computer/tablet/integrated)) //If this is a borg's integrated tablet
|
||||
var/obj/item/modular_computer/tablet/integrated/modularInterface = computer
|
||||
to_chat(modularInterface.borgo,"<span class='userdanger'>SYSTEM PURGE DETECTED/</span>")
|
||||
to_chat(modularInterface.borgo,span_userdanger("SYSTEM PURGE DETECTED/"))
|
||||
addtimer(CALLBACK(modularInterface.borgo, /mob/living/silicon/robot/.proc/death), 2 SECONDS, TIMER_UNIQUE)
|
||||
return
|
||||
|
||||
computer.visible_message("<span class='notice'>\The [computer]'s screen brightly flashes and loud electrical buzzing is heard.</span>")
|
||||
computer.visible_message(span_notice("\The [computer]'s screen brightly flashes and loud electrical buzzing is heard."))
|
||||
computer.enabled = FALSE
|
||||
computer.update_appearance()
|
||||
var/obj/item/computer_hardware/hard_drive/hard_drive = computer.all_components[MC_HDD]
|
||||
@@ -35,13 +35,13 @@
|
||||
computer.take_damage(25, BRUTE, 0, 0)
|
||||
if(battery_module && prob(25))
|
||||
qdel(battery_module)
|
||||
computer.visible_message("<span class='notice'>\The [computer]'s battery explodes in rain of sparks.</span>")
|
||||
computer.visible_message(span_notice("\The [computer]'s battery explodes in rain of sparks."))
|
||||
var/datum/effect_system/spark_spread/spark_system = new /datum/effect_system/spark_spread
|
||||
spark_system.start()
|
||||
|
||||
if(recharger && prob(50))
|
||||
qdel(recharger)
|
||||
computer.visible_message("<span class='notice'>\The [computer]'s recharger explodes in rain of sparks.</span>")
|
||||
computer.visible_message(span_notice("\The [computer]'s recharger explodes in rain of sparks."))
|
||||
var/datum/effect_system/spark_spread/spark_system = new /datum/effect_system/spark_spread
|
||||
spark_system.start()
|
||||
|
||||
|
||||
@@ -150,20 +150,20 @@
|
||||
return TRUE
|
||||
if("Dispense_Tickets")
|
||||
if(!printer)
|
||||
to_chat(usr, "<span class='notice'>Hardware error: A printer is required to redeem tickets.</span>")
|
||||
to_chat(usr, span_notice("Hardware error: A printer is required to redeem tickets."))
|
||||
return
|
||||
if(printer.stored_paper <= 0)
|
||||
to_chat(usr, "<span class='notice'>Hardware error: Printer is out of paper.</span>")
|
||||
to_chat(usr, span_notice("Hardware error: Printer is out of paper."))
|
||||
return
|
||||
else
|
||||
computer.visible_message("<span class='notice'>\The [computer] prints out paper.</span>")
|
||||
computer.visible_message(span_notice("\The [computer] prints out paper."))
|
||||
if(ticket_count >= 1)
|
||||
new /obj/item/stack/arcadeticket((get_turf(computer)), 1)
|
||||
to_chat(usr, "<span class='notice'>[computer] dispenses a ticket!</span>")
|
||||
to_chat(usr, span_notice("[computer] dispenses a ticket!"))
|
||||
ticket_count -= 1
|
||||
printer.stored_paper -= 1
|
||||
else
|
||||
to_chat(usr, "<span class='notice'>You don't have any stored tickets!</span>")
|
||||
to_chat(usr, span_notice("You don't have any stored tickets!"))
|
||||
return TRUE
|
||||
if("Start_Game")
|
||||
game_active = TRUE
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
if (!.)
|
||||
return
|
||||
if(!computer?.get_modular_computer_part(MC_SENSORS)) //Giving a clue to users why the program is spitting out zeros.
|
||||
to_chat(user, "<span class='warning'>\The [computer] flashes an error: \"hardware\\sensorpackage\\startup.bin -- file not found\".</span>")
|
||||
to_chat(user, span_warning("\The [computer] flashes an error: \"hardware\\sensorpackage\\startup.bin -- file not found\"."))
|
||||
|
||||
|
||||
/datum/computer_file/program/atmosscan/ui_data(mob/user)
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
var/obj/item/card/id/stored_card = computer.GetID()
|
||||
if(istype(stored_card) && stored_card.registered_name)
|
||||
username = "user [stored_card.registered_name]"
|
||||
to_chat(borgo, "<span class='userdanger'>Request received from [username] for the system log file. Upload in progress.</span>")//Damning evidence may be contained, so warn the borg
|
||||
to_chat(borgo, span_userdanger("Request received from [username] for the system log file. Upload in progress."))//Damning evidence may be contained, so warn the borg
|
||||
borgo.logevent("File request by [username]: /var/logs/syslog")
|
||||
return TRUE
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
var/turf/here = get_turf(computer)
|
||||
var/turf/there = get_turf(DL_source)
|
||||
if(!here.Adjacent(there))//If someone walked away, cancel the download
|
||||
to_chat(DL_source, "<span class='danger'>Log upload failed: general connection error.</span>")//Let the borg know the upload stopped
|
||||
to_chat(DL_source, span_danger("Log upload failed: general connection error."))//Let the borg know the upload stopped
|
||||
DL_source = null
|
||||
DL_progress = -1
|
||||
return
|
||||
@@ -129,16 +129,16 @@
|
||||
if(!ID)
|
||||
return
|
||||
if(R.stat == DEAD) //Dead borgs will listen to you no longer
|
||||
to_chat(usr, "<span class='warn'>Error -- Could not open a connection to unit:[R]</span>")
|
||||
to_chat(usr, span_warning("Error -- Could not open a connection to unit:[R]"))
|
||||
var/message = stripped_input(usr, message = "Enter message to be sent to remote cyborg.", title = "Send Message")
|
||||
if(!message)
|
||||
return
|
||||
to_chat(R, "<br><br><span class='notice'>Message from [ID] -- \"[message]\"</span><br>")
|
||||
to_chat(R, "<br><br>[span_notice("Message from [ID] -- \"[message]\"")]<br>")
|
||||
to_chat(usr, "Message sent to [R]: [message]")
|
||||
R.logevent("Message from [ID] -- \"[message]\"")
|
||||
SEND_SOUND(R, 'sound/machines/twobeep_high.ogg')
|
||||
if(R.connected_ai)
|
||||
to_chat(R.connected_ai, "<br><br><span class='notice'>Message from [ID] to [R] -- \"[message]\"</span><br>")
|
||||
to_chat(R.connected_ai, "<br><br>[span_notice("Message from [ID] to [R] -- \"[message]\"")]<br>")
|
||||
SEND_SOUND(R.connected_ai, 'sound/machines/twobeep_high.ogg')
|
||||
usr.log_talk(message, LOG_PDA, tag="Cyborg Monitor Program: ID name \"[ID]\" to [R]")
|
||||
|
||||
|
||||
@@ -123,11 +123,11 @@
|
||||
contents += " [SSid_access.get_access_desc(A)]"
|
||||
|
||||
if(!printer.print_text(contents,"access report"))
|
||||
to_chat(usr, "<span class='notice'>Hardware error: Printer was unable to print the file. It may be out of paper.</span>")
|
||||
to_chat(usr, span_notice("Hardware error: Printer was unable to print the file. It may be out of paper."))
|
||||
return TRUE
|
||||
else
|
||||
playsound(computer, 'sound/machines/terminal_on.ogg', 50, FALSE)
|
||||
computer.visible_message("<span class='notice'>\The [computer] prints out a paper.</span>")
|
||||
computer.visible_message(span_notice("\The [computer] prints out a paper."))
|
||||
return TRUE
|
||||
// Eject the ID used to log on to the ID app.
|
||||
if("PRG_ejectauthid")
|
||||
@@ -157,7 +157,7 @@
|
||||
return TRUE
|
||||
if(minor)
|
||||
if(!(target_id_card.trim?.type in job_templates))
|
||||
to_chat(usr, "<span class='notice'>Software error: You do not have the necessary permissions to demote this card.</span>")
|
||||
to_chat(usr, span_notice("Software error: You do not have the necessary permissions to demote this card."))
|
||||
return TRUE
|
||||
|
||||
// Set the new assignment then remove the trim.
|
||||
@@ -190,7 +190,7 @@
|
||||
new_name = reject_bad_name(new_name, allow_numbers = TRUE)
|
||||
|
||||
if(!new_name)
|
||||
to_chat(usr, "<span class='notice'>Software error: The ID card rejected the new name as it contains prohibited characters.</span>")
|
||||
to_chat(usr, span_notice("Software error: The ID card rejected the new name as it contains prohibited characters."))
|
||||
return TRUE
|
||||
|
||||
target_id_card.registered_name = new_name
|
||||
@@ -239,7 +239,7 @@
|
||||
return TRUE
|
||||
|
||||
if(!target_id_card.add_access(list(access_type), try_wildcard))
|
||||
to_chat(usr, "<span class='notice'>ID error: ID card rejected your attempted access modification.</span>")
|
||||
to_chat(usr, span_notice("ID error: ID card rejected your attempted access modification."))
|
||||
LOG_ID_ACCESS_CHANGE(user, target_id_card, "failed to add [SSid_access.get_access_desc(access_type)][try_wildcard ? " with wildcard [try_wildcard]" : ""]")
|
||||
return TRUE
|
||||
|
||||
|
||||
@@ -63,16 +63,16 @@
|
||||
cut_multiplier = potential_cut ? clamp(round(potential_cut/100, cut_min), cut_min, cut_max) : initial(cut_multiplier)
|
||||
if("print")
|
||||
if(!printer)
|
||||
to_chat(usr, "<span class='notice'>Hardware error: A printer is required to print barcodes.</span>")
|
||||
to_chat(usr, span_notice("Hardware error: A printer is required to print barcodes."))
|
||||
return
|
||||
if(printer.stored_paper <= 0)
|
||||
to_chat(usr, "<span class='notice'>Hardware error: Printer is out of paper.</span>")
|
||||
to_chat(usr, span_notice("Hardware error: Printer is out of paper."))
|
||||
return
|
||||
if(!payments_acc)
|
||||
to_chat(usr, "<span class='notice'>Software error: Please set a current user first.</span>")
|
||||
to_chat(usr, span_notice("Software error: Please set a current user first."))
|
||||
return
|
||||
var/obj/item/barcode/barcode = new /obj/item/barcode(get_turf(ui_host()))
|
||||
barcode.payments_acc = payments_acc
|
||||
barcode.cut_multiplier = cut_multiplier
|
||||
printer.stored_paper--
|
||||
to_chat(usr, "<span class='notice'>The computer prints out a barcode.</span>")
|
||||
to_chat(usr, span_notice("The computer prints out a barcode."))
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
[GLOB.data_core ? GLOB.data_core.get_manifest_html(0) : ""]
|
||||
"}
|
||||
if(!printer.print_text(contents,text("crew manifest ([])", station_time_timestamp())))
|
||||
to_chat(usr, "<span class='notice'>Hardware error: Printer was unable to print the file. It may be out of paper.</span>")
|
||||
to_chat(usr, span_notice("Hardware error: Printer was unable to print the file. It may be out of paper."))
|
||||
return
|
||||
else
|
||||
computer.visible_message("<span class='notice'>\The [computer] prints out a paper.</span>")
|
||||
computer.visible_message(span_notice("\The [computer] prints out a paper."))
|
||||
|
||||
@@ -128,9 +128,9 @@
|
||||
// This program shouldn't even be runnable without computer.
|
||||
CRASH("Var computer is null!")
|
||||
if(!hard_drive)
|
||||
computer.visible_message("<span class='warning'>\The [computer] shows an \"I/O Error - Hard drive connection error\" warning.</span>")
|
||||
computer.visible_message(span_warning("\The [computer] shows an \"I/O Error - Hard drive connection error\" warning."))
|
||||
else // In 99.9% cases this will mean our HDD is full
|
||||
computer.visible_message("<span class='warning'>\The [computer] shows an \"I/O Error - Hard drive may be full. Please free some space and try again. Required space: [logfile.size]GQ\" warning.</span>")
|
||||
computer.visible_message(span_warning("\The [computer] shows an \"I/O Error - Hard drive may be full. Please free some space and try again. Required space: [logfile.size]GQ\" warning."))
|
||||
return TRUE
|
||||
if("PRG_renamechannel")
|
||||
if(!authed)
|
||||
|
||||
@@ -45,10 +45,10 @@
|
||||
if(computer)
|
||||
printer = computer.all_components[MC_PRINT]
|
||||
if(!printer)
|
||||
to_chat(usr, "<span class='notice'>Hardware error: A printer is required to print a canvas.</span>")
|
||||
to_chat(usr, span_notice("Hardware error: A printer is required to print a canvas."))
|
||||
return
|
||||
if(printer.stored_paper < CANVAS_PAPER_COST)
|
||||
to_chat(usr, "<span class='notice'>Printing error: Your printer needs at least [CANVAS_PAPER_COST] paper to print a canvas.</span>")
|
||||
to_chat(usr, span_notice("Printing error: Your printer needs at least [CANVAS_PAPER_COST] paper to print a canvas."))
|
||||
return
|
||||
printer.stored_paper -= CANVAS_PAPER_COST
|
||||
|
||||
@@ -79,5 +79,5 @@
|
||||
///this is a copy of something that is already in the database- it should not be able to be saved.
|
||||
printed_canvas.no_save = TRUE
|
||||
printed_canvas.update_icon()
|
||||
to_chat(usr, "<span class='notice'>You have printed [title] onto a new canvas.</span>")
|
||||
to_chat(usr, span_notice("You have printed [title] onto a new canvas."))
|
||||
playsound(computer.physical, 'sound/items/poster_being_created.ogg', 100, TRUE)
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
/datum/computer_file/program/robotact/run_program(mob/living/user)
|
||||
if(!istype(computer, /obj/item/modular_computer/tablet/integrated))
|
||||
to_chat(user, "<span class='warning'>A warning flashes across \the [computer]: Device Incompatible.</span>")
|
||||
to_chat(user, span_warning("A warning flashes across \the [computer]: Device Incompatible."))
|
||||
return FALSE
|
||||
. = ..()
|
||||
if(.)
|
||||
@@ -111,7 +111,7 @@
|
||||
if("alertPower")
|
||||
if(borgo.stat == CONSCIOUS)
|
||||
if(!borgo.cell || !borgo.cell.charge)
|
||||
borgo.visible_message("<span class='notice'>The power warning light on <span class='name'>[borgo]</span> flashes urgently.</span>", \
|
||||
borgo.visible_message(span_notice("The power warning light on [span_name("[borgo]")] flashes urgently."), \
|
||||
"You announce you are operating in low power mode.")
|
||||
playsound(borgo, 'sound/machines/buzz-two.ogg', 50, FALSE)
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
if (!.)
|
||||
return
|
||||
if(!computer?.get_modular_computer_part(MC_SIGNALER)) //Giving a clue to users why the program is spitting out zeros.
|
||||
to_chat(user, "<span class='warning'>\The [computer] flashes an error: \"hardware\\signal_hardware\\startup.bin -- file not found\".</span>")
|
||||
to_chat(user, span_warning("\The [computer] flashes an error: \"hardware\\signal_hardware\\startup.bin -- file not found\"."))
|
||||
|
||||
|
||||
/datum/computer_file/program/signaler/ui_data(mob/user)
|
||||
|
||||
@@ -91,12 +91,12 @@
|
||||
switch (action)
|
||||
if ("toggleLock")
|
||||
if(computer.obj_flags & EMAGGED)
|
||||
to_chat(usr, "<span class='boldwarning'>Security protocol error: Unable to access locking protocols.</span>")
|
||||
to_chat(usr, span_boldwarning("Security protocol error: Unable to access locking protocols."))
|
||||
return TRUE
|
||||
if(ACCESS_RND in user_id_card?.access)
|
||||
locked = !locked
|
||||
else
|
||||
to_chat(usr, "<span class='boldwarning'>Unauthorized Access. Please insert research ID card.</span>")
|
||||
to_chat(usr, span_boldwarning("Unauthorized Access. Please insert research ID card."))
|
||||
return TRUE
|
||||
if ("researchNode")
|
||||
if(!SSresearch.science_tech.available_nodes[params["node_id"]])
|
||||
|
||||
Reference in New Issue
Block a user