Skip to content
This repository has been archived by the owner on Jul 1, 2018. It is now read-only.

Tool host

SquidDev edited this page Jan 24, 2017 · 1 revision

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

Tool manipulator

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 to true 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.

Configuration

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 to turtle.dig(). This is about 20 for players.
Clone this wiki locally