Repository navigation
fix(connect_entities): return the pole network that was just connected - #428
Open
hashbender wants to merge 1 commit into
Open
hashbender wants to merge 1 commit into
hashbender wants to merge 1 commit into
Conversation
_process_power_groups returned get_entities(poles, source_pos), which uses the default radius of 1000 and so lists every pole network nearby, and _connect_pair_of_waypoints returns connection[0]. A pole connection could therefore return the ElectricityGroup of an unrelated network elsewhere on the map. Pick the group holding the poles the connection placed (or, if none were placed, the group at the source position), as the pipe and wall paths already do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
connect_entities(a, b, Prototype.SmallElectricPole)(or medium or big poles) can return theElectricityGroupof a different network elsewhere on the map. With one network built in each quadrant:An agent reading
group.polesor the group id then reasons about the wrong network.Root cause
_process_power_groups(connect_entities/client.py:1003-1017) returnsself.get_entities({poles}, source_pos), which uses the defaultradius=1000and so lists every pole network nearby._connect_pair_of_waypointsreturnsconnection[0](:266): whichever network the map search finds first._process_pipe_groups,_process_groups) already pick the group atsource_pos.Fix
source_pos.Testing
Run against a Factorio 2.0.73 headless server:
test_connect_poles_returns_own_networkintests/connect/test_connect_poles.pyfails onmain(the 4th connection returns the 3rd network) and passes with the fix.test_connect_power_poles_without_blocking_mining_drill, fails the same way onmainand with the fix (it needs 52 poles and the fixture gives 50 on this map). Not related to this change.🤖 Generated with Claude Code