game folder
This commit is contained in:
@@ -1,11 +1,19 @@
|
||||
/obj/item/storage/wallet
|
||||
name = "wallet"
|
||||
desc = "It can hold a few small and personal things."
|
||||
storage_slots = 4
|
||||
icon_state = "wallet"
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
resistance_flags = FLAMMABLE
|
||||
can_hold = list(
|
||||
slot_flags = SLOT_ID
|
||||
|
||||
var/obj/item/card/id/front_id = null
|
||||
var/list/combined_access
|
||||
|
||||
/obj/item/storage/wallet/ComponentInitialize()
|
||||
. = ..()
|
||||
GET_COMPONENT(STR, /datum/component/storage)
|
||||
STR.max_items = 4
|
||||
STR.can_hold = typecacheof(list(
|
||||
/obj/item/stack/spacecash,
|
||||
/obj/item/card,
|
||||
/obj/item/clothing/mask/cigarette,
|
||||
@@ -26,48 +34,39 @@
|
||||
/obj/item/reagent_containers/dropper,
|
||||
/obj/item/reagent_containers/syringe,
|
||||
/obj/item/screwdriver,
|
||||
/obj/item/stamp)
|
||||
slot_flags = SLOT_ID
|
||||
/obj/item/stamp))
|
||||
|
||||
var/obj/item/card/id/front_id = null
|
||||
var/list/combined_access = list()
|
||||
|
||||
|
||||
/obj/item/storage/wallet/remove_from_storage(obj/item/W, atom/new_location)
|
||||
. = ..(W, new_location)
|
||||
if(.)
|
||||
if(istype(W, /obj/item/card/id))
|
||||
if(W == front_id)
|
||||
front_id = null
|
||||
refreshID()
|
||||
update_icon()
|
||||
/obj/item/storage/wallet/Exited(atom/movable/AM)
|
||||
. = ..()
|
||||
refreshID()
|
||||
|
||||
/obj/item/storage/wallet/proc/refreshID()
|
||||
combined_access.Cut()
|
||||
if(!(front_id in src))
|
||||
front_id = null
|
||||
for(var/obj/item/card/id/I in contents)
|
||||
LAZYINITLIST(combined_access)
|
||||
LAZYCLEARLIST(combined_access)
|
||||
if(!front_id)
|
||||
front_id = I
|
||||
update_icon()
|
||||
combined_access |= I.access
|
||||
update_icon()
|
||||
|
||||
/obj/item/storage/wallet/handle_item_insertion(obj/item/W, prevent_warning = 0)
|
||||
/obj/item/storage/wallet/Entered(atom/movable/AM)
|
||||
. = ..()
|
||||
if(.)
|
||||
if(istype(W, /obj/item/card/id))
|
||||
refreshID()
|
||||
refreshID()
|
||||
|
||||
/obj/item/storage/wallet/update_icon()
|
||||
icon_state = "wallet"
|
||||
var/new_state = "wallet"
|
||||
if(front_id)
|
||||
icon_state = "wallet_[front_id.icon_state]"
|
||||
|
||||
|
||||
new_state = "wallet_[front_id.icon_state]"
|
||||
if(new_state != icon_state) //avoid so many icon state changes.
|
||||
icon_state = new_state
|
||||
|
||||
/obj/item/storage/wallet/GetID()
|
||||
return front_id
|
||||
|
||||
/obj/item/storage/wallet/GetAccess()
|
||||
if(combined_access.len)
|
||||
if(LAZYLEN(combined_access))
|
||||
return combined_access
|
||||
else
|
||||
return ..()
|
||||
|
||||
Reference in New Issue
Block a user