finish script
This commit is contained in:
parent
d309587782
commit
4eaaa6b7a2
|
|
@ -1,28 +1,24 @@
|
||||||
if event.type == "program" then
|
if event.type == "program" then
|
||||||
mem = {}
|
mem = {}
|
||||||
mem.events = {}
|
mem.events = {}
|
||||||
mem.orderSize = 5
|
mem.orderSize = 20
|
||||||
mem.outputSize = 22
|
mem.outputSize = 22
|
||||||
mem.inputName = "Tacit:ironrefab"
|
mem.inputName = "Tacit:goldrefab"
|
||||||
mem.itemName = "default:iron_lump"
|
mem.itemName = "default:gold_lump"
|
||||||
mem.orderName = "ironrefab"
|
mem.orderName = "goldrefab"
|
||||||
|
|
||||||
|
|
||||||
|
mem.interruptInterval = 30
|
||||||
|
mem.power = "off"
|
||||||
mem.outputCount = 0
|
mem.outputCount = 0
|
||||||
mem.injectCount = 0
|
mem.injectCount = 0
|
||||||
mem.state = "checkchest"
|
mem.state = "checkchest"
|
||||||
interrupt(1)
|
interrupt(mem.interruptInterval)
|
||||||
end
|
end
|
||||||
|
|
||||||
if event.type == "interrupt" then
|
if event.type == "interrupt" then
|
||||||
-- if port.a == 0 then
|
if mem.power ~= "off" or mem.outputCount ~= 0 then
|
||||||
-- mem.state = "idle"
|
port.b = not port.b
|
||||||
-- end
|
end
|
||||||
|
|
||||||
-- if mem.state == "idle" and mem.outputCount == 0 then
|
|
||||||
-- interrupt(10)
|
|
||||||
-- end
|
|
||||||
port.a = not port.a
|
|
||||||
|
|
||||||
if mem.state == "checkchest" then
|
if mem.state == "checkchest" then
|
||||||
digiline_send("chest",{command="get_list"})
|
digiline_send("chest",{command="get_list"})
|
||||||
|
|
@ -45,7 +41,7 @@ if event.type == "interrupt" then
|
||||||
mem.state = "waitoutput"
|
mem.state = "waitoutput"
|
||||||
end
|
end
|
||||||
|
|
||||||
interrupt(1)
|
interrupt(mem.interruptInterval)
|
||||||
end
|
end
|
||||||
|
|
||||||
if event.type == "digiline" then
|
if event.type == "digiline" then
|
||||||
|
|
@ -59,6 +55,7 @@ if event.type == "digiline" then
|
||||||
end
|
end
|
||||||
|
|
||||||
if not event.msg.event then
|
if not event.msg.event then
|
||||||
|
if mem.power == "off" then return end
|
||||||
local emptyCount = 0
|
local emptyCount = 0
|
||||||
local stacks = 0
|
local stacks = 0
|
||||||
for k,v in pairs(event.msg) do
|
for k,v in pairs(event.msg) do
|
||||||
|
|
@ -81,12 +78,14 @@ if event.type == "digiline" then
|
||||||
mem.state = "checkchest"
|
mem.state = "checkchest"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if event.type == "off" then
|
if event.type == "off" then
|
||||||
mem.state = "idle"
|
mem.power = "off"
|
||||||
|
mem.interruptInterval = 10
|
||||||
end
|
end
|
||||||
|
|
||||||
if event.type == "on" then
|
if event.type == "on" then
|
||||||
mem.state = "checkchest"
|
mem.power = "on"
|
||||||
end
|
mem.interruptInterval = 1
|
||||||
end
|
end
|
||||||
Loading…
Reference in New Issue
Block a user