Files
CHOMPstation/code/game/objects/items/weapons/storage/wallets.dm
T
Neerti 828dacf485 Centralizes weight class definitions
A lot of new defines are now in inventory_sizes.dm, which contains;
All the size identifiers (the thing that tells the game if something is bulky, or w/e).
Storage costs for all the sizes, which are exponents of two, as previously.
A few constants for inventory size.

Also changes all storage item's capacity definitions by basing it off of how many 'normal slots' exist for it.  This allows one to change the definition for all of the defines in the file, and everything will follow along without needing to change 500 files.  In testing, I made all ITEMSIZE_COST_* defines doubled, and nothing had broke.

The benefit of doing all of this is that it makes adding new weight classes in the future much simpler, and makes knowing how much space a container has easier, as seeing ITEMSIZE_COST_NORMAL * 7 means it can hold seven normal items.
2016-09-22 00:51:51 -04:00

114 lines
3.0 KiB
Plaintext

/obj/item/weapon/storage/wallet
name = "wallet"
desc = "It can hold a few small and personal things."
storage_slots = 10
icon = 'icons/obj/wallet.dmi'
icon_state = "wallet-orange"
w_class = ITEMSIZE_SMALL
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()
overlays.Cut()
if(front_id)
var/tiny_state = "id-generic"
if("id-"+front_id.icon_state in icon_states(icon))
tiny_state = "id-"+front_id.icon_state
var/image/tiny_image = new/image(icon, icon_state = tiny_state)
tiny_image.appearance_flags = RESET_COLOR
overlays += tiny_image
/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()
/obj/item/weapon/storage/wallet/poly
name = "polychromic wallet"
desc = "You can recolor it! Fancy! The future is NOW!"
icon_state = "wallet-white"
/obj/item/weapon/storage/wallet/poly/New()
..()
verbs |= /obj/item/weapon/storage/wallet/poly/proc/change_color
color = "#"+get_random_colour()
update_icon()
/obj/item/weapon/storage/wallet/poly/proc/change_color()
set name = "Change Wallet Color"
set category = "Object"
set desc = "Change the color of the wallet."
set src in usr
if(usr.stat || usr.restrained() || usr.incapacitated())
return
var/new_color = input(usr, "Pick a new color", "Wallet Color", color) as color|null
if(new_color && (new_color != color))
color = new_color
/obj/item/weapon/storage/wallet/poly/emp_act()
var/original_state = icon_state
icon_state = "wallet-emp"
update_icon()
spawn(200)
if(src)
icon_state = original_state
update_icon()