[0.16.16] LuaPlayer::blueprint_to_setup invalid

Bugs that are actually features.
Post Reply
User avatar
Therax
Filter Inserter
Filter Inserter
Posts: 470
Joined: Sun May 21, 2017 6:28 pm
Contact:

[0.16.16] LuaPlayer::blueprint_to_setup invalid

Post by Therax »

When an area is selected with a blank blueprint while holding SHIFT to suppress display of the editing window, during the on_player_setup_blueprint event LuaPlayer::blueprint_to_setup is an invalid ItemStack.

The on_player_configured_blueprint event is also never fired, in sum giving mods no opportunity to adjust the contents of a blueprint created in this way.

Selecting without holding SHIFT works as expected.

Steps to repro:
1) setup script handler:

Code: Select all

/c script.on_event(defines.events.on_player_setup_blueprint, function(e) game.print(serpent.line(game.players[e.player_index].blueprint_to_setup.valid_for_read)) end)
2) Drag-select entities with an empty blueprint while holding SHIFT.
3) Script displays "false", expected "true," with the ItemStack holding the blueprinted entities.
Miniloader — UPS-friendly 1x1 loaders
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground

Rseding91
Factorio Staff
Factorio Staff
Posts: 13175
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.16.16] LuaPlayer::blueprint_to_setup invalid

Post by Rseding91 »

Thanks for the report however that's working as intended. There is no "setup" that happens when you hold shift - holding shift bypasses that system completely (as it's intended to do). In that case the blueprint you want is in the players cursor.
If you want to get ahold of me I'm almost always on Discord.

User avatar
Therax
Filter Inserter
Filter Inserter
Posts: 470
Joined: Sun May 21, 2017 6:28 pm
Contact:

Re: [0.16.16] LuaPlayer::blueprint_to_setup invalid

Post by Therax »

Got it, and confirmed that when holding SHIFT, game.players[event.player_index].cursor_stack.get_blueprint_entities() is accessible.

Perhaps a documentation update is in order? When SHIFT is not held, on_player_setup_blueprint is raised before the blueprint in the cursor is actually setup, but during alt-select it's raised after the cursor's blueprint is setup. It's a little confusing. :)
Miniloader — UPS-friendly 1x1 loaders
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground

Post Reply

Return to “Not a bug”