add obsidian maker

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

80
fabric_obsidian_maker.lua Normal file
View File

@ -0,0 +1,80 @@
if event.type == "program" then
mem = {}
mem.state = "checkchest"
mem.power = "off"
mem.injectCount = 0
mem.orderSize = 1
end
if event.type == "item" then
if event.item.name == "bucket:bucket_empty" then
mem.state = "checkchest"
return "green"
else
return "blue"
end
end
if event.type == "interrupt" then
if mem.state == "checkchest" then
digiline_send("uranchest",{command="sort"})
digiline_send("chest",{command="get_list"})
end
if mem.state == "inject" then
digiline_send("obsidianinjector", {name="bucket:bucket_empty", count = 1, tags="bucket:bucket_empty"})
digiline_send("stoneinjector", {name="moreblocks:cobble_compressed", count = 10, tags="moreblocks:cobble_compressed"})
mem.state = "waitoutput"
end
if mem.state == "ordering" then
local order = {
name="obsidianmaker",
destination="Tacit:obsidianmaker",
item="moreblocks:cobble_compressed",
stacksize=90,
count=mem.orderSize,
}
digiline_send("drawercontroller", order)
mem.state = "waitorder"
end
interrupt(5)
end
if event.type == "digiline" then
if event.channel == "chest" then
if event.msg.event and event.msg.event == "inject" then
mem.injectCount = mem.injectCount + 1
if mem.injectCount == mem.orderSize then
mem.injectCount = 0
mem.state = "inject"
end
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
if v == "" then emptyCount = emptyCount + 1 end
if v ~= "" then stacks = stacks + 1 end
end
if stacks == 0 then
mem.state = "ordering"
else
mem.state = "inject"
end
end
end
end
if event.type == "on" then
mem.power = "on"
mem.state = "checkchest"
interrupt(1)
end
if event.type == "off" then
mem.power = "off"
end