1
0
mirror of https://github.com/kepler155c/opus synced 2025-10-18 09:17:40 +00:00
This commit is contained in:
kepler155c@gmail.com
2017-09-18 14:46:46 -04:00
parent 36fd5ca073
commit 00fe2c9989
5 changed files with 26 additions and 8 deletions

View File

@@ -34,9 +34,25 @@ function turtle.setGPSHome()
local config = { }
Config.load('gps', config)
if turtle.enableGPS() then
if turtle.point.gps then
config.home = turtle.point
Config.update('gps', config)
turtle.gotoPoint(turtle.point)
else
local pt = GPS.getPoint()
if pt then
local originalHeading = turtle.point.heading
local heading = GPS.getHeading()
if heading then
local turns = (turtle.point.heading - originalHeading) % 4
pt.heading = (heading - turns) % 4
config.home = pt
Config.update('gps', config)
pt = GPS.getPoint()
pt.heading = heading
turtle.setPoint(pt, true)
turtle.gotoPoint(config.home)
end
end
end
end

View File

@@ -222,7 +222,7 @@ function turtle.placeDown(slot) return _place(actions.down, slot) end
local function _drop(action, qtyOrName, qty)
if not qtyOrName or type(qtyOrName) == 'number' then
return action.drop(qtyOrName)
return action.drop(qtyOrName or 64)
end
return inventoryAction(action.drop, qtyOrName, qty)
end