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
Remove all items on transport-belts
Re: Remove all items on transport-belts
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.
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
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
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
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.
You can copy with Ctrl C or Command C, and paste with Ctrl V or Command V.
Re: Remove all items on transport-belts
I copied it and it didnt work......
Re: Remove all items on transport-belts
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
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...