HandyHands - Automatic handcrafting

by Qon

Automatically start handcrafting an item that is quickbar filtered (or in logistics requests) that you don't have enough of whenever your crafting queue is empty. Prioritises items in your cursor and what you need the most. It's like having logistics deliveries for early game!

Utilities
3 years ago
0.13 - 1.1
9.31K

b [Resolved] Continuously Crafting Wrong Item

3 years ago

I absolutely love your mod! It really makes the early game tolerable and it's an easy recommendation for literally anyone.

That said, I was mortified when I couldn't get Stone Furnaces to stop crafting over and over again. I just don't ever need over a hundred of them... you know? After some testing, I figured out that Stone Furnaces were being crafted based on my request for Iron Pipes. I had my HandyHands request for Iron Pipes set to 200, so I was getting 200 Stone Furnaces. This was happening regardless of whether I had Iron Pipes in the quickbar or in the logistics tab. If I requested Iron Pipes, I got Stone Furnaces.

I am using a bunch of other mods, including all of Bob's and Angel's. I noticed that when Stone Furnaces were being crafted, it was via Bob's recipe for converting from the Stone Chemical furnace, which has a pipe connection. Not sure if this information helps, but I'm glad if it does.

My easy fix was to just not request Iron Pipes, which isn't a big deal, but in the interest of helping you improve the mod I thought I'd share this. Who knows if maybe someone else out there is getting a bunch of the wrong item, too?

Anyway, thanks for all your hard work. If you've got a Patreon or whatever, let me know... I'll toss you a few bucks for your effort (even without a fix!)

3 years ago

It makes me happy that you are enjoying it :)
Which Bob mod included the recipe that you were suspicious of? I'll try to fix it!

I don't have a patreon. Should I make one? I don't expect many others would donate anything. It's of course nice to get some money, but I don't expect to get enough donations that I could earn enough from it that I could guarantee updates. And then it's hard to justify taking money if I can't really promise anything back? But I could maybe do it as a "donations only, no guarantees" instead of a model similar to purchases.

3 years ago

So I have tried a lot of mods, but I prefer the vanilla factory stuff and most mods I use are QoL stuff. I have no idea what Big Mods like Bob's do. But apparently the Bob's metals, chemical and intermediates has some truly weird recipies with some crazy loops where you make chemical furnaces out of furnaces and pipes, but can also un-craft them with a reverse recipe.

Earlier:
Version: 1.9.0
Bugfixes:
- HandyHands can now deal with recipes that are internally named differently to its products.
This should fix incompabilities with all mods that name their recipes without regard to
conventions, when there's several recipes that produce the same thing or recipes that produce
several things at once.

Basically HandyHands can find all ways to produce a product. And if you don't have iron plates it will use another recipe that you have ingredients for. Truly a marvelous masterpiece! Sadly Bob's includes uncraft recipes that I think shouldn't exist, lol. Seems like a way to fill up the crafting menu with useless recipes to me :D

So I'm thinking, what is the solution? Maybe not crafting things with multiple products? Or maybe only use recipes that are named the same as their product if there is one such recipe (so only allow crafting pipes with the recipe named pipes) but use weirdly named recipes otherwise?

3 years ago

So it's not really a bug? But it needs a fix. Maybe a setting for disabling autocrafting recipes that have multiple products would be enough for your case?

With a lot more work and time I could maybe instead do loop detection and disable recipes that are just the opposite of some other recipes. But what if some users wants their chemical furnaces to be un-crafted when they want pipes? Might take a while to do a "real" fix, if such a thing is possible.

3 years ago

Well, like I said... it doesn't pain me too much to craft pipes manually. But you should know that when my character started churning out Stone Furnaces left and right (for what looked like no reason) it really looked like your mod was screwing up big time. At the very least, a warning to users that there are some potential compatibility issues would be a big help.

I'm not sure what you're saying the cause is, though. Are you thinking that Bob's included a recipe for crafting pipes using Stone Furnaces, so when I asked for pipes, your mod used that recipe as a way of getting there instead of just making pipes directly? I suppose that might make sense. If it's feasible, I would hope that HandyHands would check to see which recipe would take longer to get to the desired product and choose the recipe (or recipe path, if you will) that would take the least amount of time. If there were two recipes for crafting something, and one would take a single second and the other would take 45 seconds, I would really hope that HandyHands was smart enough to use the one second recipe.

In this case (and assuming that your theory is right), crafting chemical furnace (which uses pipes as an ingredient), so that the chemical furnace can be used as an ingredient in an "uncraft" recipe to get back the very pipes that HandyHands just put into it, both wouldn't make there be more pipes and would take way longer than just making the pipes directly, even if it did work to get more pipes out than were put in.

At the very least, I would thinking that you could have HandyHands verify that the recipe to be used outputs more of the desired product than it takes as an input. With the chemical furnaces, it takes two pipes to make them and then you get back two pipes when you "unmake" them.

3 years ago

I'm not sure what you're saying the cause is, though. Are you thinking that Bob's included a recipe for crafting pipes using Stone Furnaces, so when I asked for pipes, your mod used that recipe as a way of getting there instead of just making pipes directly?

No, not quite. HandyHands doesn't decide on a full "crafting path". It's more like it chooses one of the buttons (that has a number showing how many can be crafted right now) under the crafting tab that has the requested output listed. So it will never craft chemical furnaces to get pipes, because that recipe doesn't have pipes as output. If that happended it would be because Factorios method of finding recipe paths (when multiple things are queued up to produce something complex with a single click) was bugged. HandyHands relies on Factorio to do this and doesn't duplicate the functionality.

What it does is crafting the recipe that has regular furnaces and pipes as products that takes a chemical furnace as ingredients. The "stone furnace from chemical furnace"-recipe. HandyHands would use the regular pipes recipe if you had iron plates in your inventory. But if you have chemical furnaces and no iron plates then the only way to get pipes is to craft them through an alternative recipe.

If you are also requesting chemical furnaces to be autocrafted then I guess that would create a loop where once the pipes are crafted you get low on chem furnaces and then they will be prioritised instead.

I would hope that HandyHands would check to see which recipe would take longer to get to the desired product and choose the recipe (or recipe path, if you will) that would take the least amount of time.

Right now HandyHands takes the first unlocked recipe that it finds that you have the ingredients for, trying first with the canonical recipe (the one named the same as the single output product). This works great in vanilla since there's only one way to craft something.

Even if your hope was implemented, it wouldn't solve the problem. If you don't have iron plates then it doesn't matter if the canonical and shortest recipe path is prioritised first. It's already prioritised first in this case, but not having iron plates means HH will settle for another recipe with a lower priority.

At the very least, I would thinking that you could have HandyHands verify that the recipe to be used outputs more of the desired product than it takes as an input. With the chemical furnaces, it takes two pipes to make them and then you get back two pipes when you "unmake" them.

To make it clear, it's not making chemical furnaces with pipes to later make pipes. If it is making chemical furnaces it's because you requested them. Basically you have to recipes that take eachother as inputs and produce eachother as outputs, creating a recipe loop. HandyHands is basically stateless and planless. It only looks at what is needed in the current moment and starts the most prioritised requested thing. Currently it doesn't take into account how the ingredients affect the goal, only how the products affect the goal. HandyHands assumes you don't really care about the ingredients more than the requested products. And in vanilla, if you have requested both inserters and fast inserters, crafting fast inserters means you lose inserters. But it works anyways because once you have less inserters than fast inserters the regular inserters will have higher priority so it will craft those instead. The result is that you will have an increasing and equal amount of both (if you request an equal amount).

The assumptions that HandyHands works on to produce great and smart results with a dumb and efficient algorithm do not hold with Bob's mods. And the more advanced algorithms for choosing a recipe have never been needed before, in vanilla they would produce the exact same results.

Some mods don't follow the convention of naming the canonical recipe the same as the single product type. That is why the algorithm for finding all recipes (not recipe paths, that's the the job of the game) that can produce a thing.

But the simple solution is to not craft recipes with multiple outputs (maybe as an option), or not do it if there exists an unlocked recipe that only has that product as its only product.

3 years ago

Hm... Okay, I see.

It's definitely possible that I didn't have Iron Plates on hand. And it's also probable that I had HandyHands set to make some amount of Chemical Furnaces.

So, we're saying that HandyHands made Chemical Furnaces because I asked for them. Then it used those Chemical Furnaces to get Iron Pipes, because that was the only recipe that included Iron Pipes as an output that I could afford. As a result, I would get a couple of Iron Pipes and a Stone Furnace (that I didn't ask for or want). When I finally got some Iron Plates, HandyHands would use them to make more Chemical Furnaces, and break them down for pipes again, and we'd go round 'n' round like that until I had hundreds of Stone Furnaces.

Not making a recipe with multiple outputs seems like a good enough idea, assuming it isn't the only way to get something. In fact, I think it might be a problem if HandyHands were ever to make recipes with multiple outputs, even if this problem didn't happen, since cluttering up someone's inventory with things they didn't ask for seems like bad behavior.

Anyway, thanks for taking the time to hear me out and explain the issue. Double thanks if you decide to implement a fix. If you ever get that Patreon set up, let me know. I can't speak for everyone else who uses your mod, but I'd throw you some money for your effort.

3 years ago
(updated 3 years ago)

When I finally got some Iron Plates, HandyHands would use them to make more Chemical Furnaces, and break them down for pipes again, and we'd go round 'n' round like that until I had hundreds of Stone Furnaces.

The chemical furnaced that were crafted could have been crafted from your furnaces, but if you had stone in your inventory then maybe that recipe would have been found first. If you didn't have stone in your inventory then you would probably also get an infinite loop, but no extra furnaces because the chemical furnaces would have been made from the stone furnaces instead. So I guess the worst possible combination with no iron plates but lots of stone is the way to trigger this behaviour.

Edit: I don't think this explanation is enough, thinking more on it. You would have to also dump all the stone furnaces out of your inventory, or they would have been used instead of being crafted. Not yet sure if/how it's possible to get a loop without any interaction

Not making a recipe with multiple outputs seems like a good enough idea, assuming it isn't the only way to get something. In fact, I think it might be a problem if HandyHands were ever to make recipes with multiple outputs, even if this problem didn't happen, since cluttering up someone's inventory with things they didn't ask for seems like bad behavior.

I think I agree. I will probably make it an opt-in player setting for enabling multi-product recipe crafting.

I had another idea also that might also work, but it has some other issues: Checking if the ingredients would get higher priority (if also requested) than the thing you want to craft would have after it gets crafted. But it would also mean you would stop 1 short of your request for fast inserters if you are also requesting yellow inserters. It would stop loops though, I think even for mylti cycle loops even though you only test at a depth of 1. I might consider this idea further if I can make it slightly better.

Well I know enough to be able to start working on a fix now.

I've started setting up a patreon :) Takes a while to decide on all the things.

3 years ago

Version: 1.11.0
Date: 2020-09-07 13:00
Changes:
- There's now a setting (defaults to off) for enabling autocrafting of recipes with multiple products.
Thanks to imnotlaughin for reporting issues
with the previous behaviour!

Also made a patreon page :)! I think you can donate less than the lowest tier by writing in a custom amount. I might plan some actual tiers and benefits if ever comes to that point.
https://www.patreon.com/user?u=41598967

Took a while to push this update because I was testing other updates (performance updates) to this mod at the same time. But to get this out faster I had to give up on releasing that, temporarily, since I haven't removed all the bugs from that update yet.

3 years ago

I attempted to send you a donation, but also tried to immediately cancel auto-renew. Let me know if my cancellation kept you from getting any donation at all. It's hard to tell and it was definitely my intent to send something your way.

3 years ago

I can't see anything on my patreon account, so my guess is that it didn't work.

3 years ago

Okay, I see now. I guess it won't actually send you anything until October 1st. I think I have to keep "auto-renew" on until then. I'll just have to remember to cancel after that.

Anyway, thanks for your help. It was great of you to get an update out so quickly. Keep up the good work!

3 years ago

I got an email though, with some notes:

** just became a $50 patron!
Some important notes:
Patrons’ cards are charged on the first of the month.
Users can edit pledges at any time and also set monthly maxes so they don’t go over their budget.
We recommend sending out rewards after you see which patron cards were properly charged and accepted.

So apparently you need to wait a bit with cancellation.

But now I can see you in my list, I'm guessing you added yourself again. Thanks!!!
Bigger donation than I ever expected to get in total really :o

Maybe I should start considering some kind of rewards now. But extra buggy releases ("early access") and stuff feels more like an anti-reward since the highest quality stuff is what I put on the portal... But I have mods I use that are questionably more useful than annoying (and therefore not yet ready for public release)

3 years ago

Ha ha! I can't say what you should do as far as releases are concerned and I have no idea what strategy might work for encouraging people to donate.

As for my donation, I'm happy to do it - even without any kind of additional incentive. The kind of personal attention you've given the issue I brought up has been fantastic and your mod is an absolute must for me.

New response