Replacement for deployer?

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here

BlackFire

New Member
Jul 29, 2019
344
0
0
Code:
while true do
 
 
  if redstone.getInput("placesidehere") then
    if turtle.place() == false && turtle.detect() == false then
      i = i + 1
      turtle.select(i)
    end
  end
end


make placesidehere which side the redstone signal is coming from

this shooooould work
 

tompy97

New Member
Jul 29, 2019
85
0
0
Code:
while true do


if redstone.getInput("placesidehere") then
if turtle.place() == false && turtle.detect() == false then
i = i + 1
turtle.select(i)
end
end
end

make placesidehere which side the redstone signal is coming from

this shooooould work

This would work, but it is not as efficient as it could be, because the program will loop infintely and eventually throw an error because it doesn't yield.

A better code would be:
while true do
if redstone.getInput("side") then​
if turtle.detectDown() then -- is called if the mining well is beneath the turtle​
turtle.digDown()​
else -- is called if there is nothing beneath the turtle​
turtle.placeDown()​
end​
end​
local event = os.pullEvent("redstone")​
end

This code will halt when it finishes and wait for the redstone signal to change before it runs again, much more CPU friendly.
It will place the mining well beneath it when a redstone signal hits the turtle and it will dig the mining well back up when a second redstone signal hits it.