mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-25 06:00:16 +01:00
Fix wallet again (#94984)
## About The Pull Request `Moved` -> registers id card in wallet -> `dropped` -> unregisters id card Fixes it by registering in dropped. This does mean we register, unregister, and register again, which is less than ideal - but I'm not sure how else to tackle this cleanly... ## Changelog 🆑 Melbert fix: Fix wallet (again) /🆑
This commit is contained in:
@@ -171,25 +171,19 @@
|
||||
return ..()
|
||||
|
||||
/obj/item/card/id/Moved(atom/old_loc, movement_dir, forced, list/old_locs, momentum_change)
|
||||
if (isitem(old_loc))
|
||||
UnregisterSignal(old_loc, list(COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED))
|
||||
if (ismob(old_loc.loc))
|
||||
UnregisterSignal(old_loc.loc, list(COMSIG_MOVABLE_POINTED, COMSIG_MOB_RETRIEVE_ACCESS))
|
||||
if(isitem(old_loc))
|
||||
unequip_from_item_loc(old_loc)
|
||||
. = ..()
|
||||
if (!isitem(loc))
|
||||
return
|
||||
RegisterSignal(loc, COMSIG_ITEM_EQUIPPED, PROC_REF(on_loc_equipped))
|
||||
RegisterSignal(loc, COMSIG_ITEM_DROPPED, PROC_REF(on_loc_dropped))
|
||||
if (ismob(loc.loc))
|
||||
var/mob/wearer = loc.loc
|
||||
// Equip chain shenanigans
|
||||
UnregisterSignal(wearer, list(COMSIG_MOVABLE_POINTED, COMSIG_MOB_RETRIEVE_ACCESS))
|
||||
on_loc_equipped(loc, wearer, wearer.get_slot_by_item(loc))
|
||||
if(isitem(loc))
|
||||
equip_to_item_loc(loc)
|
||||
|
||||
/obj/item/card/id/equipped(mob/user, slot)
|
||||
. = ..()
|
||||
if (slot & ITEM_SLOT_ID)
|
||||
RegisterSignal(user, COMSIG_MOVABLE_POINTED, PROC_REF(on_pointed))
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/as_human = user
|
||||
as_human.update_visible_name()
|
||||
if (slot & (ITEM_SLOT_ID|ITEM_SLOT_HANDS))
|
||||
RegisterSignal(user, COMSIG_MOB_RETRIEVE_ACCESS, PROC_REF(retrieve_access))
|
||||
if (slot & ITEM_SLOT_POCKETS)
|
||||
@@ -198,15 +192,12 @@
|
||||
|
||||
/obj/item/card/id/dropped(mob/user)
|
||||
UnregisterSignal(user, list(COMSIG_MOVABLE_POINTED, COMSIG_MOB_RETRIEVE_ACCESS))
|
||||
return ..()
|
||||
|
||||
/obj/item/card/id/equipped(mob/user, slot, initial = FALSE)
|
||||
. = ..()
|
||||
if(!(slot & ITEM_SLOT_ID))
|
||||
return
|
||||
if(isitem(loc))
|
||||
equip_to_item_loc(loc) // "dropped" into an item, like a worn wallet
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/as_human = user
|
||||
as_human.update_visible_name()
|
||||
return ..()
|
||||
|
||||
/obj/item/card/id/dropped(mob/user, silent = FALSE)
|
||||
. = ..()
|
||||
@@ -220,6 +211,22 @@
|
||||
return honorific_title
|
||||
return registered_name
|
||||
|
||||
/// ID card is being equipped to an item (like a pda or wallet)
|
||||
/obj/item/card/id/proc/equip_to_item_loc(atom/new_loc)
|
||||
RegisterSignal(new_loc, COMSIG_ITEM_EQUIPPED, PROC_REF(on_loc_equipped), override = TRUE)
|
||||
RegisterSignal(new_loc, COMSIG_ITEM_DROPPED, PROC_REF(on_loc_dropped), override = TRUE)
|
||||
if (ismob(new_loc.loc))
|
||||
var/mob/wearer = new_loc.loc
|
||||
// Equip chain shenanigans
|
||||
UnregisterSignal(wearer, list(COMSIG_MOVABLE_POINTED, COMSIG_MOB_RETRIEVE_ACCESS))
|
||||
on_loc_equipped(new_loc, wearer, wearer.get_slot_by_item(new_loc))
|
||||
|
||||
/// ID card is being unequipped from an item (like a pda or wallet)
|
||||
/obj/item/card/id/proc/unequip_from_item_loc(atom/old_loc)
|
||||
UnregisterSignal(old_loc, list(COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED))
|
||||
if (ismob(old_loc.loc))
|
||||
UnregisterSignal(old_loc.loc, list(COMSIG_MOVABLE_POINTED, COMSIG_MOB_RETRIEVE_ACCESS))
|
||||
|
||||
/obj/item/card/id/proc/on_loc_equipped(datum/source, mob/equipper, slot)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
|
||||
Reference in New Issue
Block a user