Fast Filter Fill

by zowie

Quickly duplicate filter settings in Cargo Wagons and other filterable containers

Utilities
6 years ago
0.14 - 0.16
18

g Error on opening other UIs

6 years ago

It crashes your game to the main menu if you open any UI that doesn't have an inventory (like bob's inserter ui for instance). That is because there are more things that might be returned from LuaControl.opened. You can fix it by replacing the canFilter and canRequest methods (lines 52-58 in control.lua) with the following:

function canFilter(obj)
return hasInventory(obj) and obj.get_output_inventory() ~= nil and obj.get_output_inventory().supports_filters()
end

function canRequest(obj)
return hasInventory(obj) and obj.request_slot_count > 0
end

function hasInventory(obj)
return tostring(getmetatable(obj)) == 'LuaEntity'
end

6 years ago

Actually, hasInventory is wrong in that code. It should be :

function hasInventory(obj)
return pcall(function () local temp = obj.get_output_inventory() end)
end

There is probably a better way to do it, but I'm not that fluent in lua.

6 years ago

This has been fixed in 0.6.6

New response