Skip to content

A wrapper library for turtles in ComputerCraft. Adds iterative functionality to many vanilla turtle methods, as well as a declarative interface for writing looping turtle instructions.

License

Notifications You must be signed in to change notification settings

w00tyd00d/iturtle-cc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ITurtle: The Iterative Turtle Library

ITurtle is a wrapper library built to add iterative functionality to ComputerCraft turtles in a declarative fashion. Many of the default turtle methods have been given a count parameter to allow repetition of the same instruction, along with the addition of many new quality of life functions to aid in complex turtle program development.

Want to mine out a whole chunk 100 layers down?

local t = require("iturtle")

local function mineLayer()
    t.loopSwap(function()
        t.dig(nil, 16, true)
    end, function()
        t.turnAroundRight(1, true)
    end, 16)
end

local function stageNewLayer()
    t.digDown(nil, 1, true)
    t.turnRight(2)
end

t.loopSwap(mineLayer, stageNewLayer, 100)

Features:

  • A count parameter added to many default turtle methods
  • Extra movement functions pre-coded into the library for convenience, such as turnAroundRight()
  • An easy way to register/manipulate/query your turtle's facing cardinal direction
  • Various methods for looping entire functions
  • And more!

Check out the API documentation to learn more!


Shell interface

New in version 1.1, ITurtle now provides a shell interface to allow for quick modifications on the fly.

If using the datapack, the program name is it, otherwise it's whatever path you saved the pastebin file to (by default is iturtle). Just type the program name into a turtle's shell console and you'll be given a list of available subcommands.

Note: If using the pastebin version, you'll need to run the program once first in order to get autocompleting subcommands.


Installation

You can download this repo as a .zip file and use it as a datapack. If you're unsure how to install datapacks, read the tutorial on the Minecraft wiki.

Alternatively, you can download the source file directly using this command on any turtle in-game.

pastebin get P6wD0Lpf iturtle.lua

Just bear in mind the datapack version gets automatically inserted into every turtle's ROM directory, and therefore doesn't take up memory on their drive.

About

A wrapper library for turtles in ComputerCraft. Adds iterative functionality to many vanilla turtle methods, as well as a declarative interface for writing looping turtle instructions.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages