improve follow
This commit is contained in:
@@ -11,10 +11,10 @@ for k,v in pairs(ni) do
|
|||||||
Interface[k] = v
|
Interface[k] = v
|
||||||
end
|
end
|
||||||
|
|
||||||
local function yap(pt)
|
function Interface.yap(spt, dpt)
|
||||||
local x, y, z = pt.x, pt.y + 1, pt.z
|
local x, y, z = dpt.x - spt.x, dpt.y - spt.y, dpt.z - spt.z
|
||||||
local pitch = -math.atan2(y, math.atan2(-(x - .5), z - .5))
|
local pitch = -math.atan2(y, math.sqrt(x * x + z * z))
|
||||||
local yaw = math.deg(math.atan2(-(x - .5), z - .5))
|
local yaw = math.atan2(-x, z)
|
||||||
|
|
||||||
return math.deg(yaw), math.deg(pitch)
|
return math.deg(yaw), math.deg(pitch)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,22 +1,26 @@
|
|||||||
_G.requireInjector(_ENV)
|
|
||||||
|
|
||||||
local GPS = require('gps')
|
local GPS = require('gps')
|
||||||
|
|
||||||
local device = _G.device
|
local device = _G.device
|
||||||
|
|
||||||
if device.neuralInterface and device.wireless_modem then
|
if device.neuralInterface and device.wireless_modem then
|
||||||
device.neuralInterface.goTo = function(x, _, z)
|
local ni = require('neural.interface')
|
||||||
|
device.neuralInterface.goTo = function(x, y, z)
|
||||||
local pt = GPS.locate(2)
|
local pt = GPS.locate(2)
|
||||||
if pt then
|
if pt then
|
||||||
return pcall(function()
|
return pcall(function()
|
||||||
local gpt = {
|
if false and device.neuralInterface.walk then
|
||||||
x = x - pt.x,
|
local gpt = {
|
||||||
y = 0,
|
x = x - pt.x,
|
||||||
z = z - pt.z,
|
y = 0,
|
||||||
}
|
z = z - pt.z,
|
||||||
gpt.x = math.min(math.max(gpt.x, -15), 15)
|
}
|
||||||
gpt.z = math.min(math.max(gpt.z, -15), 15)
|
gpt.x = math.min(math.max(gpt.x, -15), 15)
|
||||||
return device.neuralInterface.walk(gpt.x, gpt.y, gpt.z)
|
gpt.z = math.min(math.max(gpt.z, -15), 15)
|
||||||
|
return device.neuralInterface.walk(gpt.x, gpt.y, gpt.z)
|
||||||
|
else
|
||||||
|
local y, p = ni.yap(pt, { x = x, y = y + 2, z = z })
|
||||||
|
return ni.launch(y, p, 1)
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
return false, 'No GPS'
|
return false, 'No GPS'
|
||||||
|
|||||||
9
neural/disableAI.lua
Normal file
9
neural/disableAI.lua
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
local device = _G.device
|
||||||
|
|
||||||
|
if not device.neuralInterface then
|
||||||
|
error('Missing neural interface')
|
||||||
|
elseif not device.neuralInterface.disableAI then
|
||||||
|
_G.printError('Unable to disable AI')
|
||||||
|
else
|
||||||
|
device.neuralInterface.disableAI()
|
||||||
|
end
|
||||||
9
neural/dropNeural.lua
Normal file
9
neural/dropNeural.lua
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
local device = _G.device
|
||||||
|
|
||||||
|
if not device.neuralInterface then
|
||||||
|
error('Missing neural interface')
|
||||||
|
elseif device.neuralInterface.getEquipment then
|
||||||
|
error('Missing kinetic augment')
|
||||||
|
else
|
||||||
|
device.neuralInterface.getEquipment().drop(6)
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user