Files
VOREStation/code/game/objects/items/weapons/storage/wallets.dm
2016-03-18 13:07:38 +01:00

88 lines
2.1 KiB
Plaintext

/obj/item/weapon/storage/wallet
name = "wallet"
desc = "It can hold a few small and personal things."
storage_slots = 10
icon_state = "wallet"
w_class = 2
can_hold = list(
/obj/item/weapon/spacecash,
/obj/item/weapon/card,
/obj/item/clothing/mask/smokable/cigarette/,
/obj/item/device/flashlight/pen,
/obj/item/seeds,
/obj/item/stack/medical,
/obj/item/weapon/coin,
/obj/item/weapon/dice,
/obj/item/weapon/disk,
/obj/item/weapon/implanter,
/obj/item/weapon/flame/lighter,
/obj/item/weapon/flame/match,
/obj/item/weapon/paper,
/obj/item/weapon/pen,
/obj/item/weapon/photo,
/obj/item/weapon/reagent_containers/dropper,
/obj/item/weapon/screwdriver,
/obj/item/weapon/stamp)
slot_flags = SLOT_ID
var/obj/item/weapon/card/id/front_id = null
/obj/item/weapon/storage/wallet/remove_from_storage(obj/item/W as obj, atom/new_location)
. = ..(W, new_location)
if(.)
if(W == front_id)
front_id = null
name = initial(name)
update_icon()
/obj/item/weapon/storage/wallet/handle_item_insertion(obj/item/W as obj, prevent_warning = 0)
. = ..(W, prevent_warning)
if(.)
if(!front_id && istype(W, /obj/item/weapon/card/id))
front_id = W
name = "[name] ([front_id])"
update_icon()
/obj/item/weapon/storage/wallet/update_icon()
if(front_id)
switch(front_id.icon_state)
if("id")
icon_state = "walletid"
return
if("silver")
icon_state = "walletid_silver"
return
if("gold")
icon_state = "walletid_gold"
return
if("centcom")
icon_state = "walletid_centcom"
return
icon_state = "wallet"
/obj/item/weapon/storage/wallet/GetID()
return front_id
/obj/item/weapon/storage/wallet/GetAccess()
var/obj/item/I = GetID()
if(I)
return I.GetAccess()
else
return ..()
/obj/item/weapon/storage/wallet/random/New()
..()
var/amount = rand(50, 100) + rand(50, 100) // Triangular distribution from 100 to 200
var/obj/item/weapon/spacecash/SC = null
for(var/i in list(100, 50, 20, 10, 5, 1))
if(amount < i)
continue
SC = new(src)
while(amount >= i)
amount -= i
SC.adjust_worth(i, 0)
SC.update_icon()