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

Importing blueprint with assembling machine with productivity modules doesn't work #25

Closed elswindle closed 2 years ago

elswindle commented 2 years ago

During the AssemblingMachine init, RequestItemMixin calls the set_item_request method from AssemblingMachine which tries to access self.recipe before it has been initialized by RecipeMixin. Swapping priority of the initialization of parent classes only has RecipeMixin try to access self.item before RequestItemMixin has initialized it. This only occurs when a productivity module is placed in the assembling machine. Here is a simple blueprint string to try to import that will raise this error.

bp_str = 0eJyVkttugzAMht/F12TiVHXkcq8xTVMAC6yFwJLAhhDvPgfQVKlqu13ZSezPv2MvUOoRB0vGg1yAqt44kK8LOGqM0uHOzwOCBPLYQQRGdeHkvKo+BBmH1qOFNQIyNX6DTNa3CNB48oQ76chQzmFXajKN6FTVkkGRMW/oHYf2JlTidBE/nSKYQbJlaE0Wq/05PrDzuxm7kmvKJNpEuZA62L4eOXLiANGxrwNe5sxgAu0d2N6IBpUVXy2iZtHLjXauZSWHrOA80pX+BxzfBOdX4OwCrPuGnKdKVC06Lyx+jmzva08fa89vlxh4gjSh4K+eqL7fzB8qncKibEslL3Ywggmt21LS5yQ/F+k5T4siK3jYWpU8NQkvv9Hr+gMF6+kn
redruin1 commented 2 years ago

This is a little like the chicken and egg problem; do you have the recipe check the requested items to see if they mismatch first , or do you have the requested items check the recipe for mismatch first? I've changed it so that recipe is set first, and then the requested items are checked against this recipe. This will be in version 0.9.7.

By the way, is there any reason why the requester chests in that blueprint string have a "direction" key? I'm pretty sure setting that is prohibited in LogisticRequestContainer.

elswindle commented 2 years ago

I don't know why it has a direction key. I copied the blueprint string from fbe.teoxoy.com not from Factorio itself. I use it so I don't have to have Factorio running all the time.

redruin1 commented 2 years ago

Noted, hadn't heard of that tool before. I considered writing a bug report, though I'm sure they've got bigger fish to fry. On a related note, I'm working on fixing a number of incorrect Draftsman warnings, such as the overlapping rail entities warnings you were getting with the blueprint in issue #24; if you have any more to add it would be great put them here: #27