View difference between Paste ID: THzBDHzj and PZrvaQJu
SHOW: | | - or go back to the newest paste.
1-
local ms = require("movescript")
1+
local ms = require("movescript")
2-
local robot = require("robot")
2+
local robot = require("robot")
3-
local component = require("component")
3+
local component = require("component")
4-
local sides = require("sides")
4+
local sides = require("sides")
5-
5+
6-
local ic = component.inventory_controller
6+
local ic = component.inventory_controller
7-
7+
8-
local BLOCK = {
8+
local BLOCK = {
9-
  name = "immersiveengineering:metal_decoration1",
9+
  name = "immersiveengineering:metal_decoration1",
10-
  damage = 5
10+
  damage = 5
11-
}
11+
}
12-
local SLAB = {
12+
local SLAB = {
13-
  name = "immersiveengineering:metal_decoration1_slab",
13+
  name = "immersiveengineering:metal_decoration1_slab",
14-
  damage = 5
14+
  damage = 5
15-
}
15+
}
16-
local STAIR = {
16+
local STAIR = {
17-
  name = "immersiveengineering:aluminum_scaffolding_stairs0",
17+
  name = "immersiveengineering:aluminum_scaffolding_stairs0",
18-
  damage = 0
18+
  damage = 0
19-
}
19+
}
20-
local STEEL_FENCE = {
20+
local STEEL_FENCE = {
21-
  name = "immersiveengineering:metal_decoration1",
21+
  name = "immersiveengineering:metal_decoration1",
22-
  damage = 0
22+
  damage = 0
23-
}
23+
}
24-
local ALU_FENCE = {
24+
local ALU_FENCE = {
25-
  name = "immersiveengineering:metal_decoration1",
25+
  name = "immersiveengineering:metal_decoration1",
26-
  damage = 4
26+
  damage = 4
27-
}
27+
}
28-
local AF_CONN = {
28+
local AF_CONN = {
29-
  name = "alternatingflux:connector",
29+
  name = "alternatingflux:connector",
30-
  damage = 0
30+
  damage = 0
31-
}
31+
}
32-
local RS_TORCH = {
32+
local RS_TORCH = {
33-
  name = "minecraft:redstone_torch",
33+
  name = "minecraft:redstone_torch",
34-
  damage = 0
34+
  damage = 0
35-
}
35+
}
36-
36+
37-
local function getItem(item)
37+
local function getItem(item)
38-
  repeat
38+
  repeat
39-
    local success = false
39+
    local success = false
40-
    for i=1, robot.inventorySize() do
40+
    for i=1, robot.inventorySize() do
41-
      local stack = ic.getStackInInternalSlot(i)
41+
      local stack = ic.getStackInInternalSlot(i)
42-
      if stack ~= nil and stack.name == item.name and stack.damage == item.damage then
42+
      if stack ~= nil and stack.name == item.name and stack.damage == item.damage then
43-
        robot.select(i)
43+
        robot.select(i)
44-
        success = true
44+
        success = true
45-
        break
45+
        break
46-
      end
46+
      end
47-
    end
47+
    end
48-
    if not success then
48+
    if not success then
49-
      print("Could not select "..item.name..":"..item.damage..", please add more and press enter.")
49+
      print("Could not select "..item.name..":"..item.damage..", please add more and press enter.")
50-
      io.read()
50+
      io.read()
51-
    end
51+
    end
52-
  until success
52+
  until success
53-
end
53+
end
54-
54+
55-
local function buildStdPost()
55+
local function buildStdPost()
56-
  for i=1, 5 do
56+
  for i=1, 5 do
57-
    getItem(BLOCK)
57+
    getItem(BLOCK)
58-
    ms.exec("UPd")
58+
    ms.exec("UPd")
59-
  end
59+
  end
60-
  getItem(STAIR)
60+
  getItem(STAIR)
61-
  ms.exec("BPUF")
61+
  ms.exec("BPUF")
62-
end
62+
end
63-
63+
64-
local function placeInvertedStair()
64+
local function placeInvertedStair()
65-
  getItem(STAIR)
65+
  getItem(STAIR)
66-
  robot.placeDown(sides.back)
66+
  robot.placeDown(sides.back)
67-
end
67+
end
68-
68+
69-
-- Builds an arm of the pylon, starting from in front of where the aluminum fence would be.
69+
-- Builds an arm of the pylon, starting from in front of where the aluminum fence would be.
70-
-- Ends at where the aluminum fence should be.
70+
-- Ends at where the aluminum fence should be.
71-
local function buildOrthogonalPylonArm()
71+
local function buildOrthogonalPylonArm()
72-
  getItem(SLAB) -- Start by placing the slabs at the end.
72+
  getItem(SLAB) -- Start by placing the slabs at the end.
73-
  ms.exec("U2FPu")
73+
  ms.exec("U2FPu")
74-
  getItem(SLAB)
74+
  getItem(SLAB)
75-
  ms.exec("FPu")
75+
  ms.exec("FPu")
76-
  getItem(STEEL_FENCE)
76+
  getItem(STEEL_FENCE)
77-
  ms.exec("BP")
77+
  ms.exec("BP")
78-
  getItem(BLOCK)
78+
  getItem(BLOCK)
79-
  ms.exec("BP")
79+
  ms.exec("BP")
80-
  getItem(STAIR)
80+
  getItem(STAIR)
81-
  ms.exec("BPD2F")
81+
  ms.exec("BPD2F")
82-
  for i=1, 2 do
82+
  for i=1, 2 do
83-
    getItem(STEEL_FENCE)
83+
    getItem(STEEL_FENCE)
84-
    ms.exec("PB")
84+
    ms.exec("PB")
85-
  end
85+
  end
86-
  getItem(BLOCK)
86+
  getItem(BLOCK)
87-
  ms.exec("PB")
87+
  ms.exec("PB")
88-
  getItem(STAIR)
88+
  getItem(STAIR)
89-
  ms.exec("PD3F")
89+
  ms.exec("PD3F")
90-
  for i=1, 3 do
90+
  for i=1, 3 do
91-
    getItem(AF_CONN)
91+
    getItem(AF_CONN)
92-
    robot.place(sides.up)
92+
    robot.place(sides.up)
93-
    ms.exec("B")
93+
    ms.exec("B")
94-
  end
94+
  end
95-
  ms.exec("F")
95+
  ms.exec("F")
96-
  placeInvertedStair()
96+
  placeInvertedStair()
97-
  getItem(BLOCK)
97+
  getItem(BLOCK)
98-
  ms.exec("BPU")
98+
  ms.exec("BPU")
99-
end
99+
end
100-
100+
101-
-- Builds an orthogonal pylon, starting in front of the near-left post.
101+
-- Builds an orthogonal pylon, starting in front of the near-left post.
102-
local function buildOrthogonalPylon()
102+
local function buildOrthogonalPylon()
103-
  ms.exec("FR") -- Move to the first post's position.
103+
  ms.exec("FR") -- Move to the first post's position.
104-
  buildStdPost()
104+
  buildStdPost()
105-
  ms.exec("L2FR6D")
105+
  ms.exec("L2FR6D")
106-
  buildStdPost()
106+
  buildStdPost()
107-
  ms.exec("4F2R6D")
107+
  ms.exec("4F2R6D")
108-
  buildStdPost()
108+
  buildStdPost()
109-
  ms.exec("L2FR6D")
109+
  ms.exec("L2FR6D")
110-
  buildStdPost()
110+
  buildStdPost()
111-
  ms.exec("FD") -- Place the first upside-down stair.
111+
  ms.exec("FD") -- Place the first upside-down stair.
112-
  placeInvertedStair()
112+
  placeInvertedStair()
113-
  ms.exec("R2FL")
113+
  ms.exec("R2FL")
114-
  placeInvertedStair()
114+
  placeInvertedStair()
115-
  ms.exec("2F2R")
115+
  ms.exec("2F2R")
116-
  placeInvertedStair()
116+
  placeInvertedStair()
117-
  ms.exec("R2FL")
117+
  ms.exec("R2FL")
118-
  placeInvertedStair()
118+
  placeInvertedStair()
119-
  getItem(SLAB) -- Place the slabs on the first segment.
119+
  getItem(SLAB) -- Place the slabs on the first segment.
120-
  ms.exec("FDPu")
120+
  ms.exec("FDPu")
121-
  getItem(SLAB)
121+
  getItem(SLAB)
122-
  ms.exec("L2F2RPu")
122+
  ms.exec("L2F2RPu")
123-
  getItem(SLAB)
123+
  getItem(SLAB)
124-
  ms.exec("FL2F2RPu")
124+
  ms.exec("FL2F2RPu")
125-
  getItem(SLAB)
125+
  getItem(SLAB)
126-
  ms.exec("4F2RPuFURFL")
126+
  ms.exec("4F2RPuFURFL")
127-
  buildStdPost() -- Build the next set of posts.
127+
  buildStdPost() -- Build the next set of posts.
128-
  ms.exec("L2FR6D")
128+
  ms.exec("L2FR6D")
129-
  buildStdPost()
129+
  buildStdPost()
130-
  ms.exec("2F2R6D")
130+
  ms.exec("2F2R6D")
131-
  buildStdPost()
131+
  buildStdPost()
132-
  ms.exec("L2FR6D")
132+
  ms.exec("L2FR6D")
133-
  buildStdPost()
133+
  buildStdPost()
134-
  getItem(SLAB) -- Build the slabs on the second segment.
134+
  getItem(SLAB) -- Build the slabs on the second segment.
135-
  ms.exec("RF2DLPu")
135+
  ms.exec("RF2DLPu")
136-
  getItem(SLAB)
136+
  getItem(SLAB)
137-
  ms.exec("2F2RPuFURF2R")
137+
  ms.exec("2F2RPuFURF2R")
138-
  buildStdPost() -- Build the third set of posts.
138+
  buildStdPost() -- Build the third set of posts.
139-
  ms.exec("2F2R6D")
139+
  ms.exec("2F2R6D")
140-
  buildStdPost()
140+
  buildStdPost()
141-
  ms.exec("FLF") -- Build the pylon arms.
141+
  ms.exec("FLF") -- Build the pylon arms.
142-
  buildOrthogonalPylonArm()
142+
  buildOrthogonalPylonArm()
143-
  ms.exec("2RF")
143+
  ms.exec("2RF")
144-
  buildOrthogonalPylonArm()
144+
  buildOrthogonalPylonArm()
145-
  ms.exec("RD")
145+
  ms.exec("RD")
146-
  for i=1, 2 do
146+
  for i=1, 2 do
147-
    getItem(BLOCK)
147+
    getItem(BLOCK)
148-
    ms.exec("PdU")
148+
    ms.exec("PdU")
149-
  end
149+
  end
150-
  getItem(ALU_FENCE)
150+
  getItem(ALU_FENCE)
151-
  ms.exec("Pd")
151+
  ms.exec("Pd")
152-
  getItem(RS_TORCH)
152+
  getItem(RS_TORCH)
153-
  ms.exec("BP")
153+
  ms.exec("BP")
154-
  -- Return to origin.
154+
  -- Return to origin.
155-
  ms.exec("BL2FR17D")
155+
  ms.exec("BL2FR17D")
156-
end
156+
end
157-
157+
158
buildOrthogonalPylon()