Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- GeoMiner by Andronio and Orlin c помощью Fingercomp
- local fs = require("filesystem")
- local cmp = require("component")
- local comp = require("computer")
- local term = require("term")
- local event = require("event")
- local genIsOn = false
- local iscompatlib = false -- поставьте на true, если хотите убрать проверку на доработанную версию библиотеки robot.lua
- local gotnewdrivers = false
- if not iscompatlib then
- io.write('Вы используете апгрейднутую версию либы robot.lua? [y/n] ')
- local z = io.read()
- if z == "N" or z == "n" then
- if cmp.isAvailable('internet') then
- print('Удаляю старую либу...')
- os.execute('rm /lib/robot.lua')
- print('Скачиваю апгрейднутую версию...')
- os.execute('pastebin get vq8nVTRy /lib/robot.lua')
- gotnewdrivers = true
- else
- print('Подключите интернет карту!')
- os.exit()
- end
- end
- if z ~= "Y" and z ~= "y" and z ~= "n" and z ~= "N" then
- print('Введено неверное значение!')
- os.exit()
- end
- end
- if not fs.exists("/lib/rl.lua") then
- print('Отсутствуют библиотека rl.lua!')
- if cmp.isAvailable('internet') then
- print('Начинаю скачивание...')
- os.execute('pastebin get 6Nge8Lji /lib/rl.lua')
- gotnewdrivers = true
- else
- print('Подключите интернет карту!')
- os.exit()
- end
- io.write('Для стабильной работы требуется перезагрузка! Перезагрузить сейчас? [y/n] ')
- local i = io.read()
- if i == "N" or i == "n" then
- print('Перезагрузка отменена!')
- os.sleep(0.5)
- term.clear()
- os.exit()
- end
- if i == "Y" or i == "y" then
- os.execute('reboot')
- end
- if i ~= "Y" and i ~= "y" and i ~= "n" and i ~= "N" then
- print('Перезагрузка отменена!')
- os.sleep(0.5)
- term.clear()
- os.exit()
- end
- end
- if gotnewdrivers then
- io.write('Для стабильной работы требуется перезагрузка! Перезагрузить сейчас? [y/n] ')
- local i = io.read()
- if i == "N" or i == "n" then
- print('Перезагрузка отменена!')
- os.sleep(0.5)
- term.clear()
- os.exit()
- end
- if i == "Y" or i == "y" then
- os.execute('reboot')
- end
- if i ~= "Y" and i ~= "y" and i ~= "n" and i ~= "N" then
- print('Перезагрузка отменена!')
- os.sleep(0.5)
- term.clear()
- os.exit()
- end
- end
- local rl = require("rl")
- local r = require("robot")
- local ic = cmp.inventory_controller
- local gl = cmp.geolyzer
- local wasteList = {
- 'minecraft:cobblestone',
- 'minecraft:sandstone',
- 'minecraft:stone',
- 'minecraft:dirt',
- 'minecraft:grass',
- 'minecraft:sand',
- 'minecraft:end_stone',
- 'minecraft:hardened_clay',
- 'minecraft:mossy_cobblestone',
- 'minecraft:torch',
- 'minecraft:nether_brick',
- 'minecraft:nether_brick_fence',
- 'minecraft:nether_brick_stairs',
- 'minecraft:netherrack',
- 'minecraft:soul_sand',
- 'chisel:diorite',
- 'chisel:andesite',
- 'chisel:marble',
- 'chisel:woolen_clay'
- }
- local fuelList = {
- 'minecraft:planks',
- 'minecraft:coal',
- 'Railcraft:fuel.coke',
- 'minecraft:fence',
- 'minecraft:stick'
- }
- term.clear()
- r.logPath(true)
- local invSize = r.inventorySize()
- function ExtGen()
- if cmp.isAvailable('generator') then
- if cmp.generator.count() == 0 and genIsOn == true then
- genIsOn = false
- end
- if genIsOn == false then
- if (comp.energy()/comp.maxEnergy() < 0.33) then
- local foundFuel = false
- for slot = 1, invSize do
- local stack = ic.getStackInInternalSlot(slot)
- if stack then
- if rl.tblChk(stack.name, fuelList) then
- r.select(slot)
- foundFuel = true
- if cmp.generator.insert(stack.size) then
- rl.report('Заряд упал ниже 33%. Генератор был активирован')
- end
- genIsOn = true
- break
- end
- end
- end
- if not foundFuel then
- r.select(1)
- end
- end
- end
- if comp.energy()/comp.maxEnergy() > 0.5 and genIsOn == true then
- cmp.generator.remove(cmp.generator.count())
- genIsOn = false
- rl.report('Достигнуто 50%. Выключение генератора')
- end
- else
- event.cancel(genTimer)
- end
- end
- function GenOn(bool)
- if bool == true then
- local genTimer = event.timer(5, ExtGen, math.huge)
- else
- print("Генератор выключен!")
- end
- end
- function dropWaste()
- for slt = 1, invSize do
- local stck = ic.getStackInInternalSlot(slt)
- if stck then
- if rl.tblChk(stck.name, wasteList) then
- r.select(slt)
- r.drop()
- end
- end
- end
- r.select(1)
- end
- rl.CL(true)
- GenOn(true)
- while true do
- os.sleep()
- end
Add Comment
Please, Sign In to add comment