autoaim: add basic autoaim

This commit is contained in:
cron 2020-10-09 21:23:17 +00:00
parent e2a4b41334
commit 46bd009798
2 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,18 @@
local function look_nearest()
for k, v in ipairs(minetest.localplayer.get_nearby_objects(10)) do
if (v:is_player() and v:get_name() ~= minetest.localplayer:get_name()) then
local pos = v:get_pos()
pos.y = pos.y - 1
autofly.aim(pos)
return
end
end
end
minetest.register_globalstep(function()
if minetest.settings:get_bool("autoaim") then
look_nearest()
end
end)
minetest.register_cheat("Autoaim", "Combat", "autoaim")

View File

@ -28,3 +28,4 @@ load_mod_quotebot = true
load_mod_autosneak = true
load_mod_list = true
load_mod_supernotes = true
load_mod_autoaim = true