From 6fdbbc633d4b3197ce97a790ce58f4d8481d136c Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Mon, 28 Nov 2022 00:32:38 +0100 Subject: [PATCH] [MIRROR] Fixes the identification section not appearing in PDAs and improves its appearance just a bit (while also fixing some runtimes) [MDB IGNORE] (#17753) * Fixes the identification section not appearing in PDAs and improves its appearance just a bit (while also fixing some runtimes) (#71467) ## About The Pull Request Yeah so turns out that #71420 broke the display of the identification section in PDAs (and by extension, all modular (I guess not really modular anymore) computers), because it forgot to remove a now unused variable from the interface. However, while investigating this, I strolled upon many more bugs and other general unresponsiveness of the interface, so I went ahead and fixed those. There's also no longer an empty set of `()` on both of the fields if there's no ID inside of the computer anymore, because that was stupid. ## Why It's Good For The Game Bug bad, fix good. Multiple fix, even better. ## Changelog :cl: GoldenAlpharex fix: PDAs (and by extension, modular computers) now can see the ID section at the top of their main screen again, which means that PDAs can have IDs imprinted on them again. fix: Fixes the ID section not displaying anything when there wasn't any ID inserted in it, even if it had an imprinted name and job. fix: Fixes the "Eject ID" and "Imprint ID" buttons not being disabled when there's no ID in the computer/PDA. fix: There's no longer any empty () by in the "ID Name" and "Assignment" fields of the ID section of computers when there's no ID in them. /:cl: * Fixes the identification section not appearing in PDAs and improves its appearance just a bit (while also fixing some runtimes) Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> --- .../computers/item/computer_ui.dm | 34 +++++------ tgui/packages/tgui/interfaces/NtosMain.js | 57 +++++++++++-------- 2 files changed, 51 insertions(+), 40 deletions(-) diff --git a/code/modules/modular_computers/computers/item/computer_ui.dm b/code/modules/modular_computers/computers/item/computer_ui.dm index 3e250c26e7f..4dfe84ce28b 100644 --- a/code/modules/modular_computers/computers/item/computer_ui.dm +++ b/code/modules/modular_computers/computers/item/computer_ui.dm @@ -57,23 +57,17 @@ /obj/item/modular_computer/ui_data(mob/user) var/list/data = get_header_data() data["device_theme"] = device_theme - data["login"] = list() - if(computer_id_slot) - var/stored_name = saved_identification - var/stored_title = saved_job - if(!stored_name) - stored_name = "Unknown" - if(!stored_title) - stored_title = "Unknown" - data["login"] = list( - IDName = saved_identification, - IDJob = saved_job, - ) - data["proposed_login"] = list( - IDName = computer_id_slot.registered_name, - IDJob = computer_id_slot.assignment, - ) + data["login"] = list( + IDName = saved_identification || "Unknown", + IDJob = saved_job || "Unknown", + ) + + data["proposed_login"] = list( + IDName = computer_id_slot?.registered_name, + IDJob = computer_id_slot?.assignment, + ) + data["removable_media"] = list() if(inserted_disk) @@ -166,18 +160,26 @@ if("Eject Disk") if(!inserted_disk) return + user.put_in_hands(inserted_disk) inserted_disk = null playsound(src, 'sound/machines/card_slide.ogg', 50) + return TRUE + if("intelliCard") var/datum/computer_file/program/ai_restorer/airestore_app = locate() in stored_files if(!airestore_app) return + if(airestore_app.try_eject(user)) playsound(src, 'sound/machines/card_slide.ogg', 50) + return TRUE + if("ID") if(RemoveID()) playsound(src, 'sound/machines/card_slide.ogg', 50) + return TRUE + if("PC_Imprint_ID") saved_identification = computer_id_slot.registered_name saved_job = computer_id_slot.assignment diff --git a/tgui/packages/tgui/interfaces/NtosMain.js b/tgui/packages/tgui/interfaces/NtosMain.js index f873066f1c0..e9da6ad90d6 100644 --- a/tgui/packages/tgui/interfaces/NtosMain.js +++ b/tgui/packages/tgui/interfaces/NtosMain.js @@ -12,7 +12,6 @@ export const NtosMain = (props, context) => { light_on, comp_light_color, removable_media = [], - cardholder, login = [], proposed_login = [], pai, @@ -58,17 +57,17 @@ export const NtosMain = (props, context) => { )} - {!!(cardholder && show_imprint) && ( -
-
- )} + )} + + }> + + + ID Name:{' '} + {show_imprint + ? login.IDName + + ' ' + + (proposed_login.IDName ? '(' + proposed_login.IDName + ')' : '') + : proposed_login.IDName ?? ''} + + + Assignment:{' '} + {show_imprint + ? login.IDJob + + ' ' + + (proposed_login.IDJob ? '(' + proposed_login.IDJob + ')' : '') + : proposed_login.IDJob ?? ''} + +
+ {!!pai && (