mirror of
https://github.com/Wyrrrd/Autofilter.git
synced 2026-07-15 07:51:13 +02:00
Compare commits
3
Commits
v2.0.1
...
b8b9fe494a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8b9fe494a | ||
|
|
63166c92cd | ||
|
|
fa733dc4e3 |
@@ -6,7 +6,7 @@ When you manually place an inserter, it reads the inventory contents, inventory
|
||||
|
||||
### Settings
|
||||
|
||||
There is only one text field to enter configuration into (apart from an enabling checkbox). This can be done on the fly, while ingame. You can add each of the following keywords into the text field, in any order, separated by spaces. They will be processed left to right.
|
||||
There is only one text field to enter configuration into. This can be done on the fly, while ingame. You can add each of the following keywords into the text field, in any order, separated by spaces. They will be processed left to right.
|
||||
|
||||
+ **contents** - Checks for filter candidates in the inventory contents at the inserter's pickup position.
|
||||
+ **filter** - Checks for filter candidates in the inventory's filter settings at the inserter's pickup position.
|
||||
@@ -25,5 +25,5 @@ This mod should work with all modded inserters, but I specifically added compati
|
||||
If you want to contribute by translating this mod, you can view the existing translations on [Crowdin](https://crowdin.com/project/factorio-mods-localization). I'd be happy to add your language and credits to the next release.
|
||||
|
||||
### Credits
|
||||
Thanks to [Friendch](https://mods.factorio.com/user/Friendch) for the french translation.
|
||||
Thanks to [Friendch](https://mods.factorio.com/user/Friendch) for the french translation.
|
||||
Thanks to [Met_en_Bouldry](https://crowdin.com/profile/Met_en_Bouldry) for the ukrainian translation.
|
||||
|
||||
+1
-11
@@ -145,10 +145,6 @@ local function get_items_by_entity_filter(entity)
|
||||
local filter_items = {}
|
||||
for slot = 1,entity.filter_slot_count do
|
||||
if entity.get_filter(slot) then
|
||||
-- Debug message
|
||||
if __DebugAdapter then
|
||||
__DebugAdapter.print("[Autofilter] " .. get_item_name(entity.get_filter(slot)))
|
||||
end
|
||||
filter_items[#filter_items+1] = get_item_name(entity.get_filter(slot))
|
||||
end
|
||||
end
|
||||
@@ -212,16 +208,10 @@ local function on_built_entity(event)
|
||||
-- Read inventory filter at pickup, write to filter
|
||||
if inventory_pickup and inventory_pickup.is_filtered() then
|
||||
items = concatenate_tables(items,get_items_by_inventory_filter(inventory_pickup))
|
||||
if __DebugAdapter then
|
||||
__DebugAdapter.print("[Autofilter] Inventory: " .. table.concat(items,", "))
|
||||
end
|
||||
end
|
||||
-- Read entity filter at pickup, write to filter
|
||||
if pickup[1].filter_slot_count > 0 then
|
||||
items = concatenate_tables(items,get_items_by_entity_filter(pickup[1]))
|
||||
if __DebugAdapter then
|
||||
__DebugAdapter.print("[Autofilter] Entity: " .. table.concat(items,", "))
|
||||
end
|
||||
end
|
||||
elseif step == "belt" then
|
||||
-- Read belt transport lines at pickup, write to filter
|
||||
@@ -263,4 +253,4 @@ end
|
||||
|
||||
--event handling
|
||||
script.on_event({defines.events.on_lua_shortcut, "autofilter"}, toggle_shortcut)
|
||||
script.on_event(defines.events.on_built_entity, on_built_entity,{{filter="type", type = "inserter"}})
|
||||
script.on_event(defines.events.on_built_entity, on_built_entity,{{filter="type", type = "inserter"}})
|
||||
|
||||
Reference in New Issue
Block a user