-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrain.lua
More file actions
51 lines (44 loc) · 1010 Bytes
/
train.lua
File metadata and controls
51 lines (44 loc) · 1010 Bytes
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
stops = {}
stops1 = {}
distances = {}
clrs = {}
stopNum = 1
monitor = peripheral.wrap("bottom")
term.redirect(monitor)
for i = 1,10 do
stops[i] = ""
stops1[i] = ""
distances[i] = 0
clrs[i] = colors.white
end
term.clear()
term.setCursorBlink(false)
term.setTextColor(colors.black)
function addStop(name, line2, distance, color)
stops[stopNum] = name
stops1[stopNum] = line2
distances[stopNum] = distance
clrs[stopNum] = color
stopNum = stopNum + 1
end
function drawStops()
stopNum = stopNum - 1
x, y = term.getSize()
for i = 1, stopNum do
R = i * x/stopNum + 1
L = R - x/stopNum
paintutils.drawFilledBox(L,1,R,y,clrs[i])
term.setCursorPos(L+1,1)
term.write(stops[i])
term.setCursorPos(L+1,2)
term.write(stops1[i])
term.setCursorPos(L+1,5)
term.write(tostring(distances[i]) .. " m")
end
end
addStop("Blaze","Farm",300,colors.orange)
addStop("Peshay","",1000,colors.red)
drawStops()
while true do
os.sleep(600)
end