Advertisement
Guest User

Craft

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