-
Notifications
You must be signed in to change notification settings - Fork 2
Tool host
The tool host allows using arbitrary tools in a turtle. This allows you to call turtle.dig
and turtle.swing
on
modded tools such as Tinkers'.
The turtle will use whatever tool is in the currently selected slot. If that slot is empty it will dig as if punching
with your bare hand. Be warned: unless your tool is very good, the tool host will be slower as it generally requires
multiple calls to turtle.dig
in order to break a block. I recommend using a look to dig until it has broken it:
while turtle.detect() do
turtle.dig()
end
There is also an upgraded version of the tool host, called the tool manipulator. As well as providing turtle.dig
and
turtle.swing
, it can be wrapped as a peripheral to provide swing
and use
methods. This allows emulating arbitrary
left and right clicks.
The tool manipulator provides 4 methods, as well as directional varients (for instance use
, useUp
and useDown
).
-
use([duration:number][, sneak: boolean]):boolean,string...
: Attempt to use the current item for the specified duration (or instantly if none is specified). Set the second parameter totrue
to make the turtle sneak. This returns the whether the item was used, and the action performed if so. -
canUse():boolean
: Guesses whether the current item can be used. -
swing([sneak:boolean]):boolean,string
: Attempt to swing the current item at something. -
canSwing():boolean
Guesses whether the current item has anything to swing at.
All config options live under the Turtle.ToolHost
category.
-
enabled=true
: Whether the tool host is enabled. -
advanced=true
: Whether the tool manipulator is enabled. -
crafting=true
: Whether the tool host can be crafted. -
digFactor=10
: The number of dig points to perform each call toturtle.dig()
. This is about 20 for players.