-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstartup.lua
82 lines (75 loc) · 2.47 KB
/
startup.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
version = "0.0.8"
function wrap()
station = peripheral.find("train_station")
target = peripheral.find("create_target")
monitors = {peripheral.find("monitor")}
end
function terminal()
multiTerm = {}
for funcName,_ in pairs(monitors[1]) do
multiTerm[funcName] = function(...)
for i=1,#monitors-1 do monitors[i][funcName](unpack(arg)) end
return monitors[#monitors][funcName](unpack(arg))
end
end
size = target.getSize()
multiTerm.setTextScale(0.5)
term.redirect(multiTerm)
term.clear()
end
function updater()
--term.setBackgroundColor(colors.pink)
--term.setCursorPos(1,1)
--term.setBackgroundColor(colors.red)
--print("Metro Yazilim Guncellemesi" .. version)
--rednet.open("front")
--local id, message = rednet.receive("metro")
if os.clock() > 3600 then
--else
term.setCursorPos(1,1)
print("Metro Yazilimi Guncelleniyor")
shell.run("rm", "startup")
shell.run("wget", "https://gist.githubusercontent.com/ardyln/e4dcaac12751f050aa281a6d06e14744/raw/startup?" .. os.clock() .. "=" .. os.time(), "startup")
--f = fs.open("startup","w")
--f.writeline(msg)
--f.close()
os.sleep(10)
os.reboot()
end
end
function door()
rs.setBundledOutput("bottom", tonumber(string.match(station.getTrainName(), "%[(%d+)%]" )))
end
function loop()
while true do
term.redirect(multiTerm)
term.clear()
term.setBackgroundColor(colors.black)
if station.getPresentTrain() == true then
--rs.setBundledOutput("bottom", tonumber(string.match(station.getTrainName(), "%[(%d+)%]" )))
if pcall(door) then
door()
term.setBackgroundColor(colors.green)
else
rs.setBundledOutput("bottom", 28150)
term.setBackgroundColor(colors.red)
term.setCursorPos(1,7)
print("HATA: Kapi pozisyonu tespit edilemiyor. Tüm sürgülü kapilar açlacak")
end
else rs.setBundledOutput("bottom", 0)
end
target.setWidth(144)
term.setCursorPos(1,1)
print(station.getStationName() .. " - " .. os.time())
term.setCursorPos(1,3)
--print("1234567890123456789012345678901234567890")
print(target.getLine(1))
term.setCursorPos(1,8)
print(target.getLine(2))
updater()
os.sleep(1)
end
end
wrap()
terminal()
loop()