add function to not use up all ingredients (reserve slot for item-type)#189
add function to not use up all ingredients (reserve slot for item-type)#189IIIullaIII wants to merge 6 commits intomt-mods:masterfrom
Conversation
Added a button, on to select whether to keep 1 item in the ingredient slot and prevent other ingredients from filling it, off to completely empty the slots when crafting
|
did you mean to include the .it translation |
| end | ||
|
|
||
| local function autocraft(inventory, craft) | ||
| local function autocraft(inventory, craft,pos) |
| if not consumption then | ||
| return false | ||
| end | ||
| -- BLOCk (Riserve 1 item) |
There was a problem hiding this comment.
No need for all-caps, parenthesis and "reserve" not "Riserve"
There was a problem hiding this comment.
-- reserve 1 item is sufficient
There was a problem hiding this comment.
ok sorry for mystacle i have bad english :-P and I didn't look at the comments in the file, I initially wrote them in Italian for personal use to test the mod
|
|
||
| for _ = 1, math.floor(elapsed / craft_time) do | ||
| local continue = autocraft(inventory, craft) | ||
| local continue = autocraft(inventory, craft,pos) |
| -- Reserve State | ||
| local res_state = meta:get_int("reserve") == 1 | ||
| local res_icon = res_state and "pipeworks_button_on.png" or "pipeworks_button_off.png" | ||
| local res_status_txt = res_state and S("RESERVE: ON") or S("RESERVE: OFF") |
There was a problem hiding this comment.
Why do you feel we need all-caps status text?
There was a problem hiding this comment.
It's not necessary, it was just for aesthetics
| return enabled | ||
| end | ||
|
|
||
|
|
There was a problem hiding this comment.
What are all these empty lines for? If I'm not mistaken, pipeworks doesn't usually use this kind of formatting. I'd rather have the deleted comments back ;)
There was a problem hiding this comment.
I apologize again and yes I deleted my comments in Italian that I used for testing and maybe I deleted a few too many comments too
| inv:set_size("recipe", 3 * 3) | ||
| inv:set_size("dst", 4 * 3) | ||
| inv:set_size("output", 1) | ||
| meta:set_int("reserve", 0) |
There was a problem hiding this comment.
Please check indentation here.
|
Does this work with group ingredients? e.g. mulch -> 8 group:leaves and 1 group:wood |
|
For the record: I think it would be better to leave ingredient input management to players. Makes for more interesting in-game solutions than hand-holding via the mod. |
Is that like just leaving one of a group with no regard for which member it is? anyway, another solution may just be rejecting inputs that go above a certain capacity quota, may just be 2 slots |
|
This won't help if the recipe uses a non-stackable item (e.g. a bucket of water); in that case the only way to prevent it from filling is to regulate the input, not the consumption. |
|
I made this with the possibility of choosing whether to activate it or not because in automation with input pipes for example a farm with a chainsaw that has to produce bonemeal will find itself receiving the entire inventory of the autocrafter full of leaves and wood as in the minority it does not have space it is only used for the input automations if it is not needed just have it in off so that it will use all the ingredients |
yes work with group |
Yes, this is an error. In fact, non-stackable items are used and only 1 remain in memory, but it becomes useless. For example, if you put 10 water buckets, only 1 remains and will not be used. Generally, in recipes with buckets, a maximum of 4 are used, which, once used, are sent back to the autocraft after being filled. Instead of using this system, I would opt to remove the non-stackable items from the reserve system. |
what they're saying is that you can run out of space for nonstackables because other items fill the space up |
Code fixes and removal of non-stackable items from the reserve function
no reservation for a single element in the group but only one of them belonging to the group
No, it's just that it's useless to keep a slot occupied if the item isn't stackable, it would only occupy that space without being able to use it, so I removed all the non-stackable ones from the reserve system. |
|
This will still not work as hoped. Excluding non-stackables still allows inventory to be blocked by them. Allowing only one per group will cause items to be rejected that are essential. I'm still convinced this kind of management should be left out of mod code and done by players in-game. About style: |
No I'm saying that they are not stackable like water buckets, they are consumed even if in a craft you never use more than 3 or 4 buckets at a time to make a filling rotation but I removed the non-stackable ones in general especially because it would be useless to keep an unusable full slot I wanted to create an additional window that only assigns the slot without keeping the item, similar to that of sign bot but I noticed that even there the stackable items give problems, so no retention of irtem buchet as the crafting is slow and there are no fast automations such as creating chocolate biscuits the autocrafter fills with wheat and the cocoa does not find space as it is much less and matures in more time, or in the bonemeal farm with leaves and trunks if you cut two trees the autocrafter will be full of leaves and the trunks do not find space and many other recipes require a placeholder, if I made it it is because many people asked me for it also on my server for which I adopted another system, an intelligent distributor among the autocrafter and the injector |
''This will still not work as hoped. Excluding non-stackables still allows inventory to be blocked by them.'' Yes you are right, I thought I had removed them all, I will check again immediately and I apologize for the oversight |
yes |
No need. All these 'problems' can be managed well in-game to suit whatever situation, tailored to what the player wants. Using luatubes, detector tubes and only injecting what is needed into the autocrafter. If your players need a 'duplo' version, maybe consider making predefined autocrafters that e.g. only craft mulch another that only crafts canned tomatoes etc. |
Adds a button, to select whether to keep 1 item in the ingredient slot and prevent other ingredients from filling it. Defaults to off, to completely empty the slots when crafting (current behaviour).