Files
opus-apps/ignore/neuralSword.lua
kepler155c@gmail.com 0ec0c63ba6 neural cleanup
2019-04-30 23:02:49 -04:00

26 lines
579 B
Lua

local ni = require('neural.interface')
local Util = require('util')
local os = _G.os
while true do
local target = Util.find(ni.sense(), 'name', '///////')
if target then
if math.abs(target.x) < 2 and
math.abs(target.z) < 2 then
ni.lookAt(target)
ni.swing()
os.sleep(.5)
else
local angle = math.atan2(-(target.x - .5), target.z - .5)
ni.walkTo({
x = target.x + 1.5 * math.sin(angle),
y = 0,
z = target.z - 1.5 * math.cos(angle)
}, 1)
end
else
print('no target')
os.sleep(1)
end
end