WIP Chef's Closet SMAPI (extending items available for cooking)

Discussion in 'Mods' started by duder, Feb 14, 2017.

  1. duder

    duder Void-Bound Voyager

    Hi friends!

    Over the weekend I wrapped up year one on my first play-through and decided to take a break from playing on Sunday to make an attempt to improve the cooking experience. I was more successful than I expected so I'm hopeful I can make it work properly with some more time and effort. At this point I just want to share my idea for the mod and get some feedback about things to consider and if you think my approach is even viable (hardest part yet to be solved).

    Improve the cooking experience by giving the user the ability to include items from chests in the cooking menu, in addition to the fridge items.

    In order for a chest's inventory to be included in the cooking menu it must be placed next to the fridge, or next to a connected chest.

    E.g: Fridge is at location [6,4]. There is a green chest at [7,4], a blue chest at [8,4], and a red chest at [10,4]. When the cooking menu is open the items of the the green and blue chest will be available to complete recipes, as well as the fridge items.

    In order for a chest's inventory to be included in the cooking menu it must be placed in the kitchen.

    Extending the fridge itself to hold more items is a common suggestion and also viable, but IMO it improves the cooking experience at the expense of item management and organisation. By allowing you to store cooking items across a number of chests you can better organize your ingredients while still having access to them all for cooking.

    As I'm sure you know the CraftingPage menu uses the fridge.items to determine what can be crafted, and after a few hours of tinkering I was able to extend the fridge.items to include chest inventories while cooking and restore the fridge inventory to the previous state when the menu exits. Outside of cooking it handles inventory updates across the containers just fine, but right now items used during crafting are not removed from fridge or chest inventories. We're gonna need to fix that!

    I'm planning to solve this problem by comparing the pre-craft and post-craft states of fridge.items then re-set the inventories using fridge.items based on what was originally in the containers. If items were consumed during crafting that existed in two or more containers the priority will be to consume the fridge items first then the next closest chest and so on until all of that item has been consumed.

    The entire viability of this mod relies on this logic to work properly, and I can't help but assume others have already tried this. From a programming logic perspective I feel pretty confident this can work, but I'm pretty new to Stardew Valley and very new to its modding scene so if I'm missing something here please let me know.

    Status Update
    Ready for testing!
    1.1 Update 2/19/2017: fixes for consumption order, and log for testing
    1.2 Update 2/20/2017: adjusted kitchen bounds logic for upgrade level 2, added logs for testing

    • implement item consumption logic
    • properly implement contiguous container requirement (no longer needed)
    • account for all farmhouse layouts
    • Cook! Cook! Cook!
    • officially release mod
      Last edited: Mar 23, 2017
      xangria likes this.
    • xangria

      xangria Subatomic Cosmonaut

      I really like this idea!

      Is this the only available work-around? My only concern would be cluttering up the kitchen with chests. If necessary, I understand, but it's not ideal.
      • duder

        duder Void-Bound Voyager

        Its not the only approach to solving the problem, but using chests is an intentional design choice. I'd like to create a mechanic that adds more decision making to the game while providing a nice QoL improvement as well. There are two main reasons for this choice:
        • chests provide flexibility in how much storage is available while cooking, and also how those items are organized
        • the placement requirements of the chests add gameplay decisions that require trade-offs: more food storage vs less room for other stuff
        Two attached chests will triple your cooking storage so you might not need that many to meet your needs.

        As for other approaches, you might like Crystalmir's mod which is already released and expands the fridge space itself by adding more pages for item storage.
        • xangria

          xangria Subatomic Cosmonaut

          I like the idea of the chests. My only concern was having to place them directly next to the fridge.
          • duder

            duder Void-Bound Voyager

            Oh I got ya! I currently have my chests setup like this:


            But I just looked up the layout for the second house upgrade and now I understand your concern, haha. It'd probably make more sense to only include chests on kitchen tiles, huh?

            It would be easy to include all chests in the farmhouse, but Its important to implement a way for players to control which chests get used for crafting and which don't in order to make it a compelling addition to the game.
            • xangria

              xangria Subatomic Cosmonaut

              Yes, I think any kitchen tile would work well.
              • Coolwyngs

                Coolwyngs Giant Laser Beams

                Looking forward to this
                • duder

                  duder Void-Bound Voyager

                  Things are looking pretty good! It has very little testing though and I won't be able to play much for a few days. It's not packaged yet but I threw it on github if anyone wants to build it themselves to help me test.


                  I haven't run into any issues with the current iteration but I've only tested with two recipes and two chests so far. I also won't be upgrading my Farmhouse to the larger kitchen for some time so if someone can confirm the chest boundary is correct that would be awesome.
                  • RoboticAlpaca

                    RoboticAlpaca Scruffy Nerf-Herder

                    Man, whatever you do, don't ever abandon this. Once it's finished up, I'll be all over this.
                    I've beat this game, like, three times but never really cooked a whole lot simply because the fridge can't hold NEARLY enough to make a large variety.

                    The fridge extender also limits me since I'm pretty OCD about my organization of crops and materials and hate having to LOOK for things when I need to remove things. (Fish, Forage, Animal Products, Fruit, Vegetables, Miscellaneous Ingredients all have to have their own separate color-coded chests.)

                    I'd run the test you've put out and try to help tweak it if I understood ANYTHING about coding and modding. As it is, know you have someone excited for release.
                      xangria likes this.
                    • duder

                      duder Void-Bound Voyager

                      Here ya go!

                      Just unzip and drop it in your mods folder.
                        Coolwyngs likes this.
                      • xangria

                        xangria Subatomic Cosmonaut

                        Hi, I tried testing on both the first house upgrade and the final upgrade, but couldn't get it working. I put the chest next to the refrigerator and several other tiles, but the materials didn't show up. I checked with multiple recipes, but nothing was available to cook. I didn't see any errors in SMAPI while I was playing. My guess is that this must not be compatible with the house mod I am using (2cute farmhouse http://community.playstarbound.com/...-now-more-chill-animal-room-and-stuff.115839/), unless the mod didn't get loaded in for some reason. Other possible mods that I have, which may affect it, are ChestsAnywhere and ChestPooling. If you have any suggestions, I'm happy to continue trying to test this out. I think it has great potential.
                        • duder

                          duder Void-Bound Voyager

                          Hmm, Farmhouse mods should only be an issue if the location or size of the kitchen changes. Chests no longer need to be placed next to the fridge, but on any kitchen tile.

                          I briefly tested compatibility with the three mods you mentioned and didn't have a problem.

                          Here's a short demo video I made during testing. Hopefully it helps.

                          Do you have any other mods installed that manipulate chest or fridge inventories?
                          What version of SMAPI are you running? I'm using 1.8
                          What operating system are you using? It should be cross platform but I haven't verified yet.

                          I uploaded a new version that should fix the consumption order. I also added a log statement to help with testing. It outputs the coordinates and items of each chest used during cooking.

                          Chefs Closet 1.1
                          • xangria

                            xangria Subatomic Cosmonaut

                            Thanks. I checked it briefly, but still no luck. I removed CookingSkill and FarmAutomation, but that made no difference. I can't think of any other mods that would affect chests or cooking. I'll have more time to test later today though, and I'll update you whether I get it working or not.

                            As for specs:
                            - SMAPI 1.8
                            - Windows 10
                            • xangria

                              xangria Subatomic Cosmonaut


                              I got it working for both house sizes that I have saves of. No problems with the first upgrade. The final house upgrade works in a 6 x 9 grid. The tiles (7,1) to (7,9) do not work; (7-1) being the tile directly below the stove. I tried placing the chest on each of them. I'm not sure if this farm map is a different size than the vanilla version though.

                              I'll let you know when I figure out which mod was the problem. I'm going to put them back one by one.
                                duder likes this.
                              • duder

                                duder Void-Bound Voyager

                                I figured out a way to upgrade my house for testing and updated the logic for the second upgrade level. Tested with and without the 2cute farmhouse mod, same kitchen size. I also added another debug log so now you should see a log statement for every chest in the farmhouse and whether or not its being used for cooking. That should help us nail down anymore issues with the kitchen bounds.

                                Chefs Closet 1.2
                                • Rorleuaisen

                                  Rorleuaisen Yeah, You!

                                  Okay so I was actually thinking about learning to program do this(and oh boy am I brand new to modding) so I had an alternative solution: can you utilize the cabinet/counters as "chests" that would be accessible like the fridge? There are six(seven if you include the corner) spots available in final upgrade. It would be more aesthetically pleasing and make me not hate the wasted space(those counters taunted me with wasted potential ;-;). Anyways, sorry for dropping in here out of nowhere @-@

                                  (I will totes try to run your mod when I have things set up to do so)
                                  • duder

                                    duder Void-Bound Voyager

                                    Converting the counter/cabinet tiles to function as chests would be a quite a bit more work, but its probably possible. I'm not interested in pursuing that approach mostly because it provides no additional game play decisions. I want the mod to require trade-offs in order to leverage its benefits. That you have to consider how much space you want for cooking items vs how cluttered you want your kitchen to get is very much intended.

                                    Here's how my kitchen is setup right now. Five chests in the kitchen organized by category and then another set outside of the kitchen for my silver and gold items I don't want used during cooking. I briefly looked into filtering out silver or gold items but couldn't figure out how to determine the item quality. If anyone has any tips for that I'd love to hear them!

                                    As for learning how to mod, start here. My code is also available on github with an MIT license so feel free to fork it if you'd like to learn from and build on what I've done so far.
                                      xangria and Rorleuaisen like this.
                                    • duder

                                      duder Void-Bound Voyager

                                      @xangria did you ever figure out which mod was incompatible?

                                      I'd also love to have confirmation from someone that the latest version works properly with the second farmhouse upgrade. I haven't made any changes since v1.2 and would like to work out any last issues before officially releasing it to the community. Its been working well on the devices I've tested.

                                      I plan to release it early next week if I don't hear anything. Thanks!
                                      • ekffie

                                        ekffie Phantasmal Quasar

                                        Hi I installed it yesterday on stardew 1.2 and smapi 1.10
                                        I am on the final farmhouse level with cellar no farmhouse mods and do use chests anywhere and ItemCollector as automation mod.

                                        I placed 4 chests in the kitchen next to the counters - sadly the mod seems to see nothing of it and does not work at all .. any suggestions on what to test try? I would really like this to work ..

                                        Edit: Ok, I found the issue: this mod stops working directly when the mod Cooking skill is installed. Tested it with cooking skill in versions 1.04 and 1.06

                                          Attached Files:

                                          Last edited: Apr 28, 2017
                                        • Crystalmir

                                          Crystalmir Subatomic Cosmonaut

                                          Nice mod :) I always wanted to make a fridge mod with a clickable fridge sprite so that you could have a meat drawer/vegetable drawer etc. like a real fridge but I couldn't get anyone to make those sprites for me.

                                          Share This Page