SMove - fuel and reboot safe movement functions

Started by sugoidogo, Yesterday at 06:59 PM

Previous topic - Next topic

sugoidogo

wget https://gist.githubusercontent.com/sugoidogo/9681cca339263d468a40af31e6c10be6/raw/smove.lua

This library replaces the turtle movement functions to keep track of the turtle's location relative to its starting point, measure if there is enough fuel to return to the starting point, and automatically return the turtle before it becomes stranded. You can write your farming/mining/etc program as if it is always starting from the same point, smove will ensure that it is. Your position relative to your starting position is tracked in the .smove_home file, and if it exists then smove will return to the starting position during initialization.

require('smove')
smove.self_refuel=function() return false end -- assign this function to allow smove to refuel on the go. Return true on success
smove.home_refuel=function() return false end -- assign this function to allow smove to refuel and return to its previous position instead of throwing an error when critical fuel levels are reached. Also must return true on success.
smove.home_on_fail=false -- set this to true to return home if movement fails