Under the right conditions, deleting a power pole (or other wire connected building) then using undo can restore wires (Copper, red, or green) from an earlier state, or even create new wire connections which never existed.
Steps to reproduce:
1. Build 3 medium power poles close together - close enough that wires can be connected between all 3.
2. Use Cut + Paste to move a power pole, while still being close to the other 2.
3. (Optional) Remove all wires using the wire tool.
4. Delete all 3 power poles
5. Undo the deletion.
After performing the undo, all 3 power poles will be connected together, regardless of whether or not they were connected before. This applies to both copper wires, and red/green wires.
[2.0.9] Undo can add extra wires to buildings moved w/ cut
-
- Burner Inserter
- Posts: 8
- Joined: Mon May 06, 2024 9:45 am
- Contact:
-
- Burner Inserter
- Posts: 8
- Joined: Mon May 06, 2024 9:45 am
- Contact:
Re: [kovarex] [2.0.9] Undo can add extra wires to buildings moved w/ cut
I forgot to mention in my initial post - To reproduce this, you need to use ghosts, or be in editor mode.
Re: [2.0.9] Undo can add extra wires to buildings moved w/ cut
I tried to reproduce this issue but in 2.0.41 everything seems to be working fine. Only part that was close to being suspicious is the cut+paste of electric pole which adds extra wire that was not undone but this is already covered by 118468 saying why it wont be fixed.
-
- Burner Inserter
- Posts: 8
- Joined: Mon May 06, 2024 9:45 am
- Contact:
Re: [2.0.9] Undo can add extra wires to buildings moved w/ cut
Thanks for the investigation! I took a look at the linked thread and while that issue may have the same root cause, the expected behavior is different. In this case, I'm undoing the deletion of some entities, and within that set of entities, new connections are being made.
I spent a few minutes testing this, and found that the problem depends on how the power poles are positioned relative to each other, possibly even based on the order they were constructed in. I did find a pattern which produces the behavior consistently.
I've attached a video of the bug successfully being reproduced in the current version of Factorio (2.0.41 (build 81968 expansion, linux64)). Hopefully this helps.
I should also mention that while I have an example with power poles, this was simply the easiest way to reproduce the problem. This happens with other entities, and can result in new connections between combinators. Also, so far I've only seen this create connections between poles which already belong to the same circuit / power network. It does not seem like this can connect different networks together.
I spent a few minutes testing this, and found that the problem depends on how the power poles are positioned relative to each other, possibly even based on the order they were constructed in. I did find a pattern which produces the behavior consistently.
I've attached a video of the bug successfully being reproduced in the current version of Factorio (2.0.41 (build 81968 expansion, linux64)). Hopefully this helps.
I should also mention that while I have an example with power poles, this was simply the easiest way to reproduce the problem. This happens with other entities, and can result in new connections between combinators. Also, so far I've only seen this create connections between poles which already belong to the same circuit / power network. It does not seem like this can connect different networks together.
Re: [2.0.9] Undo can add extra wires to buildings moved w/ cut
This still falls into the same classification as 118468. When electric pole is removed, in order to attempt to keep connections it does a "rewire" operation which has no access to the player removing it because in many cases it simply cannot have access to it (like when entity is ordered deconstruction and removed later by a construction robot). Scenario in the provided video is just the same scenario and removing 3 electric pole ghosts with one deconstruction planner action is irrelevant because under the hood, game is unable to remove 3 entities at the same time, they are removed in certain order. When first ghost electric pole is removed (in this case it is the leftmost pole in the topmost 2 tile high row) it does rewire connecting other 2 poles with extra wire and then those 2 other electric poles are removed - here if you undo, all entities are restored but you start seeing the wires that were added in the "in between" state. It is not the undo that adds extra wires, they are added when removing poles but you only get to see extra wires after undo is performed.
-
- Burner Inserter
- Posts: 8
- Joined: Mon May 06, 2024 9:45 am
- Contact:
Re: [2.0.9] Undo can add extra wires to buildings moved w/ cut
That makes sense from a technical perspective, however as an end user, this results in undesirable behavior. When I undo a deletion or cut, I expect the deleted entities to be restored in the same state they were in when deleted - wires included.
While this simplified example isn't much of a problem, this behavior made building a circuit powered nuclear power plant extremely painful. As I was moving components around, or deleting+undoing the power plant to reset its state, I would have to spend time finding the new wires introduced by the "rewire" operation, and remove them. A few times this even introduced flaws in my designs, since two components I thought had been disconnected were secretly connected through a wire I never placed.
My initial idea is to add rewiring to the undo/redo stack, however thinking about how it interacts with bots, that would only work if rewiring happens when entities are marked for deconstruction instead of actually deconstructed. Even then, undo can become complicated. Maybe another approach would work.
It seems like rewiring doesn't happen when combinators are deconstructed - this is good. However when a power pole is deconstructed, the rewire operation can end up automatically connecting two combinators together - This is the behavior which is causing me issues. A simple solution for this would be to forbid combinator -> combinator rewiring operations (or even only allow pole to pole rewires). This may just be a personal preference, so maybe add a setting to pick rewire behavior?
While this simplified example isn't much of a problem, this behavior made building a circuit powered nuclear power plant extremely painful. As I was moving components around, or deleting+undoing the power plant to reset its state, I would have to spend time finding the new wires introduced by the "rewire" operation, and remove them. A few times this even introduced flaws in my designs, since two components I thought had been disconnected were secretly connected through a wire I never placed.
My initial idea is to add rewiring to the undo/redo stack, however thinking about how it interacts with bots, that would only work if rewiring happens when entities are marked for deconstruction instead of actually deconstructed. Even then, undo can become complicated. Maybe another approach would work.
It seems like rewiring doesn't happen when combinators are deconstructed - this is good. However when a power pole is deconstructed, the rewire operation can end up automatically connecting two combinators together - This is the behavior which is causing me issues. A simple solution for this would be to forbid combinator -> combinator rewiring operations (or even only allow pole to pole rewires). This may just be a personal preference, so maybe add a setting to pick rewire behavior?