[MOD 0.17] HandyHands - Autocrafting - v1.2.2 ammo & pause

Topics and discussion about specific mods
Qon
Smart Inserter
Smart Inserter
Posts: 2119
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: [MOD 0.13] HandyHands - Autocrafting - v1.2.2 ammo & pause

Post by Qon »

Peter34 wrote: I realize that I can still do that with this mod, by sacricifigin precious Tool Belt slots (early game, when I only have ten!) on Electric Circuits and on Gear Wheels (two stacks of the later!). It's just...
Yes, you can already do that.... and that stage of play will not last that many minutes anyways. After that you have a few assemblers crafting those intermidiates with chests as input at the very least. If you don't hand craft the intermidiates your handcrafting will be sped up many times over.

You don't need two stacks of gears on the toolbelt though. While holding gears in hand press HandyHands-Increase key (default U now) to increase the auto crafting limit of gears. Then you can let HH craft up to 4 stacks where 3 of them can sit in your regular inventory.

It would be possible to add the ability to autocraft things not locked on the toolbelt, but the application is so small and it would make the mod less simple. Right now only toolbelt locked items are autocrafted, which makes it very easy to grasp how it works.

iamwyza
Fast Inserter
Fast Inserter
Posts: 115
Joined: Tue Jun 07, 2016 2:59 pm
Contact:

Re: [MOD 0.13] HandyHands - Autocrafting - v1.2.2 ammo & pause

Post by iamwyza »

I didn't see this in the posts I glanced over, but it'd be great to have handyhands not try to build stuff in your toolbar if the following rules are met:

1. The item in question is being requested by the Personal Logistics slots
2. You are in a logistics network
2. The item in question is being fullfill by a logistics request.


Basically "if the network is already building it for me, don't hand craft it." But if I'm not in the network (out building an outpost) or the network can't fullfill my request, then I'd want HH to do its thing.

Thoughts? I love HH early game, but late game logistics bots make it annoying except those times when i'm out doing outpost buildings

Qon
Smart Inserter
Smart Inserter
Posts: 2119
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: [MOD 0.13] HandyHands - Autocrafting - v1.2.2 ammo & pause

Post by Qon »

iamwyza wrote:2[3]. The item in question is being fullfill by a logistics request.
Sounds like a good suggestion. I don't think point 3 is possible directly, but it could work decently if I check the amount in the network and assume the bots will deliver it to the player in question (instead of somewhere else). If the items are delivered somewhere else and not continously assembled then logistics storage will drop and HH will then start crafting a little bit later. But when they deliver it to the player it's removed from storage so HH would believe the items disappeared while they are in transit towards you. Could be tricky to have it work sensibly. Hopefully the amount of CPU time it will take to check logistics storage as often as HH would need that info isn't too great also.

If you autotrash items then the extra handcrafted items shouldn't be much of a problem. The autotrash mod gives you the option to only autotrash in a specific network.

wvlad
Fast Inserter
Fast Inserter
Posts: 215
Joined: Thu Jul 13, 2017 9:55 pm
Contact:

Re: [MOD 0.13] HandyHands - Autocrafting - v1.2.2 ammo & pause

Post by wvlad »

Hi, I have a few improvements for this mod (1.5.1 based), it'd better if you upload the source to GitHub for easier pull requests.

I added the possibility to mark things to be autocrafted regardless of their presence in hotbar. When you are holding an item there is a hot key to toggle "always autocrafting mode" - Ctrl+Alt+Shift+Y. I also commented out the "auto-off" feature, I don't like it showing me "press a hotkey to reenable autocrafting" each time I enter ghost mode. And also I commented out the "delete all settings" feature when you press "decrease" and it's already at 0 - it may happen accidentally.

Of course you can compare it and copy only changes you need (e.g. with WinMerge).
control.lua
data.lua

Qon
Smart Inserter
Smart Inserter
Posts: 2119
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: [MOD 0.13] HandyHands - Autocrafting - v1.2.2 ammo & pause

Post by Qon »

wvlad wrote:Hi, I have a few improvements for this mod (1.5.1 based), it'd better if you upload the source to GitHub for easier pull requests.
Of course you can compare it and copy only changes you need (e.g. with WinMerge).
Hello! It's nice that you mod and share your edits!
While I will take a bit of extra consideration time on the specific edits you have done, the changes are unlikely to enter my main branch. The changes have been qonsidered in the past and rejected because I decided that the current behaviour was closest to optimal.
wvlad wrote: I added the possibility to mark things to be autocrafted regardless of their presence in hotbar.
This means you can't stop autocrafting a specific item if you don't have it. Also severs the simple connection of "blue means autocraft and hotbar locked". Might be an optional feature (can be disabled in the mod settings) in the future. But I'm not sure there's much benefit to the idea. Autocrafting 10~ items that you want constant access too is enough with vanilla items for me at least. After that you get robots and items you can't really handcraft.
wvlad wrote: When you are holding an item there is a hot key to toggle "always autocrafting mode" - Ctrl+Alt+Shift+Y. I also commented out the "auto-off" feature,
I'm trying to keep the hotkeys to a minimum. I wish I didn't even need the 2 that are in atm. That's why pausing doesn't need a hotkey and happens automatically by the same action that you would use to cancel the started autocraft, that's an action you would do anyways when pausing. And it would be annoying if you canceled a autocraft and the mod just added it immediatly again!
wvlad wrote: I also commented out the "auto-off" feature, I don't like it showing me "press a hotkey to reenable autocrafting" each time I enter ghost mode.
Enter ghost mode? A mod or setting char to nil by command? Not something I do so haven't had any problems with this.
wvlad wrote: And also I commented out the "delete all settings" feature when you press "decrease" and it's already at 0 - it may happen accidentally.
It requires at least two clicks while the mod is running. And you don't change that setting that often anyways so you probably don't spam the hotkeys as fast as you can. Setting default to 0 doesn't pause items with individual settings so if you want to pause you use the pause feature, right?

I have never been remotely close to an accidental reset. In what scenario would that happen for you?

wvlad
Fast Inserter
Fast Inserter
Posts: 215
Joined: Thu Jul 13, 2017 9:55 pm
Contact:

Re: [MOD 0.13] HandyHands - Autocrafting - v1.2.2 ammo & pause

Post by wvlad »

It may happen when I press the shortcut several times. Factorio filters "print" messages and some of them are not shown if you print them frequently. So I press "J" twice but see the message only once so I press it again and bum - my settings are gone.
Enter ghost mode? A mod or setting char to nil by command? Not something I do so haven't had any problems with this.
Yes, like mod that locates my logistics items on map.

When you are holding an item there is a hot key to toggle "always autocrafting mode" - Ctrl+Alt+Shift+Y. I also commented out the "auto-off" feature,
I'm trying to keep the hotkeys to a minimum. I wish I didn't even need the 2 that are in atm. That's why pausing doesn't need a hotkey and happens automatically by the same action that you would use to cancel the started autocraft, that's an action you would do anyways when pausing. And it would be annoying if you canceled a autocraft and the mod just added it immediatly again!
The shortcut is not about pausing, when you don't want to keep some items in hotbar but still want to autocraft them you can press that shortcut.

btw, It's a requested feature:
I realize that I can still do that with this mod, by sacricifigin precious Tool Belt slots (early game, when I only have ten!) on Electric Circuits and on Gear Wheels (two stacks of the later!). It's just...

Qon
Smart Inserter
Smart Inserter
Posts: 2119
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: [MOD 0.13] HandyHands - Autocrafting - v1.2.2 ammo & pause

Post by Qon »

wvlad wrote:It may happen when I press the shortcut several times. Factorio filters "print" messages and some of them are not shown if you print them frequently. So I press "J" twice but see the message only once so I press it again and bum - my settings are gone.
I thought that only happened to messages that were identical. Did some further testing, appears the standard message getting blocked triggers a full block of all messages for that fraction of a second. I might have to add some random spaces at the ends of all lines to circumvent this nasty Factorio behaviour. If this is solved then you will never accidentally delete all your settings again, right?
wvlad wrote: The shortcut is not about pausing, when you don't want to keep some items in hotbar but still want to autocraft them you can press that shortcut.
So you removed pause, settings deletion and enabled autocrafting of items not hotbar locked. All of the safety features that gives you the power to stop HH, gone? Is that really the behaviour you want? Seems like you could end up in a really frustrating spot. I hope for your sake you never need to quickly pause the mod or similar.
wvlad wrote: btw, It's a requested feature:
I realize that I can still do that with this mod, by sacricifigin precious Tool Belt slots (early game, when I only have ten!) on Electric Circuits and on Gear Wheels (two stacks of the later!). It's just...
And I have already responded to that message...
Qon wrote:
Peter34 wrote: I realize that I can still do that with this mod, by sacricifigin precious Tool Belt slots (early game, when I only have ten!) on Electric Circuits and on Gear Wheels (two stacks of the later!). It's just...
Yes, you can already do that.... and that stage of play will not last that many minutes anyways. After that you have a few assemblers crafting those intermidiates with chests as input at the very least. If you don't hand craft the intermidiates your handcrafting will be sped up many times over.

You don't need two stacks of gears on the toolbelt though. While holding gears in hand press HandyHands-Increase key (default U now) to increase the auto crafting limit of gears. Then you can let HH craft up to 4 stacks where 3 of them can sit in your regular inventory.

It would be possible to add the ability to autocraft things not locked on the toolbelt, but the application is so small and it would make the mod less simple. Right now only toolbelt locked items are autocrafted, which makes it very easy to grasp how it works.

rulerofdabacon
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sun Jul 09, 2017 1:54 am
Contact:

Re: [MOD 0.13] HandyHands - Autocrafting - v1.2.2 ammo & pause

Post by rulerofdabacon »

A couple strange bugs, one of which may not be a bug. First of all, for some reason the mod doesn't autocraft any Yuoki items. Secondly, whenever it cues up another crafting item, it sort of "resets" whatever gui I'm in, including things such as the text box for blueprints, which was really annoying until I figured out what was doing it. Is there any way you could fix either of these?

Edit: only resets the gui when crafting things involving bob's basic circuit boards, including the circuit boards themselves. And in fact, it seems to do it whenever it finishes any stage of the crafting of something. That is to say, whenever it completes all of a certain ingredient. Also, for a bit of perspective on the gui reset, it does the base game's production monitor as well. It will set it back to 5 seconds each time it resets.

Second edit: So it's even manual crafting with the basic circuit boards, so ignore that bit. But I'd still like to be able to have it do yuoki items.

Qon
Smart Inserter
Smart Inserter
Posts: 2119
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: [MOD 0.13] HandyHands - Autocrafting - v1.2.2 ammo & pause

Post by Qon »

rulerofdabacon wrote:for some reason the mod doesn't autocraft any Yuoki items.
I'll look into it.


*looking into it...*


Yuoki names his recipies "incorrectly". HH assumes the recipe for the item is named the same as the item it tries to autocraft. This works for vanilla items and while it is an assumption that can be wrong, it's fast and simple. It could be solved by going through all the recipies in the game and building a second hashmap on top of the regular one (provided by the game), every time you load a save. While it's doable it also seems like an unproportional amount of work.

Or Yuoki could rename his recipies to fit the convention all other items do.

Right now he names his recipe for "y-stuff" something like "y-stuff-recipe". Why he decided to have "-recipe" in the name of many of his recipies is a bit baffling to me.

Also a recipies with several products (uncommon in vanilla, not handcraftable anyways since those are oil products) and items that have several recipies to produce them can't really be solved perfectly automatically. Then there are multiple options and HH can't really know what option is the best. And the recipie name could be anything. The extra plate recipies adds multiple paths and irregular names. "y-refined-copper" requires "y-pure-copper" and produces "copper-plate" like the regular copper plate recipe as an example (this one is a smelting recipie so it can't be handcrafted anyways though).

The recipe for "y-mixed-fuel" is named "y-coaldust-mixing-recipe" for some reason only known to Yuoki. So it's not named after the item AND it adds a "-recipe".

I'm not sure if I want to bother fixing this when Yuoki is doing so many weird things with his recipe names and structure. The simplest fix is to give the recipies sensible names, but only Yuoki can do that unless you want to patch it yourself every time he releases an update. If you message Yuoki about it tell me after what his response is.

Edit:
I'll forget about this in a while and if Yuoki never hears of it or doesn't want to take action then I'll need a reminder q:
Also technically the recipe names are not wrong, they just don't follow the convention all other items do. And that convention helps immensly when doing recipe lookups, so I think people should stick to it.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [MOD 0.13] HandyHands - Autocrafting - v1.2.2 ammo & pause

Post by eradicator »

Qon wrote:
rulerofdabacon wrote:for some reason the mod doesn't autocraft any Yuoki items.
I'll look into it.
*looking into it...*
Yuoki names his recipies "incorrectly". [...]
I don't really care about what you think about Yuoki's mods. But your assumption that every item can always be crafted by exactly one recipe that is exactly the same as the item-name and that that recipe also happens to be handcraftable is fundamentally wrong. You even mention items with multiple recipes yourself. Building a reverse-lookup table is computationally cheap enough to do once per load per on_research_finished. Though as i'm currently working on a mod that also requires reverse-recipe lookup i do realize that this is not an easy task to program at all. But you putting the blame on other people when it's really a defect in your mod annoyed me enough to post this.

For a simple reverse-lookup it would be sufficient to loop through all recipies and check if they're handcraftable. And then just take the first one. Here's some example code that does exactly that:

Code: Select all

local lookup = {}
local function update_lookup(force) --lookup must be per force
  lookup[force.name] = {}
  
  for _,recipe in pairs(force.recipes) do
    for _,product in pairs(recipe.products) do
      if (not lookup[force.name][product.name]) and
         (recipe.enabled) and
         (recipe.category == 'crafting') then
        lookup[force.name][product.name] = recipe.name
        end
      end
    end
  end
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Qon
Smart Inserter
Smart Inserter
Posts: 2119
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: [MOD 0.13] HandyHands - Autocrafting - v1.2.2 ammo & pause

Post by Qon »

eradicator wrote: But your assumption that every item can always be crafted by exactly one recipe that is exactly the same as the item-name and that that recipe also happens to be handcraftable is fundamentally wrong.
Yes. But I'm also lazy, busy, don't think it's interesting to code the fix and wish someone else could do it. :^]
And it works for vanilla, would be so nice if if every modder just stuck with that convention since it has no real downsides. Wishful thinking, not really blaming Yuoki here.

It has to be on load AND research. Otherwise the lookup has to be saved and keeping state correct over multiple versions is a real pain and a big invitation for the strangest of bugs. And it wouldn't even give any real benefits.
I will have to fix it eventually, I want the mod to be smooth. It should just work.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [MOD 0.13] HandyHands - Autocrafting - v1.2.2 ammo & pause

Post by eradicator »

Qon wrote:Yes. But I'm also lazy, busy, don't think it's interesting to code the fix and wish someone else could do it. :^]
Well. I kinda already did post that code above which should at least solve 90% of the issues. I can releate to the first bit of that reasoning more than i want to though...
Qon wrote:And it works for vanilla, would be so nice if if every modder just stuck with that convention since it has no real downsides. Wishful thinking, not really blaming Yuoki here.
As you already noted yourself and as i tried to explain there are simply situations where sticking to that convention is either undesirable or straight out impossible. It's called a "convention" and not a "rule" for a reason :P
Qon wrote:It has to be on load AND research. Otherwise the lookup has to be saved and keeping state correct over multiple versions is a real pain and a big invitation for the strangest of bugs.
True. But that's adding two lines of code. Not too difficult. For bug-safety you could use it as a fallback only when your current method fails. Though imho "guessing" the recipe name is equally bug-prone.
Qon wrote:And it wouldn't even give any real benefits.
How about the benefit of actually working and pleasing your userbase. :P
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Qon
Smart Inserter
Smart Inserter
Posts: 2119
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: [MOD 0.13] HandyHands - Autocrafting - v1.2.2 ammo & pause

Post by Qon »

eradicator wrote:
Qon wrote:Yes. But I'm also lazy, busy, don't think it's interesting to code the fix and wish someone else could do it. :^]

Well. I kinda already did post that code above which should at least solve 90% of the issues. I can releate to the first bit of that reasoning more than i want to though...
The last 10% of the work requires 90% of the time...
It has to be integrated with the code and tested, the migrations needs a checkup, the changelog and version number has to be updated in 2 places and so on.
Integration requires you to make sure each player can access it on join to a multiplayer server and so on. I want to call it once per force join if possible, unless that requires too much work for too little benefit. Was a while since I read the documentation and this change requires that I read up on it again. Otherwise it breaks in multiplayer. And I have to make sure other special cases like that are covered.
But the code looks sensible so I might just throw it in once all prep work is done...
eradicator wrote:
Qon wrote:And it wouldn't even give any real benefits.
How about the benefit of actually working and pleasing your userbase. :P
The non-existing benefits was about saving the recipe map with map save, not about fixing the bug.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [MOD 0.13] HandyHands - Autocrafting - v1.2.2 ammo & pause

Post by eradicator »

Qon wrote:The last 10% of the work requires 90% of the time...
The last 10% i was thinking about were even more edgy-edge cases (like fixing the assumption that the player can actually craft the "crafting" category). But yea sure, debugging/testing and updating all the pages takes time too.
Qon wrote:the migrations needs a checkup
As it's a pure runtime change it shouldn't need any migration.
Qon wrote:Integration requires you to make sure each player can access it on join to a multiplayer server and so on. I want to call it once per force join if possible, unless that requires too much work for too little benefit. Was a while since I read the documentation and this change requires that I read up on it again. Otherwise it breaks in multiplayer. And I have to make sure other special cases like that are covered.
I actually thought about that and my conclusion was that that on_load and on_research_finished should be sufficient. Creating the table from scratch every time the function is called (as opposed to extending the existing table) is actually there to prevent any possible desyncs.
My reasoning is as follows: The table only changes when research finishes. So any player joining inbetween researches will get the same results in on_load as all the other players already have. And joining on the same tick as on_research_finished would just execute the same function twice so no desync potential there either.
If you wanted to go the "totally 200% sure always" way i guess you could just update the tables for all forces every time any player joins. But that sounds like overkill.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

rulerofdabacon
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sun Jul 09, 2017 1:54 am
Contact:

Re: [MOD 0.13] HandyHands - Autocrafting - v1.2.2 ammo & pause

Post by rulerofdabacon »

I understand ... in the very past was some conflicts with recipe/items with other mods. So i changed to this name-schematic.
It would need a complete rewrite of the mod, but because it's nessesary anyway for upcomming versions of factorio it will maybe happen.
At the moment is no short/quick fix around to make the mod compatible with HandyHands. Sorry.
YuokiTani's reply to my PM. Thoughts?

Qon
Smart Inserter
Smart Inserter
Posts: 2119
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: [MOD 0.13] HandyHands - Autocrafting - v1.2.2 ammo & pause

Post by Qon »

rulerofdabacon wrote:
I understand ... in the very past was some conflicts with recipe/items with other mods. So i changed to this name-schematic.
It would need a complete rewrite of the mod, but because it's nessesary anyway for upcomming versions of factorio it will maybe happen.
At the moment is no short/quick fix around to make the mod compatible with HandyHands. Sorry.
YuokiTani's reply to my PM. Thoughts?
I guess I'll have to deal with it...

0.16 will break HH too if the changes proposed in the FF goes through. Not sure how far away 0.16 is though.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [MOD 0.13] HandyHands - Autocrafting - v1.2.2 ammo & pause

Post by eradicator »

@rulerofdabacon: Other than "not suprised that he had his reasons"? No. Not really.
Qon wrote:0.16 will break HH too if the changes proposed in the FF goes through. Not sure how far away 0.16 is though.
I bet there's still going to be a way to read the "filters" on the quickbar. So. Break, yea. Make unfeasible, no.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

rulerofdabacon
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sun Jul 09, 2017 1:54 am
Contact:

Re: [MOD 0.13] HandyHands - Autocrafting - v1.2.2 ammo & pause

Post by rulerofdabacon »

What changes are you talking about specifically? I haven't read them all (though I've read most of the new ones since I came back to playing factorio) and even the ones I do read, I don't always catch everything. What change are they thinking they're going to make?

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [MOD 0.13] HandyHands - Autocrafting - v1.2.2 ammo & pause

Post by eradicator »

rulerofdabacon wrote:What changes are you talking about specifically? I haven't read them all (though I've read most of the new ones since I came back to playing factorio) and even the ones I do read, I don't always catch everything. What change are they thinking they're going to make?
Changing the quickbar to not be an actual inventory. So it doesn't contain stacks of items. Just buttons to pull them out of your main inventory quickly. Imho it's pretty much decided this is going to happen.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

NeilN
Long Handed Inserter
Long Handed Inserter
Posts: 51
Joined: Sun Mar 27, 2016 4:24 pm
Contact:

Re: [MOD 0.13] HandyHands - Autocrafting - v1.2.2 ammo & pause

Post by NeilN »

Any plans to update this for 0.16?

Post Reply

Return to “Mods”