Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Turtle Side
- --zootsuitman 1/19/16
- local name =os.getComputerLabel()
- local loop =true
- local attack =false
- local direction ="f"
- local currentSlot =1
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- clear()
- term.setCursorPos(1,1)
- print(name .. " OS")
- write("Remote Mode Activated\nWaiting For Connection...")
- rednet.open("right")
- rednet.host(name, name)
- turtle.select(1)
- local id,msg,trash =rednet.receive(name)
- rednet.send(id,turtle.getFuelLevel())
- term.setCursorPos(1,3)
- write("Connection Established\t\t\t")
- if msg == "connect2" then attack =true end
- while loop do
- while true do
- id,msg,trash =rednet.receive(name)
- --write("\n" .. msg)
- --Movement--
- if msg == "f" then turtle.forward() break end
- if msg == "b" then turtle.back() break end
- if msg == "r" then turtle.turnRight() break end
- if msg == "l" then turtle.turnLeft() break end
- if msg == "u" then turtle.up() break end
- if msg == "d" then turtle.down() break end
- --Actions--
- if msg == "m" then
- if attack then
- if direction == "f" then turtle.attack() break end
- if direction == "u" then turtle.attackUp() break end
- if direction == "d" then turtle.attackDown() break end
- else
- if direction == "f" then turtle.dig() break end
- if direction == "u" then turtle.digUp() break end
- if direction == "d" then turtle.digDown() break end
- end
- end
- if msg == "place" then
- if direction == "f" then turtle.place() break end
- if direction == "u" then turtle.placeUp() break end
- if direction == "d" then turtle.placeDown() break end
- end
- if msg == "pickup" then
- if direction == "f" then turtle.suck() break end
- if direction == "u" then turtle.suckUp() break end
- if direction == "d" then turtle.suckDown() break end
- end
- if msg == "fuel" then
- turtle.refuel(1)
- rednet.send(id,turtle.getFuelLevel())
- end
- --Inventory--
- if msg ==1 or msg ==2 or msg ==3 or msg ==4 or msg ==5 or msg ==6 or msg ==7 or msg ==8 or msg ==9 or msg ==10 or msg ==11 or msg ==12 or msg ==13 or msg ==14 or msg ==15 or msg ==16 then
- turtle.select(msg)
- currentSlot =msg
- break
- end
- --Directions--
- if msg =="mf" then direction ="f" break end
- if msg =="md" then direction ="d" break end
- if msg =="mu" then direction ="u" break end
- --Get Inventory--
- if msg =="getInv" then
- local inv ={}
- for i=1,16 do
- turtle.select(i)
- local slot =turtle.getItemDetail()
- if slot == nil then
- slot ={}
- slot.name ="empty:empty"
- slot.damage =60
- slot.count =0
- end
- table.insert(inv, slot)
- end
- local stringInv =textutils.serialize(inv)
- rednet.send(id,stringInv)
- turtle.select(currentSlot)
- end
- --Reset--
- if msg =="reset" then
- os.reboot()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment