(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
🆑
fix: The crew manifest now properly updates after ID modifications.
/🆑
This commit is contained in:
Pinta
2023-04-06 00:23:23 -04:00
committed by GitHub
parent 561dc6e4b1
commit 4bca7fc729
4 changed files with 22 additions and 12 deletions
@@ -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)
@@ -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")