This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Inksaver's profile picture

[1.6.3][SSP]Creative mode turtle.place() method

Started by Inksaver, 25 May 2014 - 08:08 AM
Inksaver #1
Posted 25 May 2014 - 10:08 AM
There is a bug in Computercraft 1.6.3 where on odd occasions the turtle.place() method does not place the item immediately in front, but instead 1 block space between the turtle and the item. This video shows this quite clearly, and the turtle then spits out its contents into the air, instead of dropping them into the chest.
[media]
http://www.youtube.com/watch?v=WGoBKZP09LM
[/media]

It is more commonly seen when using buckets to gather lava, and the block of lava being removed by the turtle.place() method is clearly seen. It is mentioned here
in this post

I have done some experimenting, and the error can be replicated very easily
[media]
http://www.youtube.com/watch?v=maIjD98AXUQ
[/media]
Edited on 25 May 2014 - 08:55 AM
apemanzilla #2
Posted 27 May 2014 - 07:58 PM
This had come up a while ago in beta testing, and was supposedly fixed. Not sure what's causing it now…
Bomb Bloke #3
Posted 28 May 2014 - 11:26 PM
The originally reported version of the bug was triggered by water being a block away from the turtle - presumably the turtle tries to place against the side of the water "block", which being a non-solid, meant it "reached through" and placed over it.

It'd also been reported that turtle.detect() was suddenly reporting water as a block, and presumably Dan fixed the first by fixing the latter. Or rather, it sounds like the latter was intentional, but had unintended side effects and so was reverted.

Anyway, it looks like the same thing's happening with those tufts of long grass.
Inksaver #4
Posted 17 July 2014 - 07:00 PM
Here is a workaround function for this problem:


function safePlace(slotNo, direction)
  --[[
  use: safePlace(slot 1 to 16, direction "forward"/"down"/"up")
  eg: safePlace(1, "forward")
  eg: safePlace(16, "down")
  ]]--
  local slotAmount = 0
  local success = false

  slotNo = slotNo or 1
  direction = direction or "forward"

  turtle.select(1)
  -- check if any blocks in the way. Allow for sand and gravel
  if direction = "forward" then
    while turtle.detect() do
	 turtle.dig()
	 sleep(0.5)
    end
  elseif direction = "down" then
    if turtle.detectDown() then
	 turtle.digDown()
    end
  elseif direction = "up" then
    while turtle.detectUp() do
	 turtle.digUp()
	 sleep(0.5)
    end
  end
    
  while turtle.attack() do --in case mob in front
    sleep(1.5)
  end
  while turtle.attackUp()() do --in case mob above
    sleep(1.5)
  end
  while turtle.attackDown() do --in case mob below
    sleep(1.5)
  end

  turtle.select(slotNo)
  slotAmount = turtle.getItemCount(slotNo)
  if direction = "forward" then
    if turtle.place() then
	  --check if block is actually in front until cc 1.6.3 bug is sorted
	  if not turtle.detect() then --placed block not present
	    turtle.forward()
	    if turtle.detect() then
		  -- cc 1.6.3 place() bug, ? block found in front
		  turtle.dig()
	    elseif turtle.detectDown() then
		  -- cc 1.6.3 place() bug, ? block sometimes found on level below
		  -- if turtle is above ground
		  turtle.digDown()
	    end
	    turtle.back()
	    if turtle.place() then
		  success = true
	    end
	  end
    end
  elseif direction = "down" then
    if turtle.placeDown() then
	  --check if block is actually below until cc 1.6.3 bug is sorted
	  if not turtle.detectDown() then --placed block not present
	    turtle.down()
	    if turtle.detectDown() then
		  -- cc 1.6.3 place() bug, ? block found below
		  turtle.digDown()
	    end
	    turtle.up()
	    if turtle.placeDown() then
		 success = true
	    end
	  end
    end
  else -- place up
    if turtle.placeUp() then
	 success = true
    end
  end

  return success
end

Instead of using turtle.place() or turtle. placeDown()
use


safePlace(1, "forward")
safePlace(8, "down")
Edited on 17 July 2014 - 05:17 PM