Fixes flipped detectives id's assignment (#89388)

## About The Pull Request
Fixes this 

![image](https://github.com/user-attachments/assets/29eda981-8e98-4ec2-afc0-135e6cd2526d)

And fixes a runtime 

![image](https://github.com/user-attachments/assets/10e0f7a7-dad6-4a9d-920f-25d8ce91d923)
## Why It's Good For The Game

People can recognize the detective beacuse of this, so i wanted to fix
it
Fixes are goooood!!

## Changelog
🆑 Rengan
fix: When you cast examine to the disguised detective, its assignment
will now display correctly.
/🆑
This commit is contained in:
RengaN02
2025-02-11 04:03:10 +01:00
committed by GitHub
parent 07af87e47e
commit c013cd8710
4 changed files with 20 additions and 17 deletions
+9 -10
View File
@@ -433,14 +433,14 @@ SUBSYSTEM_DEF(id_access)
id_card.update_icon()
/**
* Applies a trim to a chameleon card. This is purely visual, utilising the card's override vars.
* Applies a trim to a card. This is purely visual, utilising the card's override vars.
*
* Arguments:
* * id_card - The chameleon card to apply the trim visuals to.
* * trim_path - A trim path to apply to the card. Grabs the trim's associated singleton and applies it.
* * id_card - The card to apply the trim visuals to.
* * trim_path - A trim path to apply to the card. Grabs the trim's associated singleton and applies it.
* * check_forged - Boolean value. If TRUE, will not overwrite the card's assignment if the card has been forged.
*/
/datum/controller/subsystem/id_access/proc/apply_trim_to_chameleon_card(obj/item/card/id/advanced/chameleon/id_card, trim_path, check_forged = TRUE)
/datum/controller/subsystem/id_access/proc/apply_trim_override(obj/item/card/id/advanced/id_card, trim_path, check_forged = TRUE)
var/datum/id_trim/trim = trim_singletons_by_path[trim_path]
id_card.trim_icon_override = trim.trim_icon
id_card.trim_state_override = trim.trim_state
@@ -452,22 +452,21 @@ SUBSYSTEM_DEF(id_access)
id_card.big_pointer = trim.big_pointer
id_card.pointer_color = trim.pointer_color
if (!check_forged || !id_card.forged)
id_card.assignment = trim.assignment
var/obj/item/card/id/advanced/chameleon/cham_id = id_card
if (istype(cham_id) && (!check_forged || !cham_id.forged))
cham_id.assignment = trim.assignment
if (ishuman(id_card.loc))
var/mob/living/carbon/human/owner = id_card.loc
owner.sec_hud_set_ID()
// We'll let the chameleon action update the card's label as necessary instead of doing it here.
/**
* Removes a trim from a chameleon ID card.
* Removes a trim from a ID card.
*
* Arguments:
* * id_card - The ID card to remove the trim from.
*/
/datum/controller/subsystem/id_access/proc/remove_trim_from_chameleon_card(obj/item/card/id/advanced/chameleon/id_card)
/datum/controller/subsystem/id_access/proc/remove_trim_override(obj/item/card/id/advanced/id_card)
id_card.trim_icon_override = null
id_card.trim_state_override = null
id_card.trim_assignment_override = null
+4 -4
View File
@@ -1593,9 +1593,9 @@
return ..()
balloon_alert(user, "flipped")
if(trim_assignment_override)
SSid_access.remove_trim_from_chameleon_card(src)
SSid_access.remove_trim_override(src)
else
SSid_access.apply_trim_to_chameleon_card(src, alt_trim)
SSid_access.apply_trim_override(src, alt_trim)
update_label()
update_appearance()
@@ -1811,7 +1811,7 @@
if(forged) //reset the ID if forged
registered_name = initial(registered_name)
assignment = initial(assignment)
SSid_access.remove_trim_from_chameleon_card(src)
SSid_access.remove_trim_override(src)
REMOVE_TRAIT(src, TRAIT_MAGNETIC_ID_CARD, CHAMELEON_ITEM_TRAIT)
user.log_message("reset \the [initial(name)] named \"[src]\" to default.", LOG_GAME)
update_label()
@@ -1866,7 +1866,7 @@
registered_name = input_name
if(selected_trim_path)
SSid_access.apply_trim_to_chameleon_card(src, trim_list[selected_trim_path])
SSid_access.apply_trim_override(src, trim_list[selected_trim_path])
if(target_occupation)
assignment = sanitize(target_occupation)
if(new_age)
@@ -145,7 +145,7 @@
var/new_trim = initial(copied_card.trim)
if(new_trim)
SSid_access.apply_trim_to_chameleon_card(agent_card, new_trim, TRUE)
SSid_access.apply_trim_override(agent_card, new_trim, TRUE)
// If the ID card hasn't been forged, we'll check if there has been an assignment set already by any new trim.
// If there has not, we set the assignment to the copied card's default as well as copying over the the
@@ -182,7 +182,7 @@
var/new_trim = initial(job_outfit.id_trim) ? initial(job_outfit.id_trim) : initial(copied_card.trim)
if(new_trim)
SSid_access.apply_trim_to_chameleon_card(agent_card, new_trim, FALSE)
SSid_access.apply_trim_override(agent_card, new_trim, FALSE)
else
agent_card.assignment = job_datum.title
@@ -229,7 +229,7 @@
/datum/action/item_action/chameleon/change/id_trim/update_item(picked_trim_path)
var/obj/item/card/id/advanced/chameleon/agent_card = target
SSid_access.apply_trim_to_chameleon_card(agent_card, picked_trim_path, TRUE)
SSid_access.apply_trim_override(agent_card, picked_trim_path, TRUE)
agent_card.update_label()
agent_card.update_appearance(UPDATE_ICON)
@@ -126,6 +126,10 @@
id_species ||= dna.species.name
id_blood_type ||= dna.blood_type
if(istype(id, /obj/item/card/id/advanced))
var/obj/item/card/id/advanced/advancedID = id
id_job = advancedID.trim_assignment_override || id_job
var/id_examine = span_slightly_larger(separator_hr("This is <em>[src]'s ID card</em>."))
id_examine += "<div class='img_by_text_container'>"
id_examine += "[id_icon]"