Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Date: ???
- Fix crash in beacon migration. Resolves https://github.com/pyanodon/pybugreports/issues/1515
- Fixed a crash when blueprinting inserters after another mod has edited the blueprint. Resolves https://github.com/pyanodon/pybugreports/issues/1526
- Fixed missing prototype reference in programmable inserters. Resolves https://github.com/pyanodon/pybugreports/issues/1523
- Fixed that selecting an area for blueprint would destroy wire connections. Resolves https://github.com/pyanodon/pybugreports/issues/1508
- Fixed that updating an inserter's targets would not show the correct selection in the UI
---------------------------------------------------------------------------------------------------
Version: 3.1.2
Date: 2026-07-09
Expand Down
28 changes: 14 additions & 14 deletions scripts/programmable-inserter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,19 @@ local proxy_targets = {
local selection_indices ={
input = {
default = 1,
input = 2,
fuel = 3,
modules = 4
cargo = 2,
input = 3,
fuel = 4,
modules = 5
},
output = {
default = 1,
output = 2,
burnt_result = 3,
modules = 4,
trash = 5,
dump = 6
cargo = 2,
output = 3,
burnt_result = 4,
modules = 5,
trash = 6,
dump = 7
}
}

Expand Down Expand Up @@ -483,6 +485,7 @@ py.on_event(defines.events.on_entity_settings_pasted, function (event)

end)

---@param event EventData.on_player_setup_blueprint
py.on_event(defines.events.on_player_setup_blueprint, function (event)
local blueprint = game.get_player(event.player_index).blueprint_to_setup
-- if normally invalid
Expand All @@ -498,21 +501,18 @@ py.on_event(defines.events.on_player_setup_blueprint, function (event)
if prototypes.entity[entity.name].type == "inserter" then
mapping = mapping or event.mapping.get()
if mapping[index] then
local tags = entity.tags or {}
if mapping[index].type == "entity-ghost" then
tags["py-dynamic-inserter"] = (mapping[index].tags or {})["py-dynamic-inserter"]
blueprint.set_blueprint_entity_tag(index, "py-dynamic-inserter", (mapping[index].tags or {})["py-dynamic-inserter"])
elseif storage.programmable_inserters[mapping[index].unit_number] then
-- we only need to add data if data is in storage
tags["py-dynamic-inserter"] = {
blueprint.set_blueprint_entity_tag(index, "py-dynamic-inserter", {
drop_target_inventory = storage.programmable_inserters[mapping[index].unit_number].drop_target_inventory,
pickup_target_inventory = storage.programmable_inserters[mapping[index].unit_number].pickup_target_inventory
}
})
end
entity.tags = tags
end
end
end
blueprint.set_blueprint_entities(entities)
end)

if script.active_mods["quick-adjustable-inserters"] then
Expand Down
Loading