RELEASED [SMAPI] New machines (flour, sugar, vinegar, rice?)

Discussion in 'Mods' started by Igorious, Mar 31, 2016.

  1. krakau

    krakau Big Damn Hero

    there is a conflict between your new mod version 1.2 and the "more crops mod". the yellow bottle you added in verson 1.2 replaces the red pepper seeds picture in the more crop mod. that causes the red pepper seed looks like the yellow bottle. im not really experienced in modding but... there was a way to change the item ID or something else.. im not sure - is it possible to fix the mentioned problem by myself/manually? if yes, how?
    • Alina_Mau

      Alina_Mau Scruffy Nerf-Herder

      Oooooo it looks great! :D
      • Entoarox

        Entoarox Oxygen Tank

        I'm afraid most of the 'documentation' is found in xml docs within the SMAPI source code itself at this time.
          Superior_s likes this.
        • Igorious

          Igorious Sandwich Man

          It possible, yeah. If you already have save-game with my overrides, you should grab all bottles from keg and sell all bottles before editing config.
          Then open configuration file. Find section "Items". Replace IDs. Find section "KegEx" and replace IDs in subsection Ouput->Items. Save config.
          Now it should work properly.

          It may be a problem, if different mods use same IDs. It's not clear, what to do, because even if two mods use different IDs in beginning, after expansion ID ranges may overlap each other.

          I've updated config to using ItemID=900..901.
            Last edited: Apr 7, 2016
          • Igorious

            Igorious Sandwich Man

            OK, it seems, I should describe configuration files, if I want, that anyone might change them.

            • [Required] ID:int, Name:string and Description:string used in game logic and UI. Note, it's CraftableID, not ItemID.
            • [Optional] Skill:string and SkillLevel:int describe required skill to get crafting recipe.
            • [Semi-optional] MinutesUntilReady:int is default time (in minutes) for creating products.
            • [Required] Materials:<ItemID :int, Count:int> its enumeration of required materials in crafting recipe. First number is ItemID of material, second is count.
            • [Requred] Output:section describes process of item transformation.
              • [Semi-optional] ID:int default ItemID for produced items.
              • [Required] Items:<ItemID :int, Item:item> sets mapping between input and output items. Each item contains next properties:
                • [Semi-optional] ID:int of item. It's required, if you don't set default ID.
                • [Optional] Name:string of item. Note, that items with same ID can have different names. It used for grouping items in inventory.
                • [Optional] Price:int is base price of item. Real price of item depends of base price, quality and skills.
                • [Optional] Count:expression(p,q,r1,r2=>int). Used to calculate count of output product.
                • [Optional] Quality:expression(p,q,r1,r2=>int). Used to calculate quality of output product. Result can be None(0), Silver(1) or Gold(2).
                • [Semi-optional] MinutesUntilReady:int is time (in minutes) for creating product.
              • [Optional] Price:expression(p,q=>int). Default price of produced items. If it's not defined, used price from object information.
              • [Optional] Quality:expression(p,q,r1,r2=>int). Default quality of produced items. If it's not defined, used None(0).
              • [Optional] Count:expression(p,q,r1,r2=>int). Default count of produced items. If it's not defined, used 1.
            expression is string of specific format. It may be just number, or formula to calculate some value.
            There are several parameters:
            • p is basic price of input item;
            • q is quality of input item;
            • r1 and r2 is random values from [0..1].
            You can use parameters, numbers, arithmetic operations (+, -, *, /), comparisons (<, >, ==, !=, <=, >=) and conditional operator (A)? B : C. Note, that each unique expression increase time of mod loading.

            • [Required] ID:int is CraftableID of in-game machine.
            • [Required] Output:section adds rules for processing items. If no rule is found, then will be sued in-game behaviour.
            • [Semi-optional] MinutesUntilReady:int is time (in minutes) for creating products by new rules.
            ItemOverrides:list<item-info>. Overrides information of game-in items.
            • [Required] ID: int is ItemID of overridable item.
            • [Optional] Name:string is new name of item.
            • [Optional] Desctiption:string is new description of item.
            Items:list<object-information>. Adds new items.
            • [Required] ID: int, Name:string and Description:string.
            • [Required] Price:int.
            • [Optional] Edibility:int used in calculation of health and energy restore. Use -300 if item is inedible.
            • [Required] Type:string. One of Basic, Minerals, Crafting, Arch, Fish, Cooking, Seeds or Ring.
            • [Required] Category:int. Used in game logic. One of Greens(-81), Gem(-2), Vegetable(-75), Fish(-4), Egg(-5), Milk(-6), Cooking(-7), Crafting(-8), BigCraftable(-9), Fruits(-79), Seeds(-74), Minerals(-12), Flowers(-80), Meat(-14), Metal(-15), ...
            • [Optional] Subcategory:string. "food" or "drink" for meal, time-of-day and seasons for fish, ???
            • [Optional] SkillUps:int[10]. Buffs for meal.
            • [Optional] Duration:int of buff.
            ID migration.
            If you have new items in game, but then simply have changed ID, it causes crash.
            You shoud remove all new items before (sell or destroy). Save game and exit.
            Then change IDs in config files. Load game.
            Now you can continue use items.
              Last edited: Apr 7, 2016
              Acerbicon likes this.
            • Igorious

              Igorious Sandwich Man

              How mod works.
              All of process we can separate to two parts.

              First part is registration. I adds crafting recipes, object information and override textures. I've choosed dynamic approach, because it allows easy modify mod to everyone. If you don't like image, you can change it. If you use mod, where one of ID conflists, you can change it. Ideally, you write class with 5-6 lines, register it and will give full functionality due to inheritance and configuration.

              Second part is object replacement. I use mapping between my custom C# classes and CraftableIDs. When player puts new item or goes to other location I check all objects. If object has registered ID, but use basic class Object from .exe, I remove it, create my wrapper and copy properties to it.
              I have troubles with serialization during game saving, because permisson attributes contained in .exe, so I haven't access to them. Therefore I convert all my objects to «raw» in-game before sleep. I was afraid, that it would require much time, but de facto it spends ~50ms.

              I know, that STORM allows realize similar to my mod functionality via callbacks. But using SMAPI I directly works with game code, and using STORM I will be forced to rely on its functionality.

              @Vajura, @darkuslord98, I've attached link to github, If it's interesting for someone.
                Last edited: Apr 7, 2016
                Acerbicon likes this.
              • ress_1819

                ress_1819 Void-Bound Voyager

                Hi, I'm having a bug while using this mod whereby new keg processing doesn't consume raw materials but still processes it for less than 10 seconds for each product, e.g light ale from hops/ mead from wild honey, so it's like an instant crystalarium where I could replicate keg artisan's products without expending raw materials, while using this mod I had not changed the config file either. The mod version I'm using that got this bug are version 1.2 and 1.3, I'm using SMAPI 0.40.0. The generated error log is: [12:56:14.014 AM] Failed to call base method: UpdateControlInput. I also tried unloading this mod and the issue was resolved, but I want to use this mod without having a cheaty bug :/ Please resolve this issue?
                • navybofus

                  navybofus Void-Bound Voyager

                  Wow that's pretty amazing. I've checked everything out and I still don't quite get how you get your items to save to file without issues. I've looked through every file in the mod and API and can't find anything about it. I'm an XML and C# noob though so, that may be the issue.
                  • Igorious

                    Igorious Sandwich Man

                    @Vajura, @darkuslord98, I've attched li
                    Thanks for report.
                    I found a grave error in my code for overriding behaviour of machines.
                    Cause of problem is that game-in machines create heldObject and compare it with null to check, if we can perform action.

                    Please, update mod to 1.3.1 and check, that it will work right.
                      ress_1819 likes this.
                    • krakau

                      krakau Big Damn Hero

                      i found out the error. its the item ID 816. the "more crops mod" uses ID 816 too. so.. i just have to change all ID :816 into something else to fix the bug? and it doesnt matter what ID? random like.. 983432 works too?

                      EDIT: btw.. is there a possibility to see all standard item IDs? to know which IDs can be still used and which ones are already in use
                        Last edited: Apr 7, 2016
                      • Igorious

                        Igorious Sandwich Man

                        OK, I've again used wrong IDs :)
                        Please, update mod files.

                        You can't set ItemID=983432. All textures saved in XNB archives. Thay have limitation to 1440px size. It means, that max ItemID for default object sprite sheet is (1440px / 16 px) * 24 - 1 = 2159. I use dynamic overring of game resource, so this limitation exists and for my mod.
                          Last edited: Apr 7, 2016
                        • krakau

                          krakau Big Damn Hero

                          teach us senpai, so you dont need to fix these little bugs :D
                          • krakau

                            krakau Big Damn Hero

                            that means there is just a limited amount of additional modded items you can add to this game? .. until the game itself gets an update so the limit gets greater? and do you happen to know a mod that shows you all used IDs in the game? i mean there is this trainer mod, you can add items with it if you put in the id. is it possible to see all currently used IDs, too? i mean not only the standard item IDs, but also the used item IDs by running mods.
                              RoastedCoconutz likes this.
                            • Igorious

                              Igorious Sandwich Man

                              It just means, if we want use more objects, we will need draw they manually, without using in-game functions. So it seems not easy for me.
                              • krakau

                                krakau Big Damn Hero

                                im a bit confused.. i will tell you how i got it: these 2159 are possibly item place holders for new stuff, but not all 2159 IDs are currently used in the orginal game. and thats why its possible to add new items with mods, because many of the currently available item IDs are unused - did i get it right?


                                there are actually already 2159 item IDs in the orginal unmodified original game, but these item IDs arent in use currently like the bacon? its already in the original game but there is no bacon usable without a mod so far

                                EDIT: sorry i can be annoying with my questioning :D
                                • Igorious

                                  Igorious Sandwich Man

                                  You're right. In vanilla game only 792 «small» items are used. So modders have 1368 vacant IDs.
                                  I sure, if we use more complex algorithm for overriding textures, we could use all 1440x1440 texture map, so its (1440/16)^2 = 8100 total IDs. I think, It's enought for modders :)
                                    Superior_s likes this.
                                  • krakau

                                    krakau Big Damn Hero

                                    thanks for taking your time for explaining all this (probably the most basic stuff in stardew valley modding) to a non-modder :)
                                      Superior_s likes this.
                                    • Ichimatsu

                                      Ichimatsu Pangalactic Porcupine

                                      I don't drink myself, but still, I love the addition of Mead and Vodka! I'm hoping to see some sake someday, though, lol. As My character is sort of a drunkard Japanese guy :p Either way, I'm love the additions. Thanks, Igoirius! You've made a game character very happy and very drunk :D
                                        RoastedCoconutz and Superior_s like this.
                                      • Oboromusha

                                        Oboromusha Pangalactic Porcupine

                                        Oh goody, new updates with the keg. I had 4 so I could do an unique brew with each, now it went up to 6. Guess I'm gonna craft a couple more kegs now for this.
                                        • krakau

                                          krakau Big Damn Hero

                                          i have 100 kegs and 100 ancient plants :D

                                          Share This Page