Closed ghost closed 3 years ago
This should be taken care of by the if not next(railloader_chests)
check, which returns from the function early.
Ok, figured it out (with a lot more logging statements). It's not your rail loader, but the blueprinting. When reusing a blueprint (blue "Select new contents" button), the blueprint retrieved from player.blueprint_to_setup
isn't valid_for_read
and the blueprint retrieved via player.cursor_stack
is missing the blueprint entities (bp.get_blueprint_entities()
returns nil
).
This may be a bug in the main game... Will make a post on the forum about it, as this hurts mods like yours that need to either replace entities, or store data in tags.
Problems with "Select new contents" is a known bug with significant impact and no projected fix: https://forums.factorio.com/88100
The on_gui_closed
logic in BRL should work around the bug as long as the blueprint being updated is a character inventory, and not in the blueprint library.
Yea, mk-fg sent me that link last night. I need to learn to not be soo specific in my search terms, otherwise I would've had that one in my search results (I used "reuse" instead of "new contents" in search).
You'd think it'd be trivial to drop the reference into player.blueprint_to_setup
during the event.
The blueprint library throws a wrench into everything. Blueprints living in the library are not real items, so they don't behave correctly when in the cursor, can't have a reference to them passed into events, can't be inspected or modified from a quickbar slot, etc.
Currently, the function
on_blueprint
at the end, always callsset_blueprint_entities()
, even when there are no rail (un)loaders in the blueprint. This will always invalidate the mapping of the blueprint for all other mods after itself being called.A simple flag added would fix this issue
update_bp
flag:Edit: formatting