Advertisement
nofilter

powercontrol

Aug 23rd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. os.loadAPI("ocs/apis/sensor")
  2. local MFSUsensor = sensor.wrap("bottom")
  3. local MFSU = MFSUsensor.getTargetDetails("0,0,1")
  4. local ChestSensor = sensor.wrap("top")
  5. local CHEST = ChestSensor.getTargetDetails("-1,-3,0")
  6. local poweriron = 256
  7. local powergold = 512
  8. local powerdia = 1024
  9. local poweruranium = 1400
  10. local powercopper = 1200
  11.  
  12. local tempamountofiron = 0
  13. local tempamountofgold = 0
  14. local tempamountofdia = 0
  15. local tempamountofuranium = 0
  16. local tempamountofcopper = 0
  17.  
  18. local amountofiron = 0
  19. local amountofgold = 0
  20. local amountofdia = 0
  21. local amountofuranium = 0
  22. local amountofcopper = 0
  23.  
  24. while true do
  25. os.startTimer(1)
  26. os.pullEvent("timer")
  27.  
  28. for i = 1,54 do
  29. tempamountofiron = 0
  30. tempamountofgold = 0
  31. tempamountofdia = 0
  32. tempamountofuranium = 0
  33. tempamountofcopper = 0
  34.  
  35. if CHEST["Slots"][i]["Name"] == "Iron Ore" then
  36. tempamountofiron = tempamountofiron + CHEST["Slots"][i]["Size"]
  37. end
  38.  
  39. if CHEST["Slots"][i]["Name"] == "Gold Ore" then
  40. tempamountofgold = tempamountofgold + CHEST["Slots"][i]["Size"]
  41. end
  42.  
  43. if CHEST["Slots"][i]["Name"] == "Diamond Ore" then
  44. tempamountofdia = tempamountofdia + CHEST["Slots"][i]["Size"]
  45. end
  46.  
  47. if CHEST["Slots"][i]["Name"] == "Uranium Ore" then
  48. tempamountofuranium = tempamountofuranium + CHEST["Slots"][i]["Size"]
  49. end
  50.  
  51. if CHEST["Slots"][i]["Name"] == "Copper Ore" then
  52. tempamountofcopper = tempamountofcopper + CHEST["Slots"][i]["Size"]
  53. end
  54.  
  55. if tempamountofuranium > amountofuranium then
  56. local newamount = tempamountofuranium - amountofuranium
  57. amountofuranium = tempamountofuranium
  58. print("New amount of uranium ="..newamount)
  59.  
  60. end
  61. end
  62. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement