Advertisement
Runnetty

YardMaster

Sep 30th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. --###############YardMaster
  2. --variables;
  3. Lane = {hasTrain=false,ready=false,timer = 5,port=0}
  4.  
  5. function Lane.new(baseClass,hasTrain,ready,timer,port)
  6.     self = {}
  7.     self["hasTrain"]= hasTrain
  8.     self["ready"]= ready
  9.     self["timer"]= timer
  10.     self["port"]=port
  11.     setmetatable(self,{__index=Lane})
  12.     return self
  13. end
  14.  
  15. setmetatable (Lane, {__call=Lane.new})
  16.  
  17. function Lane:print()
  18.     print(self.hasTrain,", ",self.ready,", ",self.timer,", ",self.port)
  19. end
  20.  
  21. local s = Lane(true,true,3,0)
  22. s.print()
  23.  
  24. local timeOnStation = 5
  25. local laneAmount =  3
  26. local timeBetweenTrains = 5
  27.  
  28. local modem = peripheral.wrap("right")
  29. --Open all modem ports;
  30. local lanes = {}
  31. for i = 0,laneAmount do
  32.     modem.open(i)
  33.     lanes[i] = Lane(false,false,i,0)
  34. end
  35.  
  36. local event,port,message = os.pullEvent("modem_message")
  37.  
  38. //peripheral.call("left","write",message)
  39.  
  40. local screen = peripheral.wrap(left)
  41.  
  42. while true do
  43.  screen.clear()
  44.  screen.setCursorPos(1, 1)
  45.  for i = 0,laneAmount do
  46.     screen.write("Lane: ",i,"       ")
  47.  end
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement