Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local basex = 0
- local basey = 0
- local odwiertx = 0;
- local odwierty = 0;
- local limitx = 5;
- local limity = 5;
- local dol =0
- local obrot = 0
- local isworking = 0;
- local nazwa = "zolw"
- local aup = 0;
- local tue = 0;
- local ue = 0
- local rotated = 0
- local up = 0
- modem = peripheral.wrap("right")
- function dig()
- local p = 0
- while true do
- local k5,urep = turtle.inspectDown()
- if urep.name == "minecraft:bedrock" then
- print("Koniec kopania")
- break
- end
- turtle.digDown()
- while turtle.down() == false do
- end
- dol = dol +1
- save()
- check()
- p = p + 1;
- save()
- end
- local ukeh = obrot % 4
- while ukeh > 0 do
- turtle.turnRight()
- ukeh = ukeh - 1
- end
- end
- function update(p)
- local StudentNames ={nazwa,p}
- end
- function check()
- local k3,pu = turtle.inspect();
- analyse(pu.name)
- turtle.turnLeft()
- obrot = obrot +1
- local k2, pup = turtle.inspect();
- analyse(pup.name)
- turtle.turnLeft()
- obrot = obrot +1
- local k1 ,pupp = turtle.inspect();
- analyse(pupp.name)
- turtle.turnLeft()
- obrot = obrot +1
- local k ,puppp = turtle.inspect();
- analyse(puppp.name)
- end
- function wynurz()
- local pp = 0
- print(tostring(dol) )
- while dol > 0 do
- while turtle.up() == false do
- turtle.digUp()
- end
- dol = dol - 1;
- save()
- end
- end
- function analyse(px)
- if px == "minecraft:gold_ore" or px == "minecraft:iron_ore" or px == "minecraft:coal_ore" or px == "minecraft:lapis_ore" or px == "minecraft:diamond_ore" or px == "minecraft:redstone_ore" or px == "minecraft:emerald_ore" or px == "ProjRed:Exploration:projectred.exploration.ore" or px == "ThermalFoundation:Ore"or px == "denseores:block0"
- or px == "IC2:blockOreCopper" or px == "IC2:blockOreTin"or px == "IC2:blockOreUran"or px == "IC2:blockOreLead"or px == "TConstruct:SearedBrick" then
- turtle.dig()
- end
- end
- function save()
- local h = fs.open("settings", "w")
- h.writeLine(tostring(limitx))
- h.writeLine(tostring(limity))
- h.writeLine(tostring(basex))
- h.writeLine(tostring(basey))
- h.writeLine(tostring(nazwa))
- h.writeLine(tostring(isworking))
- h.writeLine(tostring(dol))
- h.writeLine(tostring(up))
- h.writeLine(tostring(ue))
- h.writeLine(tostring(aup))
- h.writeLine(tostring(tue))
- h.writeLine(tostring(obrot))
- h.writeLine(tostring(rotated))
- h.close()
- end
- function looaddata()
- local ha = fs.open("settings", "r")
- limitx = tonumber(ha.readLine())
- limity = tonumber(ha.readLine())
- basex = tonumber(ha.readLine())
- basey = tonumber(ha.readLine())
- nazwa = ha.readLine()
- isworking = tonumber(ha.readLine())
- dol = tonumber(ha.readLine())
- up = tonumber(ha.readLine())
- ue = tonumber(ha.readLine())
- aup = tonumber(ha.readLine())
- tue = tonumber(ha.readLine())
- obrot = tonumber(ha.readLine())
- rotated = tonumber(ha.readLine())
- ha.close()
- end
- function ref()
- local jur =0;
- while jur < 25 do
- jur=jur + 1
- turtle.refuel()
- end
- end
- ref()
- if fs.exists("settings") then
- looaddata()
- else
- print("Podaj rozmiar x ")
- limitx = tonumber(read())
- print("Podaj rozmiar y ")
- limity = tonumber(read())
- print("Podaj nazwe zolwia ")
- nazwa = read()
- print("Pomin x ")
- basex = tonumber(read())
- print("Pomin y ")
- basey = tonumber(read())
- end
- function wroc()
- turtle.turnLeft()
- turtle.turnLeft()
- while up > 0 do
- while turtle.forward() == false do
- local poriu = turtle.inspect();
- if poriu then
- turtle.dig()
- end
- end
- up = up -1
- save()
- end
- if ue > 0 then
- if rotated == 0 then
- turtle.turnRight()
- rotated = 1
- save()
- end
- while ue > 0 do
- while turtle.forward() == false do
- local pori = turtle.inspect();
- if pori then
- turtle.dig()
- end
- end
- ue = ue -1
- save()
- end
- turtle.turnLeft()
- end
- local kp = 1
- while kp < 17 do
- turtle.select(kp)
- turtle.drop(64)
- kp = kp +1
- end
- while turtle.up() == false do end
- turtle.select(1)
- turtle.suck(8)
- ref()
- local sum = 200;
- sum = sum + basey * 3 + basex + 1;
- sum = sum + basex * 2 + basey;
- print("Problemy z paliwem !!")
- print("Potrzeba")
- print(tostring(sum))
- print("Paliwa")
- while turtle.getFuelLevel() < sum do
- turtle.select(1)
- turtle.suck(8)
- ref()
- end
- while turtle.down() == false do end
- turtle.turnRight()
- turtle.turnRight()
- if basex ~= limitx then
- basex = basex + 1
- else
- basey = basey + 1
- basex = 0
- end
- end
- function idz()
- while aup > 0 do
- while turtle.forward() == false do
- local pory = turtle.inspect();
- if pory then
- turtle.dig()
- end
- end
- aup = aup -1
- save()
- end
- if rotated == 0 then
- turtle.turnRight()
- rotated = 1
- save()
- end
- while tue > 0 do
- while turtle.forward() == false do
- local por = turtle.inspect();
- if por then
- turtle.dig()
- end
- end
- tue = tue -1
- save()
- end
- turtle.turnLeft()
- end
- while true do
- save()
- if basex == limitx and basey == limity then
- print("Robota skonczona")
- error("koniec")
- end
- if isworking == 0 then
- isworking = 5
- aup = basex * 2 + basey
- tue = basey * 3 + basex +1
- rotated = 0
- save()
- idz()
- dol = 0
- obrot = 0
- isworking = 1
- save()
- dig()
- isworking = 2
- save()
- wynurz()
- up = basex * 2 + basey
- ue = basey * 3 + basex + 1
- isworking = 4;
- rotated = 0
- save()
- wroc()
- isworking = 0;
- elseif isworking == 1 then
- dig()
- isworking = 2
- wynurz()
- up = basex * 2 + basey
- ue = basey * 3 + basex + 1
- isworking = 4;
- rotated = 0
- save()
- wroc()
- isworking = 0;
- elseif isworking == 2 then
- wynurz()
- up = basex * 2 + basey
- ue = basey * 3 + basex + 1
- isworking = 4;
- rotated = 0
- save()
- wroc()
- isworking = 0;
- elseif isworking == 4 then
- wroc()
- elseif isworking == 5 then
- isworking = 5
- save()
- idz()
- dol = 0
- obrot = 0
- isworking = 1
- save()
- dig()
- isworking = 2
- save()
- wynurz()
- up = basex * 2 + basey
- ue = basey * 3 + basex + 1
- isworking = 4;
- rotated = 0
- save()
- wroc()
- isworking = 0;
- end
- isworking = 0;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement