redruin1 / factorio-draftsman

A complete, well-tested, and up-to-date module to manipulate Factorio blueprint strings. Compatible with mods.
MIT License
94 stars 17 forks source link

Unhandled "KeyError: 'inserter'" on `Blueprint.flippable` #61

Closed rpdelaney closed 1 year ago

rpdelaney commented 1 year ago
>>> new_bp.to_string()
'0eNp9kMFuwyAQRP9lzxDZTuK4/pWoqmy6clbFgFhsNbL49y5R1fqQ9gSMdt7OsMFoFwyRXIJ+A0o4Q7/TFKwYmbyDvunq0+WlubTtuWu7TgG6RImQob9u4IYZxTkw4zxacpOeB3Mjh7oRSPAso4WywSf09eGs4P44s4KIhkIxR28+MGkm68VTsnAxBNGRuTAXR5KzqSoFxjsTMYmvrsobLZoUyWh0U1m7G+WEaHWww+90eGyUe/7ucX9zyzxiFDGrnzrkGGMS9c8Kx8MTRLNDWD8RJ8llbshJB/khWlFLqZXe/yOfnpGP+TXnL7QYj2Q='

>>> new_bp.flippable
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/gun/.venv/lib/python3.10/site-packages/draftsman/classes/collection.py", line 83, in flippable
    if not entity.flippable:
  File "/tmp/gun/.venv/lib/python3.10/site-packages/draftsman/classes/entity.py", line 520, in flippable
    return entities.flippable[self.name]
KeyError: 'inserter'

>>>
redruin1 commented 1 year ago

Confirmed. Also fails with all the logistic chests. Reason is that I do the hokey pokey to make data.raw categories match draftsman classes, so the code for assigning them a flippable value just never got run. Amending this now.

Is this catastrophic enough for a hotfix or should I just push it onto the next minor release? Flippability is still a work in progress, after all.

redruin1 commented 1 year ago

Fixed. Also added a new test and test category to ensure this doesn't happen again. Will be in the next version, either 1.0.4 or 2.0.0, whichever comes first.

redruin1 commented 1 year ago

Whoops, git was being overzealous.

rpdelaney commented 1 year ago

Not catastrophic at all. :) Thanks!