Files
Bubberstation/code/game/objects/items/storage/wallets.dm
2017-08-16 10:38:51 -03:00

89 lines
2.5 KiB
Plaintext

/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(
/obj/item/stack/spacecash,
/obj/item/card,
/obj/item/clothing/mask/cigarette,
/obj/item/device/flashlight/pen,
/obj/item/seeds,
/obj/item/stack/medical,
/obj/item/toy/crayon,
/obj/item/coin,
/obj/item/dice,
/obj/item/disk,
/obj/item/implanter,
/obj/item/lighter,
/obj/item/lipstick,
/obj/item/match,
/obj/item/paper,
/obj/item/pen,
/obj/item/photo,
/obj/item/reagent_containers/dropper,
/obj/item/reagent_containers/syringe,
/obj/item/screwdriver,
/obj/item/stamp)
slot_flags = SLOT_ID
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/proc/refreshID()
combined_access.Cut()
for(var/obj/item/card/id/I in contents)
if(!front_id)
front_id = I
update_icon()
combined_access |= I.access
/obj/item/storage/wallet/handle_item_insertion(obj/item/W, prevent_warning = 0)
. = ..()
if(.)
if(istype(W, /obj/item/card/id))
refreshID()
/obj/item/storage/wallet/update_icon()
icon_state = "wallet"
if(front_id)
icon_state = "wallet_[front_id.icon_state]"
/obj/item/storage/wallet/GetID()
return front_id
/obj/item/storage/wallet/GetAccess()
if(combined_access.len)
return combined_access
else
return ..()
/obj/item/storage/wallet/random/PopulateContents()
var/item1_type = pick( /obj/item/stack/spacecash/c10, /obj/item/stack/spacecash/c100, /obj/item/stack/spacecash/c1000, /obj/item/stack/spacecash/c20, /obj/item/stack/spacecash/c200, /obj/item/stack/spacecash/c50, /obj/item/stack/spacecash/c500)
var/item2_type
if(prob(50))
item2_type = pick( /obj/item/stack/spacecash/c10, /obj/item/stack/spacecash/c100, /obj/item/stack/spacecash/c1000, /obj/item/stack/spacecash/c20, /obj/item/stack/spacecash/c200, /obj/item/stack/spacecash/c50, /obj/item/stack/spacecash/c500)
var/item3_type = pick( /obj/item/coin/silver, /obj/item/coin/silver, /obj/item/coin/gold, /obj/item/coin/iron, /obj/item/coin/iron, /obj/item/coin/iron )
spawn(2)
if(item1_type)
new item1_type(src)
if(item2_type)
new item2_type(src)
if(item3_type)
new item3_type(src)