Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Bob's adjustable inserters #121

Open
theunkn0wn1 opened this issue Aug 3, 2024 · 2 comments
Open

Support for Bob's adjustable inserters #121

theunkn0wn1 opened this issue Aug 3, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@theunkn0wn1
Copy link

theunkn0wn1 commented Aug 3, 2024

Describe the bug
When loading a blueprint that has bob's adjustable inserters in it, draftsman emits warnings and drops the fields.

Current Behavior
Example blueprint string:

0eNqlkt1ugzAMhd/F1wkCwl95lWmqQrBaqySgJExDKO++AFI1dd16sbs48fniY3uFbphxsmQ8tCuQGo2D9m0FRxcjh+3OLxNCC+RRAwMj9RZJ51B3A5kL11JdySAXEBiQ6fET2iy8M0DjyRMevD1YzmbWHdqYcCd1NrK4uqLzET+NLmpGs30cObxKy6RksMSjyJukDIH9YOV3lsWeOy/VjZNxaH18fYE8RSSDniyqIyfCejtO5wdVuguyJE9Flj+tQvzdm2d1iJfWin9Yqx+tVVFA6jb/Yo5nYZvaPuf221owGGSHcRWgRz3G8AOtO3rVZEV9yuumOqUiLUL4AlNdvN8=

example reproducing python code:

from draftsman.blueprintable import Blueprint
from pathlib import Path


print("loading blueprint...")
target = Path("./demo.blueprint")
blueprint = Blueprint()

blueprint.load_from_string(target.read_text())

print("loaded blueprint!!")
print("sinking blueprint to test round trip safeness")
output = Path("./demo.round-trip.blueprint")
output.write_text(blueprint.to_string())
print("done!!")

output:

loading blueprint...
/home/orion/projects/factorio/blueprint_hacks/main.py:9: DraftsmanWarning: <class 'draftsman.prototypes.inserter.Inserter'> has no attribute 'drop_position'
  blueprint.load_from_string(target.read_text())
/home/orion/projects/factorio/blueprint_hacks/main.py:9: DraftsmanWarning: <class 'draftsman.prototypes.inserter.Inserter'> has no attribute 'pickup_position'
  blueprint.load_from_string(target.read_text())
loaded blueprint!!
sinking blueprint to test round trip safeness
done!!

When such blueprints are exported, the position fields are lost.
Thus, draftsman emits malformed blueprints that would require manual post-processing to fix.

Expected behavior
Draftsman should pass through any fields it isn't aware of, as they may belong to mods draftsman doesn't have specific support for.

Additional context
This issue relates to Bob's adjustable inserters and more generally any AngelBobs derived modpack.

Please also include the following:
factorio-draftsman = "^1.1.1"

$ python3 --version                                                                                                                                                                                                                                                                                                                                                                 [14:43:09]
Python 3.10.12
@theunkn0wn1
Copy link
Author

this applies to both inserters and filter inserters.
and the same issue exists for Furnace too

loading blueprint...
/home/orion/projects/factorio/blueprint_hacks/main.py:9: DraftsmanWarning: <class 'draftsman.prototypes.inserter.Inserter'> has no attribute 'drop_position'
  blueprint.load_from_string(target.read_text())
/home/orion/projects/factorio/blueprint_hacks/main.py:9: DraftsmanWarning: <class 'draftsman.prototypes.inserter.Inserter'> has no attribute 'pickup_position'
  blueprint.load_from_string(target.read_text())
loaded blueprint!!
sinking blueprint to test round trip safeness
done!!

@redruin1
Copy link
Owner

redruin1 commented Aug 4, 2024

Thanks for the report, I forgot about these attributes. I'll patch this into 2.0. You mention that Furnaces also have this issue; what attributes is Draftsman complaining about in that case?

@redruin1 redruin1 added the bug Something isn't working label Aug 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants