-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested Containers (a.k.a item pockets) #39406
Conversation
src/character.cpp
Outdated
@@ -2095,7 +2095,7 @@ int Character::i_add_to_container( const item &it, const bool unloading ) | |||
|
|||
const itype_id item_type = it.typeId(); | |||
auto add_to_container = [&it, &charges]( item & container ) { | |||
auto &contained_ammo = container.contents.front(); | |||
item &contained_ammo = container.contents.first_ammo(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can someone sanity check this line for me? it wasn't actually clear if we were looking only into a magazine, or if "ammo" was just being used as a general word for "an item this will have"
// skip food without comestible, like MREs | ||
if( const item *it_food = it.get_food() ) { | ||
if( it_food->get_comestible()->comesttype == "DRINK" ) { | ||
if( !preserves && it_food->goes_bad() && has_near( zone_type_id( "LOOT_PDRINK" ), where, range ) ) { | ||
if( it_food->goes_bad() && has_near( zone_type_id( "LOOT_PDRINK" ), where, range ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: moving "preserves" into other stuff has ramifications for how zones store things.
while I understand that this is a draft that's not meant to be merged as-is, I'm surprised at how few commits there actually are. Did you squash a bunch of commits together? |
Squee? |
This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there: https://discourse.cataclysmdda.org/t/adding-a-mod-to-a-world/23546/13 |
Bugs and quality of life decrease this change introduced makes game almost unplayable. |
Thank you for your excellent suggestion and detailed explanation on how to improve it. |
What do you think about this user's suggestion from #3671 (comment) for using a tree list view for inventory management? Use
+ is a closed container, - is opened Imo it would make this change much less cumbersome and more intuitive to use. |
i think it's a nice stretch goal. i put it in the project, lower priority than pocket favorites. |
This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there: https://discourse.cataclysmdda.org/t/latest-experimental-features/5582/1125 |
- unused since CleverRaven#39406 commit 5383aaf
- unused since CleverRaven#39406 commit 5383aaf
Summary
SUMMARY: Features "Implements item pockets"
Purpose of change
Resolves #3671
Describe the solution
All right gang buckle up 'cuz the ride's just beginning.
This is a very large PR. I have attempted to cut it up into reasonable commits, but I don't think i can split it into multiple PRs because then it won't compile.
Here's a rundown of what all this project does:
The current pocket attributes, with their json names, are as follows:
min_item_volume
,max_item_volume
, andmax_contains_weight
.g
ets an item, it tries to pick the best pocket this item will go into. (see Character::best_pocket(), item_contents::best_pocket(), and item_pocket::better_pocket())i
nventory, it displays all worn items, wielded item, and all contained items, and the player can interact with them just as before. Additionally canD
rop them with multidrop. This obsoletes theU
nload function for everything that is not a magazine. (and guns with internal mags)i
nventory, it is possible to micromanage what items are in which pocket, by interacting with them:(oops, it says holster item)
These particular screens is a bit of a WIP but needs some UX opinions outside my own. One comment I have about it is that in the "put in" screen it should not allow you to select the item itself or anything it contains.
o
pen just opens another inventory with just that item. i'd actually consider removing this one if it's too much, but i know how our playerbase is with hoarding things.7. Advanced inventory should work just as before. Currently it's a little broken in this PR because of item indices.
8. Crafting should be able to find items inside of other items for the crafting_inventory() stuff. i.e .it should work as before.
9. Generally I want to remove all the logic where you interact with a container as if you're interacting with the item itself, as it confuses the code and now you can have multiple items inside of items. Maybe we can keep it for select things, like checking if there's only 1 type of thing inside it first.
Describe alternatives you've considered
nerf toolboxes
Testing
This project has been through a lot of iterations of testing, and it is not done at that. I've made a number of releases on my own fork that wonderful people have hammered on for me, and thisproject has gone through 3 pretty nasty rebases. I'm expecting some bugs that i've already fixed.
Here's some notes on bugs that i'm aware of pre-rebase:
this is related to Character::i_add(). i've had a very short conversation with ralreegorganon about how it needs a better api, but I haven't done much that information.
Additional context
I'm going to need some help putting a bow on this. The main thing i want is some guidance into splitting this into commits/prs that make it mergeable - i already have the general idea that i can split off the JSON (i've done part of that already, but not all of it) and write some json loading code to be a little easier on 3rd party mods. I'll accept help on fixing up the weird bugs that are obvious too, and/or some figuring what certain functions do via discord as i'm going to be hammering away at this for a couple few days to wrap up the additional obvious bugs.
Sponsor me maybe?
Special mentions:
@Brian-Otten and @wapcaplet have helped me fill out the json for containers.