Page 1 of 1

Dragging power poles should connect power networks

Posted: Sun Aug 26, 2018 7:34 pm
by thuejk
When dragging autoplacing power poles to power stuff, you basically always want to connect to an existing power network.

Example of the current logic being inconvenient: https://www.thuejk.dk/factorio_drag_power.flv

However, the current power pole dragging will often detect that all entities (e.g. miners) are covered by at least one power pole, and then not place a last power pole to connect the new unpowered network to the old powered network.

My suggestion for an improvement: drag-place a power pole in the last position which will connect two power networks, in addition to the current power miners logic.

Re: Dragging power poles should connect power networks

Posted: Mon Aug 27, 2018 2:19 pm
by Cribbit
https://youtu.be/oq2wEZS120c for easier viewing

The issue isn't that it thinks the miners already have power.

Dragging is pretty simple logic - as soon as you're at edge of range of all power poles, drop another pole.

Unfortunately this edge case is impossible to fix without breaking it entirely. You're always going to have to place the last pole in a situation like this manually.

Re: Dragging power poles should connect power networks

Posted: Wed Aug 29, 2018 8:01 am
by daniel34
Cribbit wrote:The issue isn't that it thinks the miners already have power.

Dragging is pretty simple logic - as soon as you're at edge of range of all power poles, drop another pole.
Dragging was changed a while ago to make sure all entities in the area are connected, e.g. if you run along a row of inserters and drop medium power poles then they will be all covered without a gap.

Code: Select all

Version: 0.15.0 (24. 04. 2017)
  Minor Features:
    - Build-by-moving for electric poles now accounts for covering all unpowered entities on the way.
This has been suggested a few times already, even has its own Frequently Suggested topic: viewtopic.php?f=80&t=35838

Re: Dragging power poles should connect power networks

Posted: Fri Aug 31, 2018 11:23 am
by thuejk
Cribbit wrote: Unfortunately this edge case is impossible to fix without breaking it entirely. You're always going to have to place the last pole in a situation like this manually.
No, it is not impossible to fix. I outlined in my post how to fix it.

Re: Dragging power poles should connect power networks

Posted: Fri Aug 31, 2018 11:41 am
by thuejk
daniel34 wrote:
Cribbit wrote: This has been suggested a few times already, even has its own Frequently Suggested topic: viewtopic.php?f=80&t=35838
I like my suggested implementation better.

Re: Dragging power poles should connect power networks

Posted: Sat Sep 01, 2018 8:57 pm
by Cribbit
thuejk wrote:
Cribbit wrote: Unfortunately this edge case is impossible to fix without breaking it entirely. You're always going to have to place the last pole in a situation like this manually.
No, it is not impossible to fix. I outlined in my post how to fix it.
You wrote sentences in english. There is a wide gap between that and actual code logic to have it happen. That is what "edge case" implies here. Your suggested solution does not account for how you actually detect the situation you want to fix.

Re: Dragging power poles should connect power networks

Posted: Sun Sep 02, 2018 6:04 pm
by thuejk
I am actually a programmer. What I wrote was something I had already made sure could be implemented, basically using the existing logic.

Re: Dragging power poles should connect power networks

Posted: Mon Sep 03, 2018 12:50 pm
by Cribbit
thuejk wrote:I am actually a programmer. What I wrote was something I had already made sure could be implemented, basically using the existing logic.
Can you articulate that logic?

I don't want dragged poles dropping in random locations because it happens to be near an existing network and would cover an entity.

I don't want it to place a pole when I end the drag.

Re: Dragging power poles should connect power networks

Posted: Mon Sep 03, 2018 1:00 pm
by ratchetfreak
It sounds like the logic should be something like
  1. if cursor no longer in range of any network, place pole in last valid location.
  2. if cursor is in range of network with different ID place pole connecting the networks
  3. otherwise don't place pole
condition 2 can be refined to avoid placing poles with maximum stretch to the next network and instead try to add some tiles of slack. for example by using the leaving the network as trigger and placing the pole in the spot where the cable lengths are minimized.

Re: Dragging power poles should connect power networks

Posted: Tue Sep 04, 2018 1:31 pm
by Cribbit
What if I don't want to connect those networks? What if I plan on turning another direction and just slightly overshot? There's going to be a wide variety of valid spots since it's no longer the edge of a circle but an area of its own - what if I I want to place it somewhere specific?

It seems much easier to leave this as is and let users manually place the pole. I understand the frustration of this specific case but there are many other cases besides this.

Re: Dragging power poles should connect power networks

Posted: Wed Sep 05, 2018 10:39 pm
by thuejk
ratchetfreak has it right.
What if I don't want to connect those networks?
I have never, ever wanted that. While I have been annoyed at power pole dragging not connecting networks *every* *single* *time*.

If you have some insanely specific power setup that requires separate power networks, then simply don't use power pole dragging.