-
Notifications
You must be signed in to change notification settings - Fork 26
Description
When loading a blueprint from an external source, or building it in code, and then copying its .entities to a Group, Draftsman throws an InvalidAssociationError if any entities have any connections of either kind (circuit or power). The external blueprint is valid in-game, and this can be reproduced in a blueprint with two entities: two power poles with a single electric connection. Test case available as gist.
Current Behavior
- Either load an existing blueprint from disk into a
Blueprintobject, or create one in code. - Copy the blueprint's
.entitiesto a newGroup(group.entities.extend(bp.entities)). - IF there are no connections between any entities, the copy will succeed and the group will be ready for use.
- If there are connections, an
InvalidAssociationErrorexception will be thrown, with explanatory text like this:
Attempting to connect to <ElectricPole 'medium-02'>{'name': 'medium-electric-pole', 'position': {'x': 3.0, 'y': 0.0}, 'neighbours': [<Association to ElectricPole at 0x00007F62A442FED0>]} which lies outside this EntityCollection; are all Associations between entities contained within this EntityCollection being copied?
Expected behavior
Copying a list of entities from a blueprint should work the same as copying them from a group that was generated in code. All connections should be preserved, and no errors should be thrown.
Additional context
Related to #22.
Draftsman version: 1.1.0
Python version: 3.12.0
I wanted to find out if this can be supported natively, as I use this in a tool that "remixes" blueprints by loading them into Groups and modifying and combining them according to the user's config.