Advertisement
Marlingaming

Table Manager

Nov 19th, 2022 (edited)
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. local Table = 1
  2. local Drive = peripheral.wrap("")
  3. local MainFrame = peripheral.wrap("")
  4. local Modem = peripheral.wrap("bottom")
  5. local TabMod = peripheral.wrap("top")
  6. local Droper = peripheral.wrap("")
  7.  
  8. local function TableTop(item,state)
  9. if item == "tablet" then
  10. redstone.setOuput("left",state)
  11. elseif item == "container" then
  12. redstone.setOutput("right",state)
  13. end
  14. end
  15.  
  16. local function CustomerTablet()
  17. local Path = Drive.getMountPath()
  18. fs.copy("Menu.txt",fs.combine(Path,"Menu.txt"))
  19. TableTop("tablet",false)
  20. repeat
  21.  
  22. until Drive.isDiskPresent() == true
  23. TableTop("Tablet",true)
  24. fs.copy(fs.combine(Path,"Menu.txt"),"Order.txt")
  25. return true
  26. end
  27.  
  28. local function CallOrder()
  29. local file = fs.open("Order.txt","r")
  30. local Items = textutils.unserialize(file.readAll())
  31. file.close()
  32. Modem.open(122)
  33. Modem.transmit(233,122,textutils.serialize({"Order",Table,Droper}))
  34. for i = 1, #Items do
  35. Modem.transmit(233,122,textutils.serialize(Items[i]))
  36. repeat local a, b, c, d, e = os.pullEvent("modem_message") until e == "completed"
  37.  
  38. end
  39. TableTop("container",false)
  40. end
  41.  
  42. local function ServiceSystem()
  43. Modem.open(455)
  44. repeat local a, b, c, d, e = os.pullEvent("modem_message") until e == Table
  45. TableTop("tablet",true)
  46. TableTop("container",true)
  47. if fs.exists("Order.txt") then fs.delete("Order.txt") end
  48. CustomerTablet()
  49. CallOrder()
  50. end
  51.  
  52.  
  53. while true do
  54. ServiceSystem()
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement