Page 1 of 1
Remove all items on transport-belts
Posted: Thu May 30, 2019 8:49 pm
by RAID_BOMB
Hey i wanted to see all my machines running at once so i asked myself if there is any way to remove all items that exist in my world
any help is appreciated
Re: Remove all items on transport-belts
Posted: Thu May 30, 2019 9:58 pm
by adam_bise
Well, you could create a massive blueprint of your map, right click / remove all entities in the BP except belts, splitters, and undergrounds, then create a deconstruction planner that whitelists all belts, splitters and undergrounds. Then use the decon planner over your whole base, and re-stamp the belt ghosts with the 1st blueprint.
Assuming all areas are within roboport construction radius and you have enough storage for the decon.
I would back up your save before doing such a thing.
Re: Remove all items on transport-belts
Posted: Thu May 30, 2019 10:28 pm
by DaveMcW
Code: Select all
/c
for _, type in pairs{"transport-belt","underground-belt","splitter"} do
for _, belt in pairs(game.player.surface.find_entities_filtered{type=type}) do
for i = 1, belt.get_max_transport_line_index() do
belt.get_transport_line(i).clear()
end
end
end
Re: Remove all items on transport-belts
Posted: Sat Jun 01, 2019 3:50 pm
by RAID_BOMB
i treied the code out and it said: "cannot execture command. Error: LuaEntity doesn't contain key get_may_transport_line_index. stack traceback [string "for _, type in pairs{"transport-belt","under..."]:1: in main chunk"
Re: Remove all items on transport-belts
Posted: Sat Jun 01, 2019 9:20 pm
by DaveMcW
Copy/paste it, don't try to type it manually.
You can copy with Ctrl C or Command C, and paste with Ctrl V or Command V.
Re: Remove all items on transport-belts
Posted: Tue Jun 04, 2019 1:20 pm
by RAID_BOMB
I copied it and it didnt work......
Re: Remove all items on transport-belts
Posted: Tue Jun 04, 2019 2:33 pm
by DaveMcW
Ah, you must be on 0.16 still. This code should work, but it might miss some underground belts.
Code: Select all
for _, type in pairs{"transport-belt","underground-belt","splitter"} do
for _, belt in pairs(game.player.surface.find_entities_filtered{type=type}) do
for i = 1, 2 do
belt.get_transport_line(i).clear()
end
end
end
Re: Remove all items on transport-belts
Posted: Mon Jun 10, 2019 3:46 pm
by RAID_BOMB
Sorry that i posted last time so long ago.... Went out on a camping trip. I tried the code out and it returned no error but didnt do anything at all...