Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Ustawienia
- odswiez = 40
- slot = 1
- tryb = 1
- -- tryb = 1 -> napelnianie
- -- tryb = 0 -> oproznianie
- -- Start
- if tryb == 1 then
- print("Rozpoczeto Napelnianie Zbiornikow.")
- else
- print("Rozpoczeto Oproznianie Zbiornikow.")
- end
- sleep(1)
- if not turtle.detect() then
- print("Nie wykryto zadnego zbiornika, stawianie zbiornika...")
- turtle.select(slot)
- if turtle.getItemCount(slot) == 0 then
- print("Brak zbiornikow, wylaczanie programu.") return
- end
- turtle.place()
- end
- sleep(1)
- t = peripheral.wrap("front")
- if t==nil then
- print("Nie znaleziono zadnego zbiornika") return
- end
- while true do
- value = 0 max = 0
- ti = t.getTankInfo("front")
- for i,j in pairs(ti) do
- for name,data in pairs(j) do
- if name=="capacity" then max = data
- elseif name=="amount" then teraz = data
- end
- end
- end
- if tryb == 1 then
- if teraz == max then
- print("Zbiornik pelen. Podmienianie zbiornika na pusty...")
- sleep(1)
- turtle.dig()
- if turtle.getItemCount(slot) == 0 then
- print("Brak nowych zbiornikow, wylaczanie programu.") return
- end
- else
- print("Zbiornik: "..math.floor(teraz/max*100).."% ("..teraz.."/"..max..")")
- end
- else
- if teraz == 0 then
- print("Zbiornik pusty. Podmienianie zbiornika na pelny...")
- sleep(1)
- turtle.dig()
- if turtle.getItemCount(slot) == 0 then
- print("Brak kolejnych zbiornikow, wylaczanie programu.") return
- end
- else
- print("Zbiornik: "..math.floor(teraz/max*100).."% ("..teraz.."/"..max..")")
- end
- end
- turtle.select(slot)
- turtle.place()
- sleep(odswiez)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement