-
Notifications
You must be signed in to change notification settings - Fork 0
/
chainlink-fence.lua
85 lines (77 loc) · 2.74 KB
/
chainlink-fence.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
if (event.type == "program") then
mem.producing = false
elseif (event.type == "digiline" and event.msg == "production") then
mem.producing = true
elseif (event.type == "digiline" and event.msg == "idle") then
mem.producing = false
elseif (event.type == "on" and mem.producing == false) then
mem.producing = true
digiline_send("broadcast", "production")
digiline_send("LCD", "chainlink fence")
digiline_send("plastic_sheet", {
slotseq = "rotation",
exmatch = true,
name = "basic_materials:plastic_sheet",
count = 28
})
interrupt(10, "step2")
elseif (event.type == "interrupt" and event.iid == "step2") then
digiline_send("AC1", "off")
digiline_send("AC1", {
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" },
{ "e", "basic_materials:plastic_sheet", "e" },
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }
})
digiline_send("AC1", "on")
interrupt(10, "step3")
elseif (event.type == "interrupt" and event.iid == "step3") then
digiline_send("iron_ingot", {
slotseq = "rotation",
exmatch = true,
name = "default:steel_ingot",
count = 6
})
digiline_send("feedback1", {
slotseq = "priority",
exmatch = true
})
interrupt(12, "step4")
elseif (event.type == "interrupt" and event.iid == "step4") then
digiline_send("AC1", "off")
digiline_send("AC1", {
{ "default:steel_ingot", "basic_materials:empty_spool", "e" },
{ "basic_materials:empty_spool", "e", "e" },
{ "e", "e", "e" }
})
digiline_send("AC1", "on")
interrupt(12, "step5")
elseif (event.type == "interrupt" and event.iid == "step5") then
digiline_send("iron_ingot", {
slotseq = "rotation",
exmatch = true,
name = "default:steel_ingot",
count = 15
})
digiline_send("feedback1", {
slotseq = "priority",
exmatch = true
})
interrupt(12, "step6")
elseif (event.type == "interrupt" and event.iid == "step6") then
digiline_send("AC1", "off")
digiline_send("AC1", {
{ "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" },
{ "basic_materials:steel_wire", "basic_materials:steel_wire", "default:steel_ingot" },
{ "basic_materials:steel_wire", "basic_materials:steel_wire", "default:steel_ingot" }
})
digiline_send("AC1", "on")
interrupt(10, "step7")
elseif (event.type == "interrupt" and event.iid == "step7") then
digiline_send("final1", {
slotseq = "priority",
exmatch = true
})
digiline_send("broadcast", "idle")
digiline_send("LCD", "idle")
mem.producing = false
end