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
- }
- position.x, position.y, position.z = ...;
- position.x = tonumber(position.x); position.y = tonumber(position.y);
- position.z = tonumber(position.z);
- start_point.x = position.x; start_point.y = position.y;
- start_point.z = position.z;
- 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()
- --[[ Write code to detect if blocks are around big cheese ]]
- local x = 0;
- while x < 4 do
- local res = turtle.detect();
- if res then
- x = x + 1;
- turtle.turnRight();
- end
- end
- sleep(5);
- if position.y < 22 then
- Redstone_pulse();
- Up();
- sleep(5);
- Wait_for_minions();
- else
- Break_minions();
- 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. ]]
- -- position.y = 100;
- -- This function might be obsolete.
- 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()
- turtle.select(1);
- 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