Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ opencomputers генератор булыжника by serafim http://pastebin.com/YMvuJagz
- !!! ВНИМАНИЕ !!! На сервере не использовать, получиш БАН :)
- снизу робота сундук под булыжник
- в слоты со 2-го по 16 запасные кирки
- требования:
- инвентарь,контроллер инвентаря.
- солнечная панель желательно.
- ]]--
- local term = require("term")
- local com = require('component')
- local fs = require("filesystem")
- local cobble, takt, ext = 0, 0, 0
- if not com.isAvailable("robot") then
- print("только роботы могут использовать эту программу")
- os.exit()
- end
- local r = require("robot")
- if not com.isAvailable("inventory_controller") then
- print("для работы нужен контроллер инвентаря")
- os.exit()
- end
- local i_c = com.inventory_controller
- if not fs.exists("cobblegen") then
- file = io.open("cobblegen","w")
- file:write(cobble)
- file:close()
- end
- local function openfile()
- file = io.open("cobblegen","r")
- ext = file:read()
- file:close()
- end
- local function stop(message)
- print("\n"..message)
- os.exit()
- end
- local function pickaxe()
- if r.durability() == nil then
- local inv_size = r.inventorySize()
- for i = 2, inv_size do
- if r.count(i) == 1 then
- r.select(i)
- i_c.equip()
- r.select(1)
- term.clear()
- print("взял запасную кирку")
- os.sleep(1)
- return false
- else
- if i == inv_size then
- stop("нет кирки :(")
- end
- end
- end
- end
- end
- local function drop()
- if r.count(1) == 32 then
- r.select(1)
- if not r.dropDown(r.count(1)-1) then
- stop("в сундуке нет места :(")
- end
- end
- end
- r.select(1)
- openfile()
- while true do
- pickaxe()
- if r.detect() then
- r.swing()
- cobble = cobble + 1
- takt = takt + 1
- end
- drop()
- term.clear()
- print("за все время нарубил булыжника: "..ext.."\n".."в этот раз нарубил булыжника: "..cobble)
- if takt == 10 then
- takt = ext + 10
- file = io.open("cobblegen","w")
- file:write(takt)
- file:close()
- takt = 0
- openfile()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement