From 4bca7fc729db2fd35137fd0e1eced29fc2909252 Mon Sep 17 00:00:00 2001 From: Pinta <68373373+softcerv@users.noreply.github.com> Date: Thu, 6 Apr 2023 00:23:23 -0400 Subject: [PATCH] (Fix) The crew manifest now properly updates after ID modifications. (#74518) ## About The Pull Request This PR makes it so that the access modification program now updates the crew manifest once the inserted ID is ejected. Additionally, when the ID trim is changed, the manifest is updated. ## Why It's Good For The Game Demoted heads would still show up on the manifest as their job pre-demotion, this fixes that. ## Changelog :cl: fix: The crew manifest now properly updates after ID modifications. /:cl: --- code/game/machinery/PDApainter.dm | 1 + .../computers/item/computer.dm | 5 ++++ .../file_system/programs/card.dm | 26 +++++++++++-------- tgui/packages/tgui/interfaces/NtosCard.js | 2 +- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/code/game/machinery/PDApainter.dm b/code/game/machinery/PDApainter.dm index 6a9a64925bb..cce8697c0c8 100644 --- a/code/game/machinery/PDApainter.dm +++ b/code/game/machinery/PDApainter.dm @@ -238,6 +238,7 @@ */ /obj/machinery/pdapainter/proc/eject_id_card(mob/living/user) if(stored_id_card) + GLOB.manifest.modify(stored_id_card.registered_name, stored_id_card.assignment, stored_id_card.get_trim_assignment()) if(user && !issilicon(user) && in_range(src, user)) user.put_in_hands(stored_id_card) else diff --git a/code/modules/modular_computers/computers/item/computer.dm b/code/modules/modular_computers/computers/item/computer.dm index 447194e3ae1..2d40f0dafba 100644 --- a/code/modules/modular_computers/computers/item/computer.dm +++ b/code/modules/modular_computers/computers/item/computer.dm @@ -22,6 +22,8 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar var/obj/item/stock_parts/cell/internal_cell = /obj/item/stock_parts/cell ///A pAI currently loaded into the modular computer. var/obj/item/pai_card/inserted_pai + ///Does the console update the crew manifest when the ID is removed? + var/crew_manifest_update = FALSE ///The amount of storage space the computer starts with. var/max_capacity = 128 @@ -278,6 +280,9 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar if(!computer_id_slot) return ..() + if(crew_manifest_update) + GLOB.manifest.modify(computer_id_slot.registered_name, computer_id_slot.assignment, computer_id_slot.get_trim_assignment()) + if(user) if(!issilicon(user) && in_range(src, user)) user.put_in_hands(computer_id_slot) diff --git a/code/modules/modular_computers/file_system/programs/card.dm b/code/modules/modular_computers/file_system/programs/card.dm index 66fa00ff577..b1c51a8c558 100644 --- a/code/modules/modular_computers/file_system/programs/card.dm +++ b/code/modules/modular_computers/file_system/programs/card.dm @@ -73,6 +73,20 @@ return FALSE +/datum/computer_file/program/card_mod/on_start(mob/living/user) + . = ..() + if(!.) + return FALSE + computer.crew_manifest_update = TRUE + +/datum/computer_file/program/card_mod/kill_program(forced) + computer.crew_manifest_update = FALSE + var/obj/item/card/id/inserted_auth_card = computer.computer_id_slot + if(inserted_auth_card) + GLOB.manifest.modify(inserted_auth_card.registered_name, inserted_auth_card.assignment, inserted_auth_card.get_trim_assignment()) + + return ..() + /datum/computer_file/program/card_mod/ui_act(action, params) . = ..() if(.) @@ -121,23 +135,13 @@ playsound(computer, 'sound/machines/terminal_on.ogg', 50, FALSE) 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") + if("PRG_eject_id") if(inserted_auth_card) return computer.RemoveID(usr) else var/obj/item/I = user.get_active_held_item() if(isidcard(I)) return computer.InsertID(I, user) - // Eject the ID being modified. - if("PRG_ejectmodid") - if(inserted_auth_card) - GLOB.manifest.modify(inserted_auth_card.registered_name, inserted_auth_card.assignment, inserted_auth_card.get_trim_assignment()) - return computer.RemoveID(usr) - else - var/obj/item/I = user.get_active_held_item() - if(isidcard(I)) - return computer.InsertID(I, user) return TRUE // Used to fire someone. Wipes all access from their card and modifies their assignment. if("PRG_terminate") diff --git a/tgui/packages/tgui/interfaces/NtosCard.js b/tgui/packages/tgui/interfaces/NtosCard.js index 462fcb8d829..786f2a7ab68 100644 --- a/tgui/packages/tgui/interfaces/NtosCard.js +++ b/tgui/packages/tgui/interfaces/NtosCard.js @@ -129,7 +129,7 @@ const IdCardPage = (props, context) => { ellipsis icon="eject" content={authIDName} - onClick={() => act('PRG_ejectauthid')} + onClick={() => act('PRG_eject_id')} />