From 7afa6cb087b406146d0d76660d0a9437fdf9b262 Mon Sep 17 00:00:00 2001 From: Contrabang <91113370+Contrabang@users.noreply.github.com> Date: Wed, 25 Jan 2023 14:13:38 -0500 Subject: [PATCH] Wallets and ID card tweaks (#20250) * wallet the third * MORE id card tweaks * farie review --- .../objects/items/weapons/storage/wallets.dm | 22 ++++++++++++++---- code/modules/mob/living/carbon/human/human.dm | 23 +++++++++---------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/code/game/objects/items/weapons/storage/wallets.dm b/code/game/objects/items/weapons/storage/wallets.dm index 3f550a23d2f..f44d5d5b7b5 100644 --- a/code/game/objects/items/weapons/storage/wallets.dm +++ b/code/game/objects/items/weapons/storage/wallets.dm @@ -57,7 +57,7 @@ if(wearing_human.wear_id == src) wearing_human.sec_hud_set_ID() - update_icon(UPDATE_ICON_STATE) + update_appearance(UPDATE_NAME|UPDATE_ICON_STATE) /obj/item/storage/wallet/update_icon_state() if(front_id) @@ -77,6 +77,16 @@ icon_state = "wallet" +/obj/item/storage/wallet/update_name(updates) + . = ..() + if(front_id) + name = "wallet displaying [front_id]" + else + name = get_empty_wallet_name() + +/obj/item/storage/wallet/proc/get_empty_wallet_name() + return initial(name) + /obj/item/storage/wallet/GetID() return front_id @@ -118,12 +128,11 @@ new color_wallet(loc) qdel(src) return - UpdateDesc() + update_appearance(UPDATE_NAME|UPDATE_DESC|UPDATE_ICON_STATE) -/obj/item/storage/wallet/color/proc/UpdateDesc() - name = "cheap [item_color] wallet" +/obj/item/storage/wallet/color/update_desc(updates) + . = ..() desc = "A cheap, [item_color] wallet from the arcade." - icon_state = "[item_color]_wallet" /obj/item/storage/wallet/color/update_icon_state() if(front_id) @@ -159,3 +168,6 @@ /obj/item/storage/waller/color/brown item_color = "brown" + +/obj/item/storage/wallet/color/get_empty_wallet_name() + return "cheap [item_color] wallet" diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 2d1bc194aec..5b09993fb01 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -494,12 +494,13 @@ //gets name from ID or PDA itself, ID inside PDA doesn't matter //Useful when player is being seen by other mobs /mob/living/carbon/human/proc/get_id_name(if_no_id = "Unknown") - var/obj/item/pda/pda = wear_id - var/obj/item/card/id/id = wear_id - if(istype(pda)) . = pda.owner - else if(istype(id)) . = id.registered_name - if(!.) . = if_no_id //to prevent null-names making the mob unclickable - return + var/obj/item/card/id/id = wear_id?.GetID() + if(istype(id)) + return id.registered_name + if(is_pda(wear_id)) + var/obj/item/pda/pda = wear_id + return pda.owner + return if_no_id //to prevent null-names making the mob unclickable //gets ID card object from special clothes slot or, if applicable, hands as well /mob/living/carbon/human/proc/get_idcard(check_hands = FALSE) @@ -1774,15 +1775,13 @@ Eyes need to have significantly high darksight to shine unless the mob has the X /mob/living/carbon/human/can_track(mob/living/user) if(wear_id) - var/obj/item/card/id/id = wear_id + var/obj/item/card/id/id = wear_id.GetID() if(istype(id) && id.is_untrackable()) return 0 if(wear_pda) - var/obj/item/pda/pda = wear_pda - if(istype(pda)) - var/obj/item/card/id/id = pda.id - if(istype(id) && id.is_untrackable()) - return 0 + var/obj/item/card/id/id = wear_pda.GetID() + if(istype(id) && id.is_untrackable()) + return 0 if(istype(head, /obj/item/clothing/head)) var/obj/item/clothing/head/hat = head if(hat.blockTracking)