2020-11-28 03:48:57 +01:00
|
|
|
local fnd=false
|
|
|
|
local cpos={x=0,y=0,z=0}
|
2020-11-30 00:59:10 +01:00
|
|
|
local crange=500
|
2020-11-29 22:51:30 +01:00
|
|
|
local hud_wp=nil
|
|
|
|
local zz={x=0,y=64,z=0}
|
2020-11-30 00:59:10 +01:00
|
|
|
local badnodes={'mcl_tnt:tnt'}
|
|
|
|
local searchheight=250
|
2020-11-29 22:51:30 +01:00
|
|
|
|
|
|
|
local function set_kwp(name,pos)
|
|
|
|
if hud_wp then
|
|
|
|
minetest.localplayer:hud_change(hud_wp, 'world_pos', pos)
|
|
|
|
minetest.localplayer:hud_change(hud_wp, 'name', name)
|
|
|
|
else
|
|
|
|
hud_wp = minetest.localplayer:hud_add({
|
|
|
|
hud_elem_type = 'waypoint',
|
|
|
|
name = name,
|
|
|
|
text = 'm',
|
|
|
|
number = 0x00ff00,
|
|
|
|
world_pos = pos
|
|
|
|
})
|
|
|
|
end
|
|
|
|
end
|
2020-11-30 00:59:10 +01:00
|
|
|
local nextzz=0
|
|
|
|
local function randomzz()
|
|
|
|
if nextzz > os.clock() then return false end
|
|
|
|
math.randomseed(os.time())
|
|
|
|
zz.y=math.random(64,searchheight)
|
|
|
|
nextzz=os.clock()+ 15
|
|
|
|
end
|
2020-11-29 22:51:30 +01:00
|
|
|
|
2020-11-30 00:59:10 +01:00
|
|
|
local function find_bad_things()
|
|
|
|
if fnd then return true end
|
2020-11-29 22:51:30 +01:00
|
|
|
local obs=minetest.localplayer.get_nearby_objects(crange)
|
2020-11-30 00:59:10 +01:00
|
|
|
local lp=minetest.localplayer:get_pos()
|
|
|
|
|
|
|
|
for k, v in ipairs(obs) do -- look for crystals first
|
2020-11-29 22:51:30 +01:00
|
|
|
if ( v:get_item_textures():find("mcl_end_crystal") ) then
|
|
|
|
cpos=v:get_pos()
|
|
|
|
set_kwp(v:get_item_textures(),v:get_pos())
|
|
|
|
fnd=true
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
2020-11-30 00:59:10 +01:00
|
|
|
|
2020-11-29 22:51:30 +01:00
|
|
|
for k, v in ipairs(obs) do
|
|
|
|
if ( v:get_item_textures():find("arrow_box") ) then
|
2020-11-28 03:48:57 +01:00
|
|
|
cpos=v:get_pos()
|
2020-11-29 22:51:30 +01:00
|
|
|
set_kwp(v:get_item_textures(),v:get_pos())
|
2020-11-28 03:48:57 +01:00
|
|
|
fnd=true
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
2020-11-29 22:51:30 +01:00
|
|
|
|
2020-11-30 00:59:10 +01:00
|
|
|
local epos=minetest.find_nodes_in_area(vector.add(lp,{x=79,y=79,z=79}), vector.add(lp,{x=-79,y=-79,z=-79}), badnodes, true)
|
|
|
|
if epos then
|
|
|
|
for k,v in pairs(epos) do for kk,vv in pairs(v) do
|
|
|
|
cpos=vv
|
|
|
|
set_kwp('mcl_tnt:tnt',cpos)
|
|
|
|
fnd=true
|
|
|
|
return true
|
|
|
|
end end
|
|
|
|
end
|
|
|
|
|
|
|
|
set_kwp('nothing found',zz)
|
|
|
|
randomzz()
|
2020-11-29 22:51:30 +01:00
|
|
|
fnd=false
|
2020-11-28 03:48:57 +01:00
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
2020-11-30 00:59:10 +01:00
|
|
|
|
|
|
|
|
|
|
|
local function flythere()
|
|
|
|
minetest.settings:set_bool('noclip',true)
|
|
|
|
minetest.settings:set_bool("pitch_move",true)
|
|
|
|
minetest.settings:set_bool("continuous_forward",true)
|
|
|
|
autofly.aim(cpos)
|
|
|
|
core.set_keypress("special1", true)
|
|
|
|
end
|
|
|
|
|
|
|
|
local function stopflight()
|
|
|
|
minetest.settings:set_bool("continuous_forward",false)
|
|
|
|
minetest.settings:set_bool("noclip",false)
|
|
|
|
minetest.settings:set_bool("pitch_move",false)
|
|
|
|
core.set_keypress("special1", false)
|
|
|
|
minetest.after("0",function()
|
|
|
|
minetest.interact("start_digging")
|
|
|
|
minetest.dig_node(cpos)
|
|
|
|
fnd=false
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
2020-11-28 03:48:57 +01:00
|
|
|
minetest.register_globalstep(function()
|
2020-11-30 01:03:51 +01:00
|
|
|
if not minetest.settings:get_bool("kamikaze") and not minetest.localplayer:get_name():find("kamikaze") then
|
2020-11-30 00:59:10 +01:00
|
|
|
if hud_wp then
|
|
|
|
minetest.localplayer:hud_remove(hud_wp) hud_wp=nil
|
|
|
|
minetest.settings:set_bool("continuous_forward",false)
|
|
|
|
minetest.settings:set_bool("noclip",false)
|
|
|
|
minetest.settings:set_bool("pitch_move",false)
|
|
|
|
core.set_keypress("special1", false)
|
|
|
|
fnd=false
|
|
|
|
end
|
|
|
|
return
|
|
|
|
end
|
2020-11-28 03:48:57 +01:00
|
|
|
|
2020-11-29 22:51:30 +01:00
|
|
|
local lp = minetest.localplayer:get_pos()
|
2020-11-30 00:59:10 +01:00
|
|
|
if not find_bad_things() then
|
2020-11-29 22:51:30 +01:00
|
|
|
if vector.distance(lp,zz) < 1 then
|
2020-11-30 00:59:10 +01:00
|
|
|
stopflight()
|
|
|
|
return
|
2020-11-29 22:51:30 +01:00
|
|
|
else
|
2020-11-30 00:59:10 +01:00
|
|
|
cpos=zz
|
2020-11-29 22:51:30 +01:00
|
|
|
end
|
|
|
|
elseif vector.distance(lp,cpos) < 1 then
|
2020-11-30 00:59:10 +01:00
|
|
|
stopflight()
|
|
|
|
return
|
2020-11-29 22:51:30 +01:00
|
|
|
end
|
2020-11-30 00:59:10 +01:00
|
|
|
flythere()
|
2020-11-28 03:48:57 +01:00
|
|
|
end)
|
|
|
|
|
|
|
|
minetest.register_on_death(function()
|
2020-11-30 01:03:51 +01:00
|
|
|
if not minetest.settings:get_bool("kamikaze") then return end
|
2020-11-28 03:48:57 +01:00
|
|
|
fnd=false
|
|
|
|
end)
|
|
|
|
|
2020-11-30 01:03:51 +01:00
|
|
|
minetest.register_cheat("Kamikaze", "Combat", "kamikaze")
|