Skip to content

Commit

Permalink
Two fixes relating to IDs (#3196)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request
Fixes runtimes caused by mobs without ids trying to open doors and
wallets not having there access untill you reinsert your wallet

IDs now send a signal that there access has been changed which wallets
listen for.
<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

## Why It's Good For The Game
Fixes two bugs I caused!
Fixes #3137
<!-- Please add a short description of why you think these changes would
benefit the game. If you can't justify it in words, it might not be
worth adding. -->

## Changelog

:cl:
fix: pets no longer cause run times trying to open ship doors
fix: no longer have to reinsert your id into your wallet for access
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
  • Loading branch information
FalloutFalcon authored Jul 12, 2024
1 parent 0644edb commit 00ebf40
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -789,3 +789,6 @@

///called when an elzu should unroot
#define COMSIG_DIGOUT "dig_out"

///sent when the access on an id is changed/updated, ensures wallets get updated once ids generate there access
#define COSMIG_ACCESS_UPDATED "acces_updated"
3 changes: 3 additions & 0 deletions code/game/objects/items/cards_ids.dm
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
. = ..()
if(mapload && access_txt)
access = text2access(access_txt)
SEND_SIGNAL(src, COSMIG_ACCESS_UPDATED)
update_label()
update_appearance()
RegisterSignal(src, COMSIG_ATOM_UPDATED_ICON, PROC_REF(update_in_wallet))
Expand Down Expand Up @@ -259,11 +260,13 @@
/obj/item/card/id/proc/add_ship_access(datum/overmap/ship/controlled/ship)
if (ship)
ship_access += ship
SEND_SIGNAL(src, COSMIG_ACCESS_UPDATED)

// Removes the referenced ship from the card
/obj/item/card/id/proc/remove_ship_access(datum/overmap/ship/controlled/ship)
if (ship)
ship_access -= ship
SEND_SIGNAL(src, COSMIG_ACCESS_UPDATED)

// Finds the referenced ship in the list
/obj/item/card/id/proc/has_ship_access(datum/overmap/ship/controlled/ship)
Expand Down
8 changes: 5 additions & 3 deletions code/game/objects/items/storage/wallets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@

/obj/item/storage/wallet/Exited(atom/movable/AM)
. = ..()
refreshID()
UnregisterSignal(AM, COSMIG_ACCESS_UPDATED)
refresh_id()

/obj/item/storage/wallet/proc/refreshID()
/obj/item/storage/wallet/proc/refresh_id()
LAZYCLEARLIST(combined_access)
if(!(front_id in src))
front_id = null
Expand All @@ -61,7 +62,8 @@

/obj/item/storage/wallet/Entered(atom/movable/AM)
. = ..()
refreshID()
RegisterSignal(AM, COSMIG_ACCESS_UPDATED, PROC_REF(refresh_id))
refresh_id()

/obj/item/storage/wallet/update_overlays()
. = ..()
Expand Down
2 changes: 2 additions & 0 deletions code/modules/jobs/access.dm
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@
if (gen_ship_access(ship))
return TRUE

if(!item)
return FALSE
var/obj/item/card/id/id = item?.GetID()
if (id?.has_ship_access(ship))
return TRUE
Expand Down
1 change: 1 addition & 0 deletions code/modules/jobs/job_types/_job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@
var/obj/item/card/id/C = H.get_idcard(TRUE)
if(istype(C))
C.access = J.get_access()
SEND_SIGNAL(C, COSMIG_ACCESS_UPDATED)
shuffle_inplace(C.access) // Shuffle access list to make NTNet passkeys less predictable
C.registered_name = H.real_name
if(H.job)
Expand Down

0 comments on commit 00ebf40

Please sign in to comment.