as the title says i have some mining drills that will periodically get more ore entities spawned under them via script and when updated with update_connections they start mining again but it doesnt update the data on the wire connection with the new amount of resources unless you manually disable and reenable the read resource patch button.
i would assume that update_connections would also update the wire to the change in information. ive attached a save file with a test demo showing what its doing
wire connection to mining drill not updated with update_connections
-
- Smart Inserter
- Posts: 1462
- Joined: Sun Jun 15, 2014 11:39 am
- Contact:
wire connection to mining drill not updated with update_connections
- Attachments
-
- smart farm testing.zip
- (2.92 MiB) Downloaded 29 times
Re: wire connection to mining drill not updated with update_connections
This is a non trivial problem, it is possible it may be decided to be a not a bug, or indeed broken.
Problem here is that mining drill control behavior reading ore path does a one time scan of resources (either in range of the drill, or an entire patch) and from that point, mainly when in "entire patch" mode, when resources are depleted making an ore patch non contiguous (aka split in half) the tracked resources are still able to be on the other side of a split. If calling LuaEntity::update_connections would be expected to rescan entire ore patch and there would be gaps splitting it in half, then after the update an amount of resources found could be significantly lower since some entities tracked before would no longer be found.
You can workaround that by disabling "read resources" and then immediately enabling to force mining drill control behavior to rescan resources if you accept the side effect.
I am unable to tell if thats a bug, but i can tell that i am not willing to change that in 1.1.x
Problem here is that mining drill control behavior reading ore path does a one time scan of resources (either in range of the drill, or an entire patch) and from that point, mainly when in "entire patch" mode, when resources are depleted making an ore patch non contiguous (aka split in half) the tracked resources are still able to be on the other side of a split. If calling LuaEntity::update_connections would be expected to rescan entire ore patch and there would be gaps splitting it in half, then after the update an amount of resources found could be significantly lower since some entities tracked before would no longer be found.
You can workaround that by disabling "read resources" and then immediately enabling to force mining drill control behavior to rescan resources if you accept the side effect.
I am unable to tell if thats a bug, but i can tell that i am not willing to change that in 1.1.x
Re: wire connection to mining drill not updated with update_connections
I moved this to not a bug given there's not a clear correct answer for how it should behave and there is a simple method for a mod to force a refresh if that's what they want and are ok with the possible side effects.
If you want to get ahold of me I'm almost always on Discord.
Re: wire connection to mining drill not updated with update_connections
For 2.0 i made an executive decision: mining drill will rescan resources that are read by control behavior after LuaEntity::update_connections call. This is for consistency because i also added a rescan when prototypes change because drill range could change or accepted resources for that drill could have changed.