Files
ArchBTW aac5fb011b (2) Changes Wallet Priority: Standard ID cards now go in order properly: from left to right (#93575)
## About The Pull Request

[previous PR](https://github.com/tgstation/tgstation/pull/93290)
now command ID (silver & gold IDs) priority remain unchanged

example 1
<img width="435" height="105" alt="Screenshot 2025-10-22 112002"
src="https://github.com/user-attachments/assets/44868d9c-7487-4a9a-b0d9-c94ff4182f92"
/>
before
<img width="87" height="87" alt="Screenshot 2025-10-22 111655"
src="https://github.com/user-attachments/assets/a4223d03-f03f-43f0-bb54-fc8795fd1fab"
/>
^ if you were to remove engi id from the wallet above, it will show
robotics id (instead of secoff)
^ before this PR, engi IDs even took priority over wardens
after
<img width="88" height="90" alt="Screenshot 2025-10-22 112010"
src="https://github.com/user-attachments/assets/a16d508c-4819-4d0a-8316-1372a39a25ff"
/>


example 2
<img width="426" height="111" alt="Screenshot 2025-10-22 111714"
src="https://github.com/user-attachments/assets/fd5b563a-e454-4e0e-be7b-7cfbd9507ca3"
/>
before
<img width="87" height="87" alt="Screenshot 2025-10-22 111655"
src="https://github.com/user-attachments/assets/a4223d03-f03f-43f0-bb54-fc8795fd1fab"
/>
after
<img width="85" height="85" alt="Screenshot 2025-10-22 111646"
src="https://github.com/user-attachments/assets/d6f35891-a29f-4d93-bc4f-899064fa6807"
/>

example 3
before the pr, a geneticist id would take wallet priority over a chemist
id (for instance)


priority used to tally up how many 'command/secure access' areas on the
ID, rather than simply sort order.
for reference, these were the areas:
`ACCESS_AI_UPLOAD, ACCESS_ALL_PERSONAL_LOCKERS, ACCESS_ARMORY,
ACCESS_CHANGE_IDS, ACCESS_COMMAND, ACCESS_EVA, ACCESS_KEYCARD_AUTH,
ACCESS_MINISAT, ACCESS_RC_ANNOUNCE, ACCESS_TCOMMS, ACCESS_TECH_STORAGE,
ACCESS_TELEPORTER, ACCESS_VAULT`

ACCESS_FLAG_COMMAND -> ACCESS_FLAG_PRV_COMMAND
so now it only checks if you have specifically head of staff access
instead

## Why It's Good For The Game

- player friendly
- previously lead to wallet tediousness and unpredictability
- make the core functionality and purpose of wallets simple and easy to
understand
- the previous functionality was more unpredictable and confusing when
considering low pop granting extra access to IDs


## Changelog

🆑 ArchBTW
qol: Changes Wallet Priority: Standard ID cards now go in order
properly: from left to right
/🆑
2025-10-24 00:55:21 +02:00

141 lines
3.9 KiB
Plaintext

/obj/item/storage/wallet
name = "wallet"
desc = "It can hold a few small and personal things."
icon_state = "wallet"
w_class = WEIGHT_CLASS_SMALL
resistance_flags = FLAMMABLE
slot_flags = ITEM_SLOT_ID
storage_type = /datum/storage/wallet
var/obj/item/card/id/front_id = null
var/list/combined_access
var/cached_flat_icon
var/overlay_icon_state = "wallet_overlay"
/obj/item/storage/wallet/Exited(atom/movable/gone, direction)
. = ..()
if(isidcard(gone))
refreshID()
/**
* Calculates the new front ID.
*
* Picks the ID card that has the most combined command or higher tier accesses.
*/
/obj/item/storage/wallet/proc/refreshID()
LAZYCLEARLIST(combined_access)
front_id = null
var/winning_tally = 0
var/is_magnetic_found = FALSE
for(var/obj/item/card/id/id_card in contents)
// Certain IDs can forcibly jump to the front so they can disguise other cards in wallets. Chameleon/Agent ID cards are an example of this.
if(!is_magnetic_found && HAS_TRAIT(id_card, TRAIT_MAGNETIC_ID_CARD))
front_id = id_card
is_magnetic_found = TRUE
if(!is_magnetic_found)
var/card_tally = SSid_access.tally_access(id_card, ACCESS_FLAG_PRV_COMMAND)
if(card_tally > winning_tally)
winning_tally = card_tally
front_id = id_card
LAZYINITLIST(combined_access)
combined_access |= id_card.access
// If we didn't pick a front ID - Maybe none of our cards have any command accesses? Just grab the first card (if we even have one).
// We could also have no ID card in the wallet at all, which will mean we end up with a null front_id and that's fine too.
if(!front_id)
front_id = (locate(/obj/item/card/id) in contents)
if(ishuman(loc))
var/mob/living/carbon/human/wearing_human = loc
if(wearing_human.wear_id == src)
wearing_human.update_ID_card()
update_label()
update_appearance(UPDATE_ICON)
update_slot_icon()
/obj/item/storage/wallet/Entered(atom/movable/arrived, atom/old_loc, list/atom/old_locs)
. = ..()
if(isidcard(arrived))
refreshID()
/obj/item/storage/wallet/update_overlays()
. = ..()
cached_flat_icon = null
if(!front_id)
return
. += mutable_appearance(front_id.icon, front_id.icon_state)
. += front_id.overlays
. += mutable_appearance(icon, overlay_icon_state)
/obj/item/storage/wallet/proc/get_cached_flat_icon()
if(!cached_flat_icon)
cached_flat_icon = getFlatIcon(src)
return cached_flat_icon
/obj/item/storage/wallet/get_examine_icon(mob/user)
return icon2html(get_cached_flat_icon(), user)
/obj/item/storage/wallet/proc/update_label()
if(front_id)
name = "[src::name] displaying [front_id]"
else
name = src::name
/obj/item/storage/wallet/examine()
. = ..()
if(front_id)
. += span_notice("Alt-click to remove the id.")
/obj/item/storage/wallet/get_id_examine_strings(mob/user)
. = ..()
if(front_id)
. += front_id.get_id_examine_strings(user)
/obj/item/storage/wallet/GetID()
return front_id
/obj/item/storage/wallet/remove_id()
if(!front_id)
return
. = front_id
front_id.forceMove(get_turf(src))
/obj/item/storage/wallet/insert_id(obj/item/inserting_item)
var/obj/item/card/inserting_id = inserting_item.remove_id()
if(!inserting_id)
return FALSE
attackby(inserting_id)
if(inserting_id in contents)
return TRUE
return FALSE
/obj/item/storage/wallet/GetAccess()
if(LAZYLEN(combined_access))
return combined_access
else
return ..()
/obj/item/storage/wallet/random
icon_state = "random_wallet" // for mapping purposes
worn_icon_state = "wallet"
/obj/item/storage/wallet/random/Initialize(mapload)
. = ..()
icon_state = "wallet"
/obj/item/storage/wallet/random/PopulateContents()
new /obj/item/holochip(src, rand(5, 30))
new /obj/effect/spawner/random/entertainment/wallet_storage(src)
///Used by the toilet fish source.
/obj/item/storage/wallet/money
desc = "It can hold a few small and personal things. This one reeks of toilet water."
/obj/item/storage/wallet/money/PopulateContents()
for(var/iteration in 1 to pick(3, 4))
new /obj/item/holochip(src, rand(50, 450))