diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm
index f66b668664..2934e5d68d 100644
--- a/code/game/objects/items.dm
+++ b/code/game/objects/items.dm
@@ -10,6 +10,7 @@
var/burn_point = null
var/burning = null
var/hitsound = null
+ var/storage_cost = null
var/slot_flags = 0 //This is used to determine on which slots an item can fit.
var/no_attack_log = 0 //If it's an item we don't want to log attack_logs with, set this to 1
pass_flags = PASSTABLE
@@ -358,7 +359,7 @@ var/list/global/slot_flags_enumeration = list(
var/allow = 0
if(H.back && istype(H.back, /obj/item/weapon/storage/backpack))
var/obj/item/weapon/storage/backpack/B = H.back
- if(B.contents.len < B.storage_slots && w_class <= B.max_w_class)
+ if(B.can_be_inserted(src,1))
allow = 1
if(!allow)
return 0
diff --git a/code/game/objects/items/weapons/storage/backpack.dm b/code/game/objects/items/weapons/storage/backpack.dm
index 1f1d5e9eec..8509172581 100644
--- a/code/game/objects/items/weapons/storage/backpack.dm
+++ b/code/game/objects/items/weapons/storage/backpack.dm
@@ -22,7 +22,7 @@
)
w_class = 4
slot_flags = SLOT_BACK
- max_w_class = 3
+ max_w_class = 4
max_storage_space = 28
/obj/item/weapon/storage/backpack/attackby(obj/item/weapon/W as obj, mob/user as mob)
@@ -53,6 +53,7 @@
icon_state = "holdingpack"
max_w_class = 4
max_storage_space = 56
+ storage_cost = 29
New()
..()
@@ -77,7 +78,6 @@
icon_state = "giftbag0"
item_state = "giftbag"
w_class = 4.0
- storage_slots = 20
max_w_class = 3
max_storage_space = 400 // can store a ton of shit!
item_state_slots = null
@@ -155,8 +155,7 @@
slot_r_hand_str = "duffle",
)
slowdown = 1
- max_storage_space = 38
- storage_slots = 12
+ max_storage_space = 36
/obj/item/weapon/storage/backpack/dufflebag/syndie
name = "black dufflebag"
diff --git a/code/game/objects/items/weapons/storage/bags.dm b/code/game/objects/items/weapons/storage/bags.dm
index 33fa1d6d7e..476bf1a67e 100644
--- a/code/game/objects/items/weapons/storage/bags.dm
+++ b/code/game/objects/items/weapons/storage/bags.dm
@@ -34,7 +34,6 @@
w_class = 4
max_w_class = 2
- storage_slots = 21
can_hold = list() // any
cant_hold = list(/obj/item/weapon/disk/nuclear)
@@ -61,7 +60,6 @@
w_class = 4
max_w_class = 2
- storage_slots = 21
can_hold = list() // any
cant_hold = list(/obj/item/weapon/disk/nuclear)
@@ -76,8 +74,7 @@
icon_state = "satchel"
slot_flags = SLOT_BELT | SLOT_POCKET
w_class = 3
- storage_slots = 50
- 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_storage_space = 100
max_w_class = 3
can_hold = list(/obj/item/weapon/ore)
@@ -90,8 +87,7 @@
name = "plant bag"
icon = 'icons/obj/hydroponics_machines.dmi'
icon_state = "plantbag"
- storage_slots = 50; //the number of plant pieces it can carry.
- 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_storage_space = 100
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)
@@ -111,6 +107,7 @@
var/capacity = 300; //the number of sheets it can carry.
w_class = 3
+ storage_slots = 7
allow_quick_empty = 1 // this function is superceded
New()
@@ -193,7 +190,7 @@
var/col_count = min(7,storage_slots) -1
if (adjusted_contents > 7)
row_num = round((adjusted_contents-1) / 7) // 7 is the maximum allowed width.
- src.standard_orient_objs(row_num, col_count, numbered_contents)
+ src.slot_orient_objs(row_num, col_count, numbered_contents)
return
@@ -248,8 +245,7 @@
icon = 'icons/obj/storage.dmi'
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_storage_space = 200 //Doesn't matter what this is, so long as it's more or equal to storage_slots * cash.w_class
+ max_storage_space = 100
max_w_class = 3
w_class = 2
can_hold = list(/obj/item/weapon/coin,/obj/item/weapon/spacecash)
diff --git a/code/game/objects/items/weapons/storage/belt.dm b/code/game/objects/items/weapons/storage/belt.dm
index 399bd0b7a2..478272b8b2 100644
--- a/code/game/objects/items/weapons/storage/belt.dm
+++ b/code/game/objects/items/weapons/storage/belt.dm
@@ -4,6 +4,9 @@
icon = 'icons/obj/clothing/belts.dmi'
icon_state = "utilitybelt"
item_state = "utility"
+ storage_slots = 7
+ max_storage_space = 28 //This should ensure belts always have enough room to store whatever.
+ max_w_class = 3
slot_flags = SLOT_BELT
attack_verb = list("whipped", "lashed", "disciplined")
sprite_sheets = list("Teshari" = 'icons/mob/species/seromi/belt.dmi')
@@ -121,9 +124,7 @@
desc = "Can hold security gear like handcuffs and flashes."
icon_state = "securitybelt"
item_state = "security"
- storage_slots = 7
max_w_class = 3
- max_storage_space = 28
can_hold = list(
/obj/item/weapon/grenade,
/obj/item/weapon/reagent_containers/spray/pepper,
diff --git a/code/game/objects/items/weapons/storage/boxes.dm b/code/game/objects/items/weapons/storage/boxes.dm
index 62a9117de1..657d2f4f5a 100644
--- a/code/game/objects/items/weapons/storage/boxes.dm
+++ b/code/game/objects/items/weapons/storage/boxes.dm
@@ -25,6 +25,7 @@
icon_state = "box"
item_state = "syringe_kit"
var/foldable = /obj/item/stack/material/cardboard // BubbleWrap - if set, can be folded (when empty) into a sheet of cardboard
+ max_w_class = 2
// BubbleWrap - A box can be folded up to make card
/obj/item/weapon/storage/box/attack_self(mob/user as mob)
@@ -498,12 +499,11 @@
desc = "Drymate brand monkey cubes. Just add water!"
icon = 'icons/obj/food.dmi'
icon_state = "monkeycubebox"
- storage_slots = 7
can_hold = list(/obj/item/weapon/reagent_containers/food/snacks/monkeycube)
New()
..()
if(src.type == /obj/item/weapon/storage/box/monkeycubes)
- for(var/i = 1; i <= 5; i++)
+ for(var/i = 1 to 5)
new /obj/item/weapon/reagent_containers/food/snacks/monkeycube/wrapped(src)
/obj/item/weapon/storage/box/monkeycubes/farwacubes
@@ -511,7 +511,7 @@
desc = "Drymate brand farwa cubes, shipped from Ahdomai. Just add water!"
New()
..()
- for(var/i = 1; i <= 5; i++)
+ for(var/i = 1 to 5)
new /obj/item/weapon/reagent_containers/food/snacks/monkeycube/wrapped/farwacube(src)
/obj/item/weapon/storage/box/monkeycubes/stokcubes
@@ -519,7 +519,7 @@
desc = "Drymate brand stok cubes, shipped from Moghes. Just add water!"
New()
..()
- for(var/i = 1; i <= 5; i++)
+ for(var/i = 1 to 5)
new /obj/item/weapon/reagent_containers/food/snacks/monkeycube/wrapped/stokcube(src)
/obj/item/weapon/storage/box/monkeycubes/neaeracubes
@@ -527,7 +527,7 @@
desc = "Drymate brand neaera cubes, shipped from Jargon 4. Just add water!"
New()
..()
- for(var/i = 1; i <= 5; i++)
+ for(var/i = 1 to 5)
new /obj/item/weapon/reagent_containers/food/snacks/monkeycube/wrapped/neaeracube(src)
/obj/item/weapon/storage/box/ids
@@ -612,11 +612,10 @@
desc = "Eight wrappers of fun! Ages 8 and up. Not suitable for children."
icon = 'icons/obj/toy.dmi'
icon_state = "spbox"
- storage_slots = 8
can_hold = list(/obj/item/toy/snappop)
New()
..()
- for(var/i=1; i <= storage_slots; i++)
+ for(var/i = 1 to 8)
new /obj/item/toy/snappop(src)
/obj/item/weapon/storage/box/matches
@@ -625,14 +624,13 @@
icon = 'icons/obj/cigarettes.dmi'
icon_state = "matchbox"
item_state = "zippo"
- storage_slots = 10
w_class = 1
slot_flags = SLOT_BELT
can_hold = list(/obj/item/weapon/flame/match)
New()
..()
- for(var/i=1; i <= storage_slots; i++)
+ for(var/i=1 to 10)
new /obj/item/weapon/flame/match(src)
attackby(obj/item/weapon/flame/match/W as obj, mob/user as mob)
@@ -650,7 +648,7 @@
icon_state = "syringe"
New()
..()
- for (var/i; i < storage_slots; i++)
+ for (var/i = 1 to 7)
new /obj/item/weapon/reagent_containers/hypospray/autoinjector(src)
/obj/item/weapon/storage/box/lights
@@ -696,7 +694,6 @@
icon_state = "portafreezer"
item_state = "medicalpack"
foldable = null
- storage_slots=7
max_w_class = 3
can_hold = list(/obj/item/organ, /obj/item/weapon/reagent_containers/food, /obj/item/weapon/reagent_containers/glass)
max_storage_space = 21
diff --git a/code/game/objects/items/weapons/storage/fancy.dm b/code/game/objects/items/weapons/storage/fancy.dm
index 1af88c9fa8..758ac8dc39 100644
--- a/code/game/objects/items/weapons/storage/fancy.dm
+++ b/code/game/objects/items/weapons/storage/fancy.dm
@@ -53,7 +53,7 @@
/obj/item/weapon/storage/fancy/egg_box/New()
..()
- for(var/i=1; i <= storage_slots; i++)
+ for(var/i=1 to storage_slots)
new /obj/item/weapon/reagent_containers/food/snacks/egg(src)
return
@@ -68,14 +68,13 @@
icon_state = "candlebox5"
icon_type = "candle"
item_state = "candlebox5"
- storage_slots = 5
throwforce = 2
slot_flags = SLOT_BELT
/obj/item/weapon/storage/fancy/candle_box/New()
..()
- for(var/i=1; i <= storage_slots; i++)
+ for(var/i=1 to 5)
new /obj/item/weapon/flame/candle(src)
return
@@ -89,7 +88,6 @@
icon = 'icons/obj/crayons.dmi'
icon_state = "crayonbox"
w_class = 2.0
- storage_slots = 6
icon_type = "crayon"
can_hold = list(
/obj/item/weapon/pen/crayon
@@ -144,27 +142,42 @@
for(var/i = 1 to storage_slots)
new /obj/item/clothing/mask/smokable/cigarette(src)
create_reagents(15 * storage_slots)//so people can inject cigarettes without opening a packet, now with being able to inject the whole one
+ flags |= OPENCONTAINER
/obj/item/weapon/storage/fancy/cigarettes/update_icon()
icon_state = "[initial(icon_state)][contents.len]"
return
/obj/item/weapon/storage/fancy/cigarettes/remove_from_storage(obj/item/W as obj, atom/new_location)
+ // Don't try to transfer reagents to lighters
+ if(istype(W, /obj/item/clothing/mask/smokable/cigarette))
var/obj/item/clothing/mask/smokable/cigarette/C = W
- if(!istype(C)) return // what
reagents.trans_to_obj(C, (reagents.total_volume/contents.len))
- ..()
+ ..()
/obj/item/weapon/storage/fancy/cigarettes/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob)
if(!istype(M, /mob))
return
- if(M == user && user.zone_sel.selecting == O_MOUTH && contents.len > 0 && !user.wear_mask)
- var/obj/item/clothing/mask/smokable/cigarette/W = new /obj/item/clothing/mask/smokable/cigarette(user)
- reagents.trans_to_obj(W, (reagents.total_volume/contents.len))
- user.equip_to_slot_if_possible(W, slot_wear_mask)
+ if(M == user && user.zone_sel.selecting == O_MOUTH)
+ // Find ourselves a cig. Note that we could be full of lighters.
+ var/obj/item/clothing/mask/smokable/cigarette/cig = locate() in src
+
+ if(cig == null)
+ user << "Looks like the packet is out of cigarettes."
+ return
+
+ // Instead of running equip_to_slot_if_possible() we check here first,
+ // to avoid dousing cig with reagents if we're not going to equip it
+ if(!cig.mob_can_equip(user, slot_wear_mask))
+ return
+
+ // We call remove_from_storage first to manage the reagent transfer and
+ // UI updates.
+ remove_from_storage(cig, null)
+ user.equip_to_slot(cig, slot_wear_mask)
+
reagents.maximum_volume = 15 * contents.len
- contents.len--
user << "You take a cigarette out of the pack."
update_icon()
else
@@ -248,21 +261,6 @@
reagents.trans_to_obj(C, (reagents.total_volume/contents.len))
..()
-/obj/item/weapon/storage/fancy/cigar/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob)
- if(!istype(M, /mob))
- return
-
- if(M == user && user.zone_sel.selecting == O_MOUTH && contents.len > 0 && !user.wear_mask)
- var/obj/item/clothing/mask/smokable/cigarette/cigar/W = new /obj/item/clothing/mask/smokable/cigarette/cigar(user)
- reagents.trans_to_obj(W, (reagents.total_volume/contents.len))
- user.equip_to_slot_if_possible(W, slot_wear_mask)
- reagents.maximum_volume = 15 * contents.len
- contents.len--
- user << "You take a cigar out of the case."
- update_icon()
- else
- ..()
-
/*
* Vial Box
*/
@@ -278,7 +276,7 @@
/obj/item/weapon/storage/fancy/vials/New()
..()
- for(var/i=1; i <= storage_slots; i++)
+ for(var/i=1 to 6)
new /obj/item/weapon/reagent_containers/glass/beaker/vial(src)
return
diff --git a/code/game/objects/items/weapons/storage/firstaid.dm b/code/game/objects/items/weapons/storage/firstaid.dm
index dad95da904..9b9918d92f 100644
--- a/code/game/objects/items/weapons/storage/firstaid.dm
+++ b/code/game/objects/items/weapons/storage/firstaid.dm
@@ -162,7 +162,6 @@
can_hold = list(/obj/item/weapon/reagent_containers/pill,/obj/item/weapon/dice,/obj/item/weapon/paper)
allow_quick_gather = 1
use_to_pickup = 1
- storage_slots = 14
use_sound = null
/obj/item/weapon/storage/pill_bottle/antitox
diff --git a/code/game/objects/items/weapons/storage/lockbox.dm b/code/game/objects/items/weapons/storage/lockbox.dm
index 33d462eff2..e8f09a0ab3 100644
--- a/code/game/objects/items/weapons/storage/lockbox.dm
+++ b/code/game/objects/items/weapons/storage/lockbox.dm
@@ -8,7 +8,6 @@
w_class = 4
max_w_class = 3
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
var/broken = 0
diff --git a/code/game/objects/items/weapons/storage/misc.dm b/code/game/objects/items/weapons/storage/misc.dm
index eb63c96cb8..8d954d5306 100644
--- a/code/game/objects/items/weapons/storage/misc.dm
+++ b/code/game/objects/items/weapons/storage/misc.dm
@@ -15,14 +15,13 @@
icon = 'icons/obj/food.dmi'
icon_state = "donutbox"
name = "donut box"
- storage_slots = 6
var/startswith = 6
can_hold = list(/obj/item/weapon/reagent_containers/food/snacks/donut)
foldable = /obj/item/stack/material/cardboard
/obj/item/weapon/storage/box/donut/New()
..()
- for(var/i=1; i <= startswith; i++)
+ for(var/i=1 to startswith)
new /obj/item/weapon/reagent_containers/food/snacks/donut/normal(src)
update_icon()
return
diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm
index 3cb92b0a3c..431b5ca4d7 100644
--- a/code/game/objects/items/weapons/storage/storage.dm
+++ b/code/game/objects/items/weapons/storage/storage.dm
@@ -15,9 +15,15 @@
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/list/is_seeing = new/list() //List of mobs which are currently seeing the contents of this item's storage
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_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/max_storage_space = 8 //The sum of the storage costs of all the items in this storage item.
+ var/storage_slots = null //The number of storage slots in this container. If null, it uses the volume-based storage instead.
var/obj/screen/storage/boxes = null
+ var/obj/screen/storage/storage_start = null //storage UI
+ var/obj/screen/storage/storage_continue = null
+ var/obj/screen/storage/storage_end = null
+ var/obj/screen/storage/stored_start = null
+ var/obj/screen/storage/stored_continue = null
+ var/obj/screen/storage/stored_end = null
var/obj/screen/close/closer = null
var/use_to_pickup //Set this to make it possible to use this item in an inverse way, so you can have the item in your hand and click items on the floor to pick them up.
var/display_contents_with_number //Set this to make the storage item group contents of the same type and display them as a number.
@@ -29,6 +35,12 @@
/obj/item/weapon/storage/Destroy()
close_all()
qdel(boxes)
+ qdel(src.storage_start)
+ qdel(src.storage_continue)
+ qdel(src.storage_end)
+ qdel(src.stored_start)
+ qdel(src.stored_continue)
+ qdel(src.stored_end)
qdel(closer)
..()
@@ -92,11 +104,19 @@
if(user.s_active)
user.s_active.hide_from(user)
user.client.screen -= src.boxes
+ user.client.screen -= src.storage_start
+ user.client.screen -= src.storage_continue
+ user.client.screen -= src.storage_end
user.client.screen -= src.closer
user.client.screen -= src.contents
- user.client.screen += src.boxes
user.client.screen += src.closer
user.client.screen += src.contents
+ if(storage_slots)
+ user.client.screen += src.boxes
+ else
+ user.client.screen += src.storage_start
+ user.client.screen += src.storage_continue
+ user.client.screen += src.storage_end
user.s_active = src
is_seeing |= user
return
@@ -106,6 +126,9 @@
if(!user.client)
return
user.client.screen -= src.boxes
+ user.client.screen -= src.storage_start
+ user.client.screen -= src.storage_continue
+ user.client.screen -= src.storage_end
user.client.screen -= src.closer
user.client.screen -= src.contents
if(user.s_active == src)
@@ -157,7 +180,7 @@
return
//This proc draws out the inventory and places the items on it. It uses the standard position.
-/obj/item/weapon/storage/proc/standard_orient_objs(var/rows, var/cols, var/list/obj/item/display_contents)
+/obj/item/weapon/storage/proc/slot_orient_objs(var/rows, var/cols, var/list/obj/item/display_contents)
var/cx = 4
var/cy = 2+rows
src.boxes.screen_loc = "4:16,2:16 to [4+cols]:16,[2+rows]:16"
@@ -183,6 +206,52 @@
src.closer.screen_loc = "[4+cols+1]:16,2:16"
return
+/obj/item/weapon/storage/proc/space_orient_objs(var/list/obj/item/display_contents)
+
+ var/baseline_max_storage_space = 16 //should be equal to default backpack capacity
+ var/storage_cap_width = 2 //length of sprite for start and end of the box representing total storage space
+ var/stored_cap_width = 4 //length of sprite for start and end of the box representing the stored item
+ var/storage_width = min( round( 224 * max_storage_space/baseline_max_storage_space ,1) ,284) //length of sprite for the box representing total storage space
+
+ storage_start.overlays.Cut()
+
+ var/matrix/M = matrix()
+ M.Scale((storage_width-storage_cap_width*2+3)/32,1)
+ src.storage_continue.transform = M
+
+ src.storage_start.screen_loc = "4:16,2:16"
+ src.storage_continue.screen_loc = "4:[storage_cap_width+(storage_width-storage_cap_width*2)/2+2],2:16"
+ src.storage_end.screen_loc = "4:[19+storage_width-storage_cap_width],2:16"
+
+ var/startpoint = 0
+ var/endpoint = 1
+
+ for(var/obj/item/O in contents)
+ startpoint = endpoint + 1
+ endpoint += storage_width * O.get_storage_cost()/max_storage_space
+
+ var/matrix/M_start = matrix()
+ var/matrix/M_continue = matrix()
+ var/matrix/M_end = matrix()
+ M_start.Translate(startpoint,0)
+ M_continue.Scale((endpoint-startpoint-stored_cap_width*2)/32,1)
+ M_continue.Translate(startpoint+stored_cap_width+(endpoint-startpoint-stored_cap_width*2)/2 - 16,0)
+ M_end.Translate(endpoint-stored_cap_width,0)
+ src.stored_start.transform = M_start
+ src.stored_continue.transform = M_continue
+ src.stored_end.transform = M_end
+ storage_start.overlays += src.stored_start
+ storage_start.overlays += src.stored_continue
+ storage_start.overlays += src.stored_end
+
+ O.screen_loc = "4:[round((startpoint+endpoint)/2)+2],2:16"
+ O.maptext = ""
+ O.layer = 20
+
+ src.closer.screen_loc = "4:[storage_width+19],2:16"
+ return
+
+
/datum/numbered_display
var/obj/item/sample_object
var/number
@@ -214,12 +283,14 @@
adjusted_contents++
numbered_contents.Add( new/datum/numbered_display(I) )
- //var/mob/living/carbon/human/H = user
- var/row_num = 0
- var/col_count = min(7,storage_slots) -1
- if (adjusted_contents > 7)
- row_num = round((adjusted_contents-1) / 7) // 7 is the maximum allowed width.
- src.standard_orient_objs(row_num, col_count, numbered_contents)
+ if(storage_slots == null)
+ src.space_orient_objs(numbered_contents)
+ else
+ var/row_num = 0
+ var/col_count = min(7,storage_slots) -1
+ if (adjusted_contents > 7)
+ row_num = round((adjusted_contents-1) / 7) // 7 is the maximum allowed width.
+ src.slot_orient_objs(row_num, col_count, numbered_contents)
return
//This proc return 1 if the item can be picked up and 0 if it can't.
@@ -227,12 +298,12 @@
/obj/item/weapon/storage/proc/can_be_inserted(obj/item/W as obj, stop_messages = 0)
if(!istype(W)) return //Not an item
- if(usr.isEquipped(W) && !usr.canUnEquip(W))
+ if(usr && usr.isEquipped(W) && !usr.canUnEquip(W))
return 0
if(src.loc == W)
return 0 //Means the item is already in the storage item
- if(contents.len >= storage_slots)
+ if(storage_slots != null && contents.len >= storage_slots)
if(!stop_messages)
usr << "[src] is full, make some space."
return 0 //Storage item is full
@@ -249,9 +320,9 @@
usr << "[src] cannot hold [W]."
return 0
- if (W.w_class > max_w_class)
+ if (max_w_class != null && W.w_class > max_w_class)
if(!stop_messages)
- usr << "[W] is too big for this [src]."
+ usr << "[W] is too long for \the [src]."
return 0
var/total_storage_space = W.get_storage_cost()
@@ -260,7 +331,7 @@
if(total_storage_space > max_storage_space)
if(!stop_messages)
- usr << "[src] is full, make some space."
+ usr << "[src] is too full, make some space."
return 0
if(W.w_class >= src.w_class && (istype(W, /obj/item/weapon/storage)))
@@ -437,12 +508,48 @@
else
verbs -= /obj/item/weapon/storage/verb/toggle_gathering_mode
+ spawn(5)
+ var/total_storage_space = 0
+ for(var/obj/item/I in contents)
+ total_storage_space += I.get_storage_cost()
+ max_storage_space = max(total_storage_space,max_storage_space) //prevents spawned containers from being too small for their contents
+
src.boxes = new /obj/screen/storage( )
src.boxes.name = "storage"
src.boxes.master = src
src.boxes.icon_state = "block"
src.boxes.screen_loc = "7,7 to 10,8"
src.boxes.layer = 19
+
+ src.storage_start = new /obj/screen/storage( )
+ src.storage_start.name = "storage"
+ src.storage_start.master = src
+ src.storage_start.icon_state = "storage_start"
+ src.storage_start.screen_loc = "7,7 to 10,8"
+ src.storage_start.layer = 19
+ src.storage_continue = new /obj/screen/storage( )
+ src.storage_continue.name = "storage"
+ src.storage_continue.master = src
+ src.storage_continue.icon_state = "storage_continue"
+ src.storage_continue.screen_loc = "7,7 to 10,8"
+ src.storage_continue.layer = 19
+ src.storage_end = new /obj/screen/storage( )
+ src.storage_end.name = "storage"
+ src.storage_end.master = src
+ src.storage_end.icon_state = "storage_end"
+ src.storage_end.screen_loc = "7,7 to 10,8"
+ src.storage_end.layer = 19
+
+ src.stored_start = new /obj //we just need these to hold the icon
+ src.stored_start.icon_state = "stored_start"
+ src.stored_start.layer = 19
+ src.stored_continue = new /obj
+ src.stored_continue.icon_state = "stored_continue"
+ src.stored_continue.layer = 19
+ src.stored_end = new /obj
+ src.stored_end.icon_state = "stored_end"
+ src.stored_end.layer = 19
+
src.closer = new /obj/screen/close( )
src.closer.master = src
src.closer.icon_state = "x"
@@ -500,4 +607,19 @@
return depth
/obj/item/proc/get_storage_cost()
- return 2**(w_class-1) //1,2,4,8,16,...
+ if (storage_cost)
+ return storage_cost
+ else
+ switch(w_class)
+ if(1)
+ return 1
+ if(2)
+ return 2
+ if(3)
+ return 4
+ if(4)
+ return 8
+ if(5)
+ return 16
+ else
+ return 1000
diff --git a/code/game/objects/items/weapons/storage/toolbox.dm b/code/game/objects/items/weapons/storage/toolbox.dm
index e5b42919a7..8c6365d6fd 100644
--- a/code/game/objects/items/weapons/storage/toolbox.dm
+++ b/code/game/objects/items/weapons/storage/toolbox.dm
@@ -11,7 +11,7 @@
throw_range = 7
w_class = 4
max_w_class = 3
- max_storage_space = 14 //can hold 7 w_class-2 items or up to 3 w_class-3 items (with 1 w_class-2 item as change).
+ max_storage_space = 14 //enough to hold all starting contents
origin_tech = list(TECH_COMBAT = 1)
attack_verb = list("robusted")
diff --git a/code/game/objects/items/weapons/storage/uplink_kits.dm b/code/game/objects/items/weapons/storage/uplink_kits.dm
index 4f80e85a52..4e427c8f6e 100644
--- a/code/game/objects/items/weapons/storage/uplink_kits.dm
+++ b/code/game/objects/items/weapons/storage/uplink_kits.dm
@@ -127,7 +127,6 @@
/obj/item/weapon/storage/box/syndie_kit/chameleon
name = "chameleon kit"
desc = "Comes with all the clothes you need to impersonate most people. Acting lessons sold seperately."
- storage_slots = 10
/obj/item/weapon/storage/box/syndie_kit/chameleon/New()
..()
diff --git a/code/game/objects/structures/inflatable.dm b/code/game/objects/structures/inflatable.dm
index 3d867111cc..20b326ebc9 100644
--- a/code/game/objects/structures/inflatable.dm
+++ b/code/game/objects/structures/inflatable.dm
@@ -40,7 +40,7 @@
/obj/structure/inflatable/bullet_act(var/obj/item/projectile/Proj)
var/proj_damage = Proj.get_structure_damage()
if(!proj_damage) return
-
+
health -= proj_damage
..()
if(health <= 0)
@@ -248,6 +248,7 @@
desc = "Contains inflatable walls and doors."
icon_state = "inf_box"
item_state = "syringe_kit"
+ w_class = 3
max_storage_space = 28
can_hold = list(/obj/item/inflatable)
diff --git a/code/modules/clothing/spacesuits/captain.dm b/code/modules/clothing/spacesuits/captain.dm
index 38cfc4a84b..e99dc6d8ce 100644
--- a/code/modules/clothing/spacesuits/captain.dm
+++ b/code/modules/clothing/spacesuits/captain.dm
@@ -15,7 +15,7 @@
desc = "A bulky, heavy-duty piece of exclusive corporate armor. YOU are in charge!"
icon_state = "caparmor"
item_state = "capspacesuit"
- w_class = 4
+ w_class = 5
gas_transfer_coefficient = 0.01
permeability_coefficient = 0.02
item_flags = STOPPRESSUREDAMAGE
diff --git a/code/modules/clothing/spacesuits/rig/rig.dm b/code/modules/clothing/spacesuits/rig/rig.dm
index f123f17b55..7db3dd1dc1 100644
--- a/code/modules/clothing/spacesuits/rig/rig.dm
+++ b/code/modules/clothing/spacesuits/rig/rig.dm
@@ -14,7 +14,7 @@
slot_flags = SLOT_BACK
req_one_access = list()
req_access = list()
- w_class = 4
+ w_class = 5
// These values are passed on to all component pieces.
armor = list(melee = 40, bullet = 5, laser = 20,energy = 5, bomb = 35, bio = 100, rad = 20)
diff --git a/code/modules/clothing/spacesuits/spacesuits.dm b/code/modules/clothing/spacesuits/spacesuits.dm
index 7014e9cf41..ecac722204 100644
--- a/code/modules/clothing/spacesuits/spacesuits.dm
+++ b/code/modules/clothing/spacesuits/spacesuits.dm
@@ -51,7 +51,7 @@
desc = "A suit that protects against low pressure environments. \"NORTHERN STAR\" is written in large block letters on the back."
icon_state = "space"
item_state = "s_suit"
- w_class = 4//bulky item
+ w_class = 5 // So you can't fit this in your bag and be prepared at all times.
gas_transfer_coefficient = 0.01
permeability_coefficient = 0.02
item_flags = STOPPRESSUREDAMAGE | THICKMATERIAL
diff --git a/code/modules/clothing/suits/armor.dm b/code/modules/clothing/suits/armor.dm
index 8637a050f9..bfcde568e9 100644
--- a/code/modules/clothing/suits/armor.dm
+++ b/code/modules/clothing/suits/armor.dm
@@ -143,6 +143,7 @@
body_parts_covered = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS
allowed = list(/obj/item/weapon/gun,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/weapon/melee/baton,/obj/item/weapon/handcuffs,/obj/item/weapon/tank/emergency_oxygen)
slowdown = 1
+ w_class = 5
armor = list(melee = 80, bullet = 60, laser = 50,energy = 25, bomb = 50, bio = 100, rad = 100)
flags_inv = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT
cold_protection = UPPER_TORSO | LOWER_TORSO | LEGS | FEET | ARMS | HANDS
diff --git a/code/modules/clothing/suits/storage.dm b/code/modules/clothing/suits/storage.dm
index e0cbb20ced..2534845173 100644
--- a/code/modules/clothing/suits/storage.dm
+++ b/code/modules/clothing/suits/storage.dm
@@ -4,7 +4,6 @@
/obj/item/clothing/suit/storage/New()
..()
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_storage_space = 4
@@ -77,7 +76,6 @@
/obj/item/clothing/suit/storage/vest/heavy/New()
..()
pockets = new/obj/item/weapon/storage/internal(src)
- pockets.storage_slots = 4
pockets.max_w_class = 2
pockets.max_storage_space = 8
diff --git a/code/modules/clothing/under/accessories/storage.dm b/code/modules/clothing/under/accessories/storage.dm
index 1a181ac49a..0e9a004a2e 100644
--- a/code/modules/clothing/under/accessories/storage.dm
+++ b/code/modules/clothing/under/accessories/storage.dm
@@ -12,7 +12,8 @@
/obj/item/clothing/accessory/storage/New()
..()
hold = new/obj/item/weapon/storage/internal(src)
- hold.storage_slots = slots
+ hold.max_storage_space = slots * 2
+ hold.max_w_class = 2
/obj/item/clothing/accessory/storage/attack_hand(mob/user as mob)
if (has_suit) //if we are part of a suit
diff --git a/code/modules/mob/living/inventory.dm b/code/modules/mob/living/inventory.dm
index 1cd446eaec..c1aa244d55 100644
--- a/code/modules/mob/living/inventory.dm
+++ b/code/modules/mob/living/inventory.dm
@@ -10,13 +10,13 @@
// Try put it in their backpack
if(istype(src.back,/obj/item/weapon/storage))
var/obj/item/weapon/storage/backpack = src.back
- if(backpack.contents.len < backpack.storage_slots)
+ if(backpack.can_be_inserted(newitem, 1))
newitem.forceMove(src.back)
return 1
// Try to place it in any item that can store stuff, on the mob.
for(var/obj/item/weapon/storage/S in src.contents)
- if (S.contents.len < S.storage_slots)
+ if (S.can_be_inserted(newitem, 1))
newitem.forceMove(S)
return 1
return 0
diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm
index 4bbce17aa1..f3596a5d9a 100644
--- a/code/modules/power/lighting.dm
+++ b/code/modules/power/lighting.dm
@@ -590,7 +590,7 @@
icon = 'icons/obj/lighting.dmi'
force = 2
throwforce = 5
- w_class = 2
+ w_class = 1
var/status = 0 // LIGHT_OK, LIGHT_BURNED or LIGHT_BROKEN
var/base_state
var/switchcount = 0 // number of times switched
diff --git a/code/modules/projectiles/guns/energy/laser.dm b/code/modules/projectiles/guns/energy/laser.dm
index c21fc97bd8..466170e52a 100644
--- a/code/modules/projectiles/guns/energy/laser.dm
+++ b/code/modules/projectiles/guns/energy/laser.dm
@@ -89,7 +89,7 @@ obj/item/weapon/gun/energy/retro
max_shots = 4
fire_delay = 35
force = 10
- w_class = 4
+ w_class = 5 // So it can't fit in a backpack.
accuracy = -3 //shooting at the hip
scoped_accuracy = 0
diff --git a/code/modules/projectiles/guns/projectile/sniper.dm b/code/modules/projectiles/guns/projectile/sniper.dm
index e38740e732..e03ff73988 100644
--- a/code/modules/projectiles/guns/projectile/sniper.dm
+++ b/code/modules/projectiles/guns/projectile/sniper.dm
@@ -3,7 +3,7 @@
desc = "A portable anti-armour rifle fitted with a scope, the HI PTR-7 Rifle was originally designed to used against armoured exosuits. It is capable of punching through windows and non-reinforced walls with ease. Fires armor piercing 14.5mm shells."
icon_state = "heavysniper"
item_state = "l6closednomag" //placeholder
- w_class = 4
+ w_class = 5 // So it can't fit in a backpack.
force = 10
slot_flags = SLOT_BACK
origin_tech = list(TECH_COMBAT = 8, TECH_MATERIAL = 2, TECH_ILLEGAL = 8)
diff --git a/code/modules/reagents/Chemistry-Machinery.dm b/code/modules/reagents/Chemistry-Machinery.dm
index d176ab205e..d69bd5a13c 100644
--- a/code/modules/reagents/Chemistry-Machinery.dm
+++ b/code/modules/reagents/Chemistry-Machinery.dm
@@ -366,13 +366,13 @@
return
if(istype(O,/obj/item/weapon/storage/bag/plants))
+ var/obj/item/weapon/storage/bag/plants/bag = O
var/failed = 1
for(var/obj/item/G in O.contents)
if(!G.reagents || !G.reagents.total_volume)
continue
failed = 0
- O.contents -= G
- G.loc = src
+ bag.remove_from_storage(G, src)
holdingitems += G
if(holdingitems && holdingitems.len >= limit)
break
diff --git a/code/modules/research/xenoarchaeology/tools/tools.dm b/code/modules/research/xenoarchaeology/tools/tools.dm
index e16db119c5..bc9d0ca21f 100644
--- a/code/modules/research/xenoarchaeology/tools/tools.dm
+++ b/code/modules/research/xenoarchaeology/tools/tools.dm
@@ -30,7 +30,6 @@
icon_state = "satchel"
slot_flags = SLOT_BELT | SLOT_POCKET
w_class = 3
- storage_slots = 50
- 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_storage_space = 100
max_w_class = 3
can_hold = list(/obj/item/weapon/fossil)
diff --git a/html/changelogs/Neerti-InventorySystemPort.yml b/html/changelogs/Neerti-InventorySystemPort.yml
new file mode 100644
index 0000000000..db9dd5d2fc
--- /dev/null
+++ b/html/changelogs/Neerti-InventorySystemPort.yml
@@ -0,0 +1,38 @@
+################################
+# Example Changelog File
+#
+# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
+#
+# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
+# When it is, any changes listed below will disappear.
+#
+# Valid Prefixes:
+# bugfix
+# wip (For works in progress)
+# tweak
+# soundadd
+# sounddel
+# rscadd (general adding of nice things)
+# rscdel (general deleting of nice things)
+# imageadd
+# imagedel
+# maptweak
+# spellcheck (typo fixes)
+# experiment
+#################################
+
+# Your name.
+author: Neerti
+
+# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
+delete-after: True
+
+# Any changes you've made. See valid prefix list above.
+# INDENT WITH TWO SPACES. NOT TABS. SPACES.
+# SCREW THIS UP AND IT WON'T WORK.
+# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
+# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
+changes:
+ - rscadd: "Ports Bay's volume-based inventory system. It works off by weight classes instead of just slots, allowing you to hold more light items than you could previously."
+ - rscadd: "Bulky items can now go in your backpack, however it will require twice the space of a normal sized item."
+ - rscdel: "Spacesuits, RIGs, and sniper rifles made heavier."
diff --git a/icons/mob/screen1.dmi b/icons/mob/screen1.dmi
index d72a362422..3fb762334c 100644
Binary files a/icons/mob/screen1.dmi and b/icons/mob/screen1.dmi differ