Skip to content

Commit

Permalink
Made the inserter migration really work for real this time
Browse files Browse the repository at this point in the history
  • Loading branch information
notnotmelon committed Jan 19, 2024
1 parent bf05cdf commit 2bf8bb2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
7 changes: 6 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
---------------------------------------------------------------------------------------------------
Version: 2.1.12
Date: 2024-1-19
Changes:
- Made the inserter migration really work for real this time
---------------------------------------------------------------------------------------------------
Version: 2.1.11
Date: 2024-1-17
Date: 2024-1-19
Changes:
- In order to prep for Factorio 2.0: Removed all filter inserters and filter stack inserters. Gave filter slots to all other inserters. A migration will automatically transform existing filter inserters in your base.
- Add compatibility for Better Victory Screen (stringweasel).
Expand Down
11 changes: 11 additions & 0 deletions migrations/2.1.11.lua → migrations/2.1.12.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
local i = 0
for _, surface in pairs(game.surfaces) do
for _, inserter in pairs(surface.find_entities_filtered{name={'fast-inserter', 'stack-inserter'}}) do
if not (inserter.get_control_behavior()
or next(inserter.circuit_connected_entities.red)
or next(inserter.circuit_connected_entities.green)
or inserter.get_filter(1)
or inserter.logistic_network)
then
inserter.inserter_filter_mode = 'blacklist'
end
end

for _, inserter in pairs(surface.find_entities_filtered{type='inserter',name={'filter-inserter', 'stack-filter-inserter'}}) do
local replacement = surface.create_entity{
name = inserter.name == 'filter-inserter' and 'fast-inserter' or 'stack-inserter',
Expand Down
1 change: 1 addition & 0 deletions scripts/inserters.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Inserters.events.on_built = function(event)
or next(inserter.circuit_connected_entities.red)
or next(inserter.circuit_connected_entities.green)
or inserter.get_filter(1)
or inserter.logistic_network
then return end
inserter.inserter_filter_mode = 'blacklist'
end

0 comments on commit 2bf8bb2

Please sign in to comment.