mirror of
https://github.com/PHIDIAS0303/factorio-mod-PHI.git
synced 2026-06-27 13:56:20 +09:00
.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
local main = {}
|
||||
|
||||
function main.build(event)
|
||||
if event.entity.type ~= 'logistic-container' then
|
||||
return
|
||||
end
|
||||
|
||||
if event.entity.logistic_mode ~= 'storage' then
|
||||
return
|
||||
end
|
||||
|
||||
if not event.entity.has_items_inside() then
|
||||
return
|
||||
end
|
||||
|
||||
local inventory = event.entity.get_inventory(defines.inventory.chest)
|
||||
|
||||
if not inventory then
|
||||
return
|
||||
end
|
||||
|
||||
local contents = inventory.get_contents()
|
||||
|
||||
if not contents or #contents ~= 1 then
|
||||
return
|
||||
end
|
||||
|
||||
event.entity.storage_filter = {name = contents[1].name, quality = contents[1].quality}
|
||||
end
|
||||
|
||||
return main
|
||||
Reference in New Issue
Block a user