Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function rednetOpen()
- for _,v in pairs( rs.getSides() ) do
- if peripheral.getType( v ) == "modem" then
- rednet.open( v )
- end
- end
- end
- function clear()
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1, 1)
- end
- function draw()
- print("Turtle Worldeater Server")
- print("")
- print("1 Mining")
- print("")
- print("2 exit")
- end
- function DrawWaiting()
- print("Gebe eine Zahl ein")
- print("")
- print("Verbunden sind insgesammt: "..count-1)
- end
- function receive()
- message = nil
- id, message = rednet.receive()
- if (message == "turtle") or not (message == nil) then
- Arr_ID[count] = id
- count = count + 1
- end
- end
- function commands()
- i = io.read()
- for j = 1, count do
- if not (Arr_ID[j] == nil) then
- rednet.send(tonumber(Arr_ID[j]), i)
- print("ID: "..Arr_ID[j])
- end
- end
- print("Es wurden ", count-1," Nachrichten gesendet!")
- sleep(1)
- end
- function Mining()
- while true do
- clear()
- DrawWaiting()
- parallel.waitForAny(receive, commands)
- print("Pupsen")
- end
- end
- function input()
- local i = io.read()
- if i == "1" then
- Mining()
- return true
- elseif i == "2" then
- return false
- end
- print("Gib was gueltiges ein!")
- sleep(1)
- return true
- end
- function loop()
- while true do
- clear()
- draw()
- if not input() then break end
- end
- clear()
- end
- Arr_ID = {}
- count = 1
- rednetOpen()
- loop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement