Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local position = {
- x = 0, y = 0, z = 0
- }
- local start_point = {
- x = 0, y = 0, z = 0
- }
- function Deploy_minions()
- clear();
- for i=1,4,1 do
- turtle.select(i);
- turtle.place();
- turtle.turnRight();
- end
- end
- function Excavate()
- local a = peripheral.wrap('front');
- local b = peripheral.wrap('left');
- local c = peripheral.wrap('back');
- local d = peripheral.wrap('right');
- a.turnOn(); b.turnOn(); c.turnOn(); d.turnOn();
- end
- function clear()
- for i=1,4,1 do
- turtle.dig();
- turtle.turnRight();
- end
- end
- function Wait_for_minions()
- while true do
- if turtle.inspect() then
- turtle.turnRight();
- if turtle.inspect() then
- turtle.turnRight();
- if turtle.inspect() then
- turtle.turnRight();
- if turtle.inspect() then
- turtle.turnRight();
- break;
- end
- end
- end
- end
- end
- if position.y < 22 then
- Redstone_pulse();
- Up();
- else
- Break_minions();
- Ascend();
- end
- end
- function Break_minions()
- for i=1, 4, 1 do
- turtle.dig();
- turtle.turnRight();
- end
- Ascend();
- end
- function Descend()
- while position.y > 8 do
- Down();
- end
- end
- function Ascend()
- while position.y < start_point.y do
- Up();
- end
- end
- function Populate_position()
- --[[ Terrible code. ]]
- for i,v in ipairs(arg) do
- if (i == 1) then
- start_point.x = v;
- position.x = v;
- end
- if (i == 2) then
- start_point.y = v;
- position.y = v;
- end
- if (i == 3) then
- start_point.z = v;
- position.z = v;
- end
- end
- end
- function Down()
- if turtle.detectDown() then
- turtle.digDown();
- end
- turtle.down();
- position.y = position.y - 1;
- end
- function Up()
- if turtle.detectUp() then
- turtle.digUp()
- end
- turtle.up()
- position.y = position.y + 1;
- end
- function Forward()
- if turtle.detect() then
- turtle.dig();
- end
- turtle.forward()
- end
- function Redstone_pulse()
- redstone.setOutput('front', true);
- redstone.setOutput('back', true);
- redstone.setOutput('left', true);
- redstone.setOutput('right', true);
- sleep(0.5);
- redstone.setOutput('front', false);
- redstone.setOutput('back', false);
- redstone.setOutput('left', false);
- redstone.setOutput('right', false);
- end
- print(start_point);
- print(position.hi);
- local lowest_level = 8;
- local highest_level = 22;
- --[[ turtle.refuel();
- turtle.select() ]]
- function Init()
- Populate_position();
- Descend()
- Deploy_minions();
- Excavate();
- Redstone_pulse();
- sleep(8);
- Wait_for_minions();
- end
- Init();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement