Files
opus-apps/neural/neuralSword.lua
2018-11-03 18:14:11 -04:00

28 lines
605 B
Lua

_G.requireInjector(_ENV)
local ni = require('neural.interface')
local Util = require('util')
local os = _G.os
while true do
local target = Util.find(ni.sense(), 'name', 'joebodo')
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