Advertisement
Guest User

Craft

a guest
Jan 17th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.52 KB | None | 0 0
  1.  
  2.  
  3.  
  4. local r = require("robot")
  5. local component = require("component")
  6. local sides = require("sides")
  7. local crafting = component.crafting
  8. local inventory_controller = component.inventory_controller
  9. local filesys = component.filesystem
  10.  
  11. print("Выберите операцию:")
  12. print("1) Запустить крафт")
  13. print("2) Записать крафт")
  14. print("Введите цифру операции...")
  15. operation = tonumber(io.read())
  16. list = nil
  17.  
  18. if(operation == 1) then
  19.   print("Не реализовано...")
  20. elseif(operation == 2) then
  21.   if(io.open("/home/ListOfCrafts","r") == nil) then
  22.     list = io.open("/home/ListOfCrafts", "w")
  23.   else
  24.     list = io.open("/home/ListOfCrafts", "a")
  25.   end
  26.   confirm = false
  27.   print("Расставьте компоненты по рецепту\n для записи крафта...")
  28.   while(confirm == false) do
  29.     print("Введите ГОТОВО, если разложили все компоненты...")
  30.     if(io.read() == "ГОТОВО") then
  31.       confirm = true
  32.     else
  33.       print("Неверное подтверждение!\n")
  34.     end
  35.   end
  36.   print("Введите название крафта на КИРИЛЛИЦЕ...")
  37.   name = io.read()
  38.   list:write(name)
  39.   list:flush()
  40.   for i = 1, 11,1 do
  41.     if(i == 4 or i == 8) then
  42.       i = i + 1
  43.     end
  44.     r.select(i)
  45.     item = nil
  46.     if(inventory_controller.getStackInInternalSlot() ~= nil) then
  47.       item = inventory_controller.getStackInInternalSlot().label
  48.       print(item)
  49.     else
  50.       item = "none"
  51.     end
  52.   end
  53. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement