Skip to content

Commit cc384ea

Browse files
committed
fix: Cull misplaced limbo containers (#1)
1 parent 48b4246 commit cc384ea

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

migrations/limbo-cull.lua

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
-- Cull limbo chests that were created due to a bug in inventory-selector <=1.0.0
2+
-- See: https://github.com/noodlebox/factorio-inventory-selector/issues/1
3+
4+
local limbo = require("script.limbo")
5+
6+
-- First, reassign any proxies to properly placed limbo containers, if necessary
7+
for _, selector in pairs(storage.selectors) do
8+
local proxy = selector.proxy
9+
if proxy and proxy.valid then
10+
local target = proxy.proxy_target_entity
11+
if target and target.valid and target.name == "inventory-selector-limbo" then
12+
proxy.proxy_target_entity = limbo[proxy.surface_index]
13+
end
14+
end
15+
end
16+
17+
-- Then, remove the misplaced limbo containers
18+
for _, surface in pairs(game.surfaces) do
19+
for _, entity in pairs(surface.find_entities_filtered{ name="inventory-selector-limbo", position={0.5,0.5} }) do
20+
entity.destroy()
21+
end
22+
end

0 commit comments

Comments
 (0)