Updates storage costs

Storage cost of an item is now twice that of the next smallest item, instead of being equal to the w_class.
Items with w_class 1 or 2 are unaffected. This produces much better behaviour for containers that are limited
by storage space instead of slots, such as how toolboxes are planned to work in a future update.
This commit is contained in:
mwerezak
2015-03-05 10:40:25 -05:00
parent 3be47f5cd9
commit 3bf5a5ca99
19 changed files with 46 additions and 39 deletions

View File

@@ -437,7 +437,7 @@
collection_mode = 1
display_contents_with_number = 1
max_w_class = 3
max_combined_w_class = 100
max_storage_space = 100
/obj/item/weapon/stock_parts
name = "stock part"

View File

@@ -8,10 +8,10 @@
desc = "You wear this on your back and put items into it."
icon_state = "backpack"
item_state = "backpack"
w_class = 4.0
slot_flags = SLOT_BACK //ERROOOOO
w_class = 4
slot_flags = SLOT_BACK
max_w_class = 3
max_combined_w_class = 21
max_storage_space = 28
/obj/item/weapon/storage/backpack/attackby(obj/item/weapon/W as obj, mob/user as mob)
if (src.use_sound)
@@ -40,7 +40,7 @@
origin_tech = "bluespace=4"
icon_state = "holdingpack"
max_w_class = 4
max_combined_w_class = 28
max_storage_space = 56
New()
..()
@@ -88,7 +88,7 @@
w_class = 4.0
storage_slots = 20
max_w_class = 3
max_combined_w_class = 400 // can store a ton of shit!
max_storage_space = 400 // can store a ton of shit!
/obj/item/weapon/storage/backpack/cultpack
name = "trophy rack"

View File

@@ -77,7 +77,7 @@
slot_flags = SLOT_BELT | SLOT_POCKET
w_class = 3
storage_slots = 50
max_combined_w_class = 200 //Doesn't matter what this is, so long as it's more or equal to storage_slots * ore.w_class
max_storage_space = 200 //Doesn't matter what this is, so long as it's more or equal to storage_slots * ore.w_class
max_w_class = 3
can_hold = list(/obj/item/weapon/ore)
@@ -91,7 +91,7 @@
icon = 'icons/obj/hydroponics_machines.dmi'
icon_state = "plantbag"
storage_slots = 50; //the number of plant pieces it can carry.
max_combined_w_class = 200 //Doesn't matter what this is, so long as it's more or equal to storage_slots * plants.w_class
max_storage_space = 200 //Doesn't matter what this is, so long as it's more or equal to storage_slots * plants.w_class
max_w_class = 3
w_class = 2
can_hold = list(/obj/item/weapon/reagent_containers/food/snacks/grown,/obj/item/seeds,/obj/item/weapon/grown)
@@ -249,7 +249,7 @@
icon_state = "cashbag"
desc = "A bag for carrying lots of cash. It's got a big dollar sign printed on the front."
storage_slots = 50; //the number of cash pieces it can carry.
max_combined_w_class = 200 //Doesn't matter what this is, so long as it's more or equal to storage_slots * cash.w_class
max_storage_space = 200 //Doesn't matter what this is, so long as it's more or equal to storage_slots * cash.w_class
max_w_class = 3
w_class = 2
can_hold = list(/obj/item/weapon/coin,/obj/item/weapon/spacecash)

View File

@@ -94,7 +94,7 @@
item_state = "security"
storage_slots = 7
max_w_class = 3
max_combined_w_class = 21
max_storage_space = 28
can_hold = list(
/obj/item/weapon/grenade,
/obj/item/weapon/reagent_containers/spray/pepper,
@@ -154,4 +154,4 @@
item_state = "swatbelt"
storage_slots = 9
max_w_class = 3
max_combined_w_class = 21
max_storage_space = 28

View File

@@ -564,7 +564,7 @@
foldable = /obj/item/stack/sheet/cardboard //BubbleWrap
storage_slots=21
can_hold = list(/obj/item/weapon/light/tube, /obj/item/weapon/light/bulb)
max_combined_w_class = 42 //holds 21 items of w_class 2
max_storage_space = 42 //holds 21 items of w_class 2
use_to_pickup = 1 // for picking up broken bulbs, not that most people will try
/obj/item/weapon/storage/box/lights/bulbs/New()

View File

@@ -7,9 +7,9 @@
force = 8.0
throw_speed = 1
throw_range = 4
w_class = 4.0
w_class = 4
max_w_class = 3
max_combined_w_class = 16
max_storage_space = 16
/obj/item/weapon/storage/briefcase/New()
..()

View File

@@ -47,7 +47,7 @@
icon_type = "egg"
name = "egg box"
storage_slots = 12
max_combined_w_class = 24
max_storage_space = 24
can_hold = list(/obj/item/weapon/reagent_containers/food/snacks/egg)
/obj/item/weapon/storage/fancy/egg_box/New()
@@ -254,9 +254,9 @@
icon = 'icons/obj/vialbox.dmi'
icon_state = "vialbox0"
item_state = "syringe_kit"
max_w_class = 3
max_w_class = 2
can_hold = list(/obj/item/weapon/reagent_containers/glass/beaker/vial)
max_combined_w_class = 14 //The sum of the w_classes of all the items in this storage item.
max_storage_space = 12 //The sum of the w_classes of all the items in this storage item.
storage_slots = 6
req_access = list(access_virology)

View File

@@ -7,7 +7,7 @@
item_state = "syringe_kit"
w_class = 4
max_w_class = 3
max_combined_w_class = 14 //The sum of the w_classes of all the items in this storage item.
max_storage_space = 14 //The sum of the w_classes of all the items in this storage item.
storage_slots = 4
req_access = list(access_armory)
var/locked = 1

View File

@@ -23,9 +23,9 @@
var/l_hacking = 0
var/emagged = 0
var/open = 0
w_class = 3.0
w_class = 3
max_w_class = 2
max_combined_w_class = 14
max_storage_space = 14
examine(mob/user)
if(..(user, 1))

View File

@@ -8,11 +8,11 @@
/obj/item/weapon/storage
name = "storage"
icon = 'icons/obj/storage.dmi'
w_class = 3.0
w_class = 3
var/list/can_hold = new/list() //List of objects which this item can store (if set, it can't store anything else)
var/list/cant_hold = new/list() //List of objects which this item can't store (in effect only if can_hold isn't set)
var/max_w_class = 2 //Max size of objects that this object can store (in effect only if can_hold isn't set)
var/max_combined_w_class = 14 //The sum of the w_classes of all the items in this storage item.
var/max_storage_space = 14 //The sum of the storage costs of all the items in this storage item.
var/storage_slots = 7 //The number of storage slots in this container.
var/obj/screen/storage/boxes = null
var/obj/screen/close/closer = null
@@ -226,16 +226,17 @@
usr << "<span class='notice'>[W] is too big for this [src].</span>"
return 0
var/sum_w_class = W.w_class
var/total_storage_space = W.get_storage_cost()
for(var/obj/item/I in contents)
sum_w_class += I.w_class //Adds up the combined w_classes which will be in the storage item if the item is added to it.
total_storage_space += I.get_storage_cost() //Adds up the combined w_classes which will be in the storage item if the item is added to it.
if(sum_w_class > max_combined_w_class)
if(total_storage_space > max_storage_space)
if(!stop_messages)
usr << "<span class='notice'>[src] is full, make some space.</span>"
return 0
if(W.w_class >= src.w_class && (istype(W, /obj/item/weapon/storage)))
//TODO: remove hack
if(!istype(src, /obj/item/weapon/storage/backpack/holding)) //bohs should be able to hold backpacks again. The override for putting a boh in a boh is in backpack.dm.
if(!stop_messages)
usr << "<span class='notice'>[src] cannot hold [W] as it's a storage item of the same size.</span>"
@@ -265,7 +266,7 @@
usr << "<span class='notice'>You put \the [W] into [src].</span>"
else if (M in range(1)) //If someone is standing close enough, they can tell what it is...
M.show_message("<span class='notice'>[usr] puts [W] into [src].</span>")
else if (W && W.w_class >= 3.0) //Otherwise they can only see large or normal items from a distance...
else if (W && W.w_class >= 3) //Otherwise they can only see large or normal items from a distance...
M.show_message("<span class='notice'>[usr] puts [W] into [src].</span>")
src.orient2hud(usr)
@@ -486,3 +487,6 @@
return -1 //inside something with a null loc.
return depth
/obj/item/proc/get_storage_cost()
return 2**(w_class-1) //1,2,4,8,16,...

View File

@@ -3,7 +3,7 @@
desc = "A folded membrane which rapidly expands into a large cubical shape on activation."
icon = 'icons/obj/inflatable.dmi'
icon_state = "folded_wall"
w_class = 3.0
w_class = 3
attack_self(mob/user)
playsound(loc, 'sound/items/zip.ogg', 75, 1)
@@ -252,7 +252,7 @@
desc = "Contains inflatable walls and doors."
icon_state = "inf_box"
item_state = "syringe_kit"
max_combined_w_class = 21
max_storage_space = 28
can_hold = list(/obj/item/inflatable)
New()

View File

@@ -6,7 +6,7 @@
pockets = new/obj/item/weapon/storage/internal(src)
pockets.storage_slots = 2 //two slots
pockets.max_w_class = 2 //fit only pocket sized items
pockets.max_combined_w_class = 4
pockets.max_storage_space = 4
/obj/item/clothing/suit/storage/attack_hand(mob/user as mob)
if (pockets.handle_attack_hand(user))
@@ -57,7 +57,7 @@
pockets = new/obj/item/weapon/storage/internal(src)
pockets.storage_slots = 4
pockets.max_w_class = 2
pockets.max_combined_w_class = 8
pockets.max_storage_space = 8
/obj/item/clothing/suit/storage/vest

View File

@@ -75,7 +75,7 @@
/obj/item/clothing/accessory/storage/knifeharness/New()
..()
hold.max_combined_w_class = 4
hold.max_storage_space = 4
hold.can_hold = list(/obj/item/weapon/hatchet/unathiknife,\
/obj/item/weapon/kitchen/utensil/knife,\
/obj/item/weapon/kitchen/utensil/pknife,\

View File

@@ -2,6 +2,7 @@
name = "rock"
icon = 'icons/obj/mining.dmi'
icon_state = "ore2"
w_class = 2
var/datum/geosample/geologic_data
var/oretag

View File

@@ -12,7 +12,7 @@
var/fire_pressure // Used in fire checks/pressure checks.
var/max_w_class = 3 // Hopper intake size.
var/max_combined_w_class = 20 // Total internal storage size.
var/max_storage_space = 20 // Total internal storage size.
var/obj/item/weapon/tank/tank = null // Tank of gas for use in firing the cannon.
var/obj/item/weapon/storage/tank_container // Something to hold the tank item so we don't accidentally fire it.
var/pressure_setting = 10 // Percentage of the gas in the tank used to fire the projectile.
@@ -64,13 +64,13 @@
else if(istype(W) && W.w_class <= max_w_class)
var/total_stored = 0
for(var/obj/item/O in src.contents)
total_stored += O.w_class
if(total_stored + W.w_class <= max_combined_w_class)
total_stored += O.get_storage_cost()
if(total_stored + W.get_storage_cost() <= max_storage_space)
user.drop_item(W)
W.loc = src
user << "You shove [W] into the hopper."
else
user << "That won't fit into the hopper - it's full."
user << "That won't fit into the hopper - it's too full."
return
else
user << "That won't fit into the hopper."

View File

@@ -12,6 +12,7 @@
amount_per_transfer_from_this = 10
possible_transfer_amounts = list(5,10,15,25,30,60)
volume = 60
w_class = 2
flags = OPENCONTAINER
var/label_text = ""

View File

@@ -208,7 +208,8 @@
new_item.icon_state = "box"
var/obj/item/weapon/storage/box/new_box = new_item
new_box.max_w_class = pick(1,2,2,3,3,3,4,4)
new_box.max_combined_w_class = rand(new_box.max_w_class, new_box.max_w_class * 10)
var/storage_amount = 2**(new_box.max_w_class-1)
new_box.max_storage_space = rand(storage_amount, storage_amount * 10)
if(prob(30))
apply_image_decorations = 1
if(12)

View File

@@ -31,6 +31,6 @@
slot_flags = SLOT_BELT | SLOT_POCKET
w_class = 3
storage_slots = 50
max_combined_w_class = 200 //Doesn't matter what this is, so long as it's more or equal to storage_slots * ore.w_class
max_storage_space = 200 //Doesn't matter what this is, so long as it's more or equal to storage_slots * ore.w_class
max_w_class = 3
can_hold = list(/obj/item/weapon/fossil)

View File

@@ -117,8 +117,8 @@
/obj/item/weapon/pickaxe/four_pick,\
/obj/item/weapon/pickaxe/five_pick,\
/obj/item/weapon/pickaxe/six_pick)
max_combined_w_class = 17
max_w_class = 4
max_storage_space = 18
max_w_class = 3
use_to_pickup = 1 // for picking up broken bulbs, not that most people will try
/obj/item/weapon/storage/box/excavation/New()