improve follow
This commit is contained in:
@@ -11,10 +11,10 @@ for k,v in pairs(ni) do
|
||||
Interface[k] = v
|
||||
end
|
||||
|
||||
local function yap(pt)
|
||||
local x, y, z = pt.x, pt.y + 1, pt.z
|
||||
local pitch = -math.atan2(y, math.atan2(-(x - .5), z - .5))
|
||||
local yaw = math.deg(math.atan2(-(x - .5), z - .5))
|
||||
function Interface.yap(spt, dpt)
|
||||
local x, y, z = dpt.x - spt.x, dpt.y - spt.y, dpt.z - spt.z
|
||||
local pitch = -math.atan2(y, math.sqrt(x * x + z * z))
|
||||
local yaw = math.atan2(-x, z)
|
||||
|
||||
return math.deg(yaw), math.deg(pitch)
|
||||
end
|
||||
|
||||
@@ -1,22 +1,26 @@
|
||||
_G.requireInjector(_ENV)
|
||||
|
||||
local GPS = require('gps')
|
||||
|
||||
local device = _G.device
|
||||
|
||||
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)
|
||||
if pt then
|
||||
return pcall(function()
|
||||
local gpt = {
|
||||
x = x - pt.x,
|
||||
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)
|
||||
return device.neuralInterface.walk(gpt.x, gpt.y, gpt.z)
|
||||
if false and device.neuralInterface.walk then
|
||||
local gpt = {
|
||||
x = x - pt.x,
|
||||
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)
|
||||
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
|
||||
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