diff --git a/fabric_refab.lua b/fabric_refab.lua index 793c07d..f210571 100644 --- a/fabric_refab.lua +++ b/fabric_refab.lua @@ -1,28 +1,24 @@ if event.type == "program" then mem = {} mem.events = {} - mem.orderSize = 5 + mem.orderSize = 20 mem.outputSize = 22 - mem.inputName = "Tacit:ironrefab" - mem.itemName = "default:iron_lump" - mem.orderName = "ironrefab" - + mem.inputName = "Tacit:goldrefab" + mem.itemName = "default:gold_lump" + mem.orderName = "goldrefab" + mem.interruptInterval = 30 + mem.power = "off" mem.outputCount = 0 mem.injectCount = 0 mem.state = "checkchest" - interrupt(1) + interrupt(mem.interruptInterval) end -if event.type == "interrupt" then - -- if port.a == 0 then - -- mem.state = "idle" - -- end - - -- if mem.state == "idle" and mem.outputCount == 0 then - -- interrupt(10) - -- end - port.a = not port.a +if event.type == "interrupt" then + if mem.power ~= "off" or mem.outputCount ~= 0 then + port.b = not port.b + end if mem.state == "checkchest" then digiline_send("chest",{command="get_list"}) @@ -45,7 +41,7 @@ if event.type == "interrupt" then mem.state = "waitoutput" end - interrupt(1) + interrupt(mem.interruptInterval) end if event.type == "digiline" then @@ -59,6 +55,7 @@ if event.type == "digiline" then end if not event.msg.event then + if mem.power == "off" then return end local emptyCount = 0 local stacks = 0 for k,v in pairs(event.msg) do @@ -81,12 +78,14 @@ if event.type == "digiline" then mem.state = "checkchest" end end +end + +if event.type == "off" then + mem.power = "off" + mem.interruptInterval = 10 +end - if event.type == "off" then - mem.state = "idle" - end - - if event.type == "on" then - mem.state = "checkchest" - end +if event.type == "on" then + mem.power = "on" + mem.interruptInterval = 1 end \ No newline at end of file