wire connection to mining drill not updated with update_connections

This subforum contains all the issues which we already resolved.
kingarthur
Smart Inserter
Smart Inserter
Posts: 1463
Joined: Sun Jun 15, 2014 11:39 am
Contact:

wire connection to mining drill not updated with update_connections

Post by kingarthur »

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
Attachments
smart farm testing.zip
(2.92 MiB) Downloaded 32 times
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3052
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: wire connection to mining drill not updated with update_connections

Post by boskid »

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
Rseding91
Factorio Staff
Factorio Staff
Posts: 14345
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: wire connection to mining drill not updated with update_connections

Post by Rseding91 »

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.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3052
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: wire connection to mining drill not updated with update_connections

Post by boskid »

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.
Post Reply

Return to “Resolved Problems and Bugs”