finish script

This commit is contained in:
sfokin 2025-03-30 04:59:12 +03:00
parent d309587782
commit 4eaaa6b7a2

View File

@ -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 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
if event.type == "off" then
mem.state = "idle"
end
if event.type == "on" then
mem.state = "checkchest"
end
end
if event.type == "off" then
mem.power = "off"
mem.interruptInterval = 10
end
if event.type == "on" then
mem.power = "on"
mem.interruptInterval = 1
end