diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 97049254cc10..d0038cf5277e 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -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" diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm index ae7aa27cdc3f..fb79cc447ab9 100644 --- a/code/game/objects/items/cards_ids.dm +++ b/code/game/objects/items/cards_ids.dm @@ -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)) @@ -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) diff --git a/code/game/objects/items/storage/wallets.dm b/code/game/objects/items/storage/wallets.dm index c031e998cdcc..002b72633294 100644 --- a/code/game/objects/items/storage/wallets.dm +++ b/code/game/objects/items/storage/wallets.dm @@ -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 @@ -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() . = ..() diff --git a/code/modules/jobs/access.dm b/code/modules/jobs/access.dm index 550e413f1a59..39eb08749872 100644 --- a/code/modules/jobs/access.dm +++ b/code/modules/jobs/access.dm @@ -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 diff --git a/code/modules/jobs/job_types/_job.dm b/code/modules/jobs/job_types/_job.dm index f850eded96d4..ee953b0fb74d 100644 --- a/code/modules/jobs/job_types/_job.dm +++ b/code/modules/jobs/job_types/_job.dm @@ -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)