Create ore_sorting.lua

master
Kirigaya Kazuto 2018-06-28 16:22:27 +08:00 committed by GitHub
parent 6042299df0
commit acb7565b23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 0 deletions

26
ore_sorting.lua Normal file
View File

@ -0,0 +1,26 @@
-- Ore sorting
-- Level Up! mod gives mined ore NBT tags.
-- We use Mekanism to process non-NBT ores,
-- and IC2 for NBT ores.
local component=require("component")
local trans=component.proxy(component.list("transposer")()) or
component.proxy(component.list("inventory_controller"))
local sides=require("sides")
while true do
print("Scanning...")
local max=trans.getInventorySize(sides.up)
for i=1,max,1 do
local tb=trans.getStackInSlot(sides.up,i)
if(tb~=nil) then
if(tb.hasTag) then
print("tag " .. tb.size)
trans.transferItem(sides.up,sides.west,tb.size,i)
else
print("no tag " .. tb.size)
trans.transferItem(sides.up,sides.north,tb.size,i)
end
end
end
print("Next loop in 30 seconds...")
os.sleep(30)
end