My API provides a way to return a turtle to a home position without the need of wireless modems or GPS-towers.
Additionally there is an auto-save/auto-load feature for persistence
How to use it (or any custom API):
- Download and save the API on the turtle.
- Load it via os.loadAPI() either in your program or in the Lua prompt.
- Use any of the functions below like you normally would.
Functions:
noGPS.save() - Manually saves the current relative position to file.
noGPS.load() - Manually reads position from the save file.
noGPS.reset() - Resets both the internal memory and the save-data, thus setting the current position as the new home.
noGPS.goHome() - Returns the turtle to its home position by aligning the relative length, width, height and facing coordinates in that order. if possible turtles will break blocks in their path, otherwise they will get stuck until the path is cleared.
noGPS.up()
noGPS.down()
noGPS.forward()
noGPS.back()
noGPS.turnLeft()
noGPS.turnRight()
These will behave just like the vanilla counterparts with the addition of reporting the respective movement to the tracker, this includes return values and responses to lack of fuel.
Compatibility:
In order to use an already made program with this API replace all the movement functions with their modded versions.
Or you could use the new automatic converter:
Spoiler
The converter is a separate program that will translate between noGPS and native movement functions, it will also add or remove an "os.loadAPI" at the top.To use it follow this format:
converter <filename> <direction> <keep>
"filename" needs to be the name of the original file (and the path to it if necessary).
"direction" needs to be "true" when converting to the noGPS-format and "false" when converting a file back to the native format. (without quotes)
"keep" needs to be "true" when the original file should be kept and "false" when it should be overwritten. (without quotes)
Whenever "keep" is enabled, the output will be named "filename-converted" and will appear next to the original file.
A help-text will be displayed when any of the argument mismatch or none are given.
Download:
V1.0: http://pastebin.com/3q7c5zGw no guarantees yet, backup your stuff!
To return home automatically after a restart call goHome() at the top of your startup-script.
Settings:
isMiningTurtle: Defaults to true and determines whether blocks can/should be broken when trying to reach home.
Disclaimer:
All measures have been taken to protect the data from unloading chunks, servers crashing or games being closed suddenly. However, cases may still exist where the coordinates get offset sightly because of such events.
Dowload:
Spoiler
V1.1:http://pastebin.com/qiews8gx (with fuel enabled)
http://pastebin.com/y13d4Rge (with fuel disabled)
V1.0:
http://pastebin.com/nhbfuM3U
Changelog:
Spoiler
V1.1cleanup
now using fuellevels to validate movements (Thanks, Sangar.)
added Temp-files for in-movement-crashes
V1.0
initial release
Please enjoy and leave feedback below. ^_^/>