Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --CycleBlockBreaker for EEPROM
- --Original OpenOS version by Asior (Asioron)
- --Expanded EEPROM version by Bs()Dd
- --[[Minimum requirements:
- *Robot - 1 tier
- In robot:
- *CPU - 1 tier
- *1x Memory - 1 tier
- *Inventory Upgrade
- *EEPROM with flash this code
- *Mining tool
- *Computer with OpenOS for flashing EEPROM
- Place the chest on top and put blocks there
- Place the chest at the bottom, there will be loot from blocks
- ]]
- r = component.proxy(component.list("robot")())
- c = component.proxy(component.list("inventory_controller")())
- inv = r.inventorySize()
- speaker = false --Set true for using speaker when something is gone wrong
- lowcharge = 0.005 --Set there number maximal working charge in durability() format
- --Needs Inventory Controller
- autocharge = false --Set there number of turns right to charger (for charging tools)
- chargesleep = 15 --Set there number of sleep duration while tool is charging
- function turnNcharge()
- for i = 1, autocharge do
- r.turn(true)
- end
- c.equip()
- r.drop(3, 1)
- local ws = computer.uptime() + chargesleep
- repeat
- computer.pullSignal(ws - computer.uptime())
- until computer.uptime() >= ws
- r.suck(3, 1)
- c.equip()
- for i = 1, autocharge do
- r.turn(false)
- end
- end
- while true do
- local rep = r.suck(1, 64)
- if rep then
- for i = 1, rep do
- while not r.place(3) do
- if speaker then
- computer.beep(1100, 0.5)
- else
- computer.pullSignal(0)
- end
- end
- while not r.swing(3) do
- if speaker then
- computer.beep(1000, 0.5)
- else
- computer.pullSignal(0)
- end
- end
- if r.durability() then
- while r.durability() < lowcharge do
- if autocharge then
- turnNcharge()
- else
- if speaker then
- for i = 1, 10 do
- computer.beep(700, 0.5)
- end
- else
- local ws = computer.uptime() + 5 --Wating 5 sec, then trying to drop blocks again
- repeat
- computer.pullSignal(ws - computer.uptime())
- until computer.uptime() >= ws
- end
- end
- end
- end
- end
- for i = 1, inv do
- if r.count(i) > 0 then
- r.select(i)
- while not r.drop(0, 64) or r.count(i) > 0 do
- if speaker then
- for i = 1, 10 do
- computer.beep(700, 0.5)
- end
- else
- local ws = computer.uptime() + 5 --Wating 5 sec, then trying to drop blocks again
- repeat
- computer.pullSignal(ws - computer.uptime())
- until computer.uptime() >= ws
- end
- end
- end
- end
- else
- if speaker then
- for i = 1, 10 do
- computer.beep(500, 0.5)
- end
- else
- local ws = computer.uptime() + 5 --Wating 5 sec, then trying to get blocks again
- repeat
- computer.pullSignal(ws - computer.uptime())
- until computer.uptime() >= ws
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement