Advertisement
gpochy

craft

Apr 17th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.83 KB | None | 0 0
  1. mon = peripheral.wrap("monitor_0")
  2. me = peripheral.wrap("back")
  3. while true do
  4.  
  5. --meCI = me.getAvailableItems()
  6.  
  7. --local tableID = {"IC2:itemIngot",3,1000,"Refined Iron"}
  8. local tableS = fs.open("crafttab","r")
  9. local tableIDs = tableS.readAll();
  10. tableS.close();
  11. local tableID = textutils.unserialise(tableIDs)
  12. local ic = 25
  13. local im = 35
  14. local icr = 45
  15. mon.clear()
  16. mon.setTextScale(0.5)
  17.  
  18. mon.setTextColor(colors.yellow)
  19. mon.setCursorPos(2,1)
  20. mon.write("Nazev")
  21. mon.setCursorPos(ic,1)
  22. mon.write("Skladem")
  23. mon.setCursorPos(im,1)
  24. mon.write("Minimum")
  25. mon.setCursorPos(icr,1)
  26. mon.write("Vyrobit")
  27. mon.setTextColor(colors.white)
  28.  
  29. for x=1, #tableID do
  30. meCI = me.getAvailableItems()
  31. --print(#tableID) -- pocet itemu k hlidani
  32. print(tableID[x].jmeno)
  33. mon.setCursorPos(2,x+1)
  34. mon.write(tableID[x].jmeno)
  35. --print(tableID[x].itemid)
  36. for k=1, #meCI do
  37.   if (meCI[k].is_craftable == true) then
  38.     item = meCI[k].fingerprint
  39.     --print(item.id)
  40.     if item.id == tableID[x].itemid and item.dmg == tableID[x].itemdmg then
  41.       itemcount = math.floor(meCI[k].size)
  42.       itemmin = math.floor(tableID[x].minsklad)
  43.      
  44.       itemcraft = itemmin - itemcount
  45.       mon.setCursorPos(ic,x+1)
  46.         if itemcraft > 0 then
  47.         mon.write(itemcount)
  48.         mon.setCursorPos(im,x+1)
  49.         mon.write(itemmin)
  50.         mon.setCursorPos(icr,x+1)
  51.         mon.write(math.floor(itemcraft))
  52.           print("Stav itemu je pod minimem")
  53.           print("Bude vyrobeno "..itemcraft.." itemu")
  54.          
  55.           --me.requestCrafting(item,itemcraft,"CPU5")
  56.        
  57.         else
  58.           print("Stav produktu je OK")
  59.           mon.write(itemcount)
  60.           mon.setCursorPos(im,x+1)
  61.           mon.write(itemmin)
  62.         end
  63.         print("------------------------------")
  64.      end
  65.   end
  66. end
  67.  
  68. end
  69. sleep(600)
  70. term.clear()
  71. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement