2021-05-11 12:02:19 +02:00
|
|
|
kamikaze={}
|
|
|
|
kamikaze.active=false
|
2020-11-28 03:48:57 +01:00
|
|
|
local fnd=false
|
2021-02-15 23:41:56 +01:00
|
|
|
local cpos=vector.new(0,0,0)
|
2020-11-29 22:51:30 +01:00
|
|
|
local hud_wp=nil
|
2021-02-15 23:41:56 +01:00
|
|
|
local zz=vector.new(42,42,42)
|
|
|
|
local badnodes={'mcl_tnt:tnt','mcl_fire:basic_flame','mcl_fire:fire','mcl_banners:hanging_banner','mcl_banners:standing_banner','mcl_fire:fire_charge','mcl_sponges:sponge','mcl_sponges:sponge_wet','mcl_nether:soul_sand','mcl_heads:wither_skeleton'}
|
|
|
|
local badobs={'mcl_end_crystal','arrow_box','mobs_mc_wither.png'}
|
|
|
|
local searchtxt=nil
|
2020-12-05 23:29:42 +01:00
|
|
|
local searchheight=64
|
2021-02-15 23:41:56 +01:00
|
|
|
local tob=nil
|
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())
|
2021-02-15 23:41:56 +01:00
|
|
|
zz.x=math.random(-128,129)
|
|
|
|
zz.y=math.random(0,searchheight)
|
2020-12-05 23:29:42 +01:00
|
|
|
zz.z=math.random(-128,128)
|
2021-02-15 23:41:56 +01:00
|
|
|
nextzz=os.clock()+ 30
|
2020-11-30 00:59:10 +01:00
|
|
|
end
|
2021-02-15 23:41:56 +01:00
|
|
|
local function find_ob(txts)
|
|
|
|
local odst=500
|
|
|
|
local rt=nil
|
|
|
|
local obs=minetest.localplayer.get_nearby_objects(500)
|
2020-11-29 22:51:30 +01:00
|
|
|
for k, v in ipairs(obs) do
|
2021-02-15 23:41:56 +01:00
|
|
|
for kk,txt in pairs(txts) do
|
|
|
|
if ( v:get_item_textures():find(txt) ) then
|
2021-02-13 04:00:34 +01:00
|
|
|
local npos=v:get_pos()
|
|
|
|
local dst=vector.distance(npos,minetest.localplayer:get_pos())
|
2021-02-15 23:41:56 +01:00
|
|
|
if odst > dst then
|
|
|
|
searchtxt=v:get_item_textures()
|
|
|
|
cpos=npos
|
|
|
|
set_kwp(searchtxt,v:get_pos())
|
|
|
|
odst=dst
|
2021-02-13 04:00:34 +01:00
|
|
|
fnd=true
|
2021-02-15 23:41:56 +01:00
|
|
|
tob=v
|
|
|
|
rt=v
|
2021-02-13 04:00:34 +01:00
|
|
|
end
|
2021-02-15 23:41:56 +01:00
|
|
|
end
|
2020-11-28 03:48:57 +01:00
|
|
|
end
|
|
|
|
end
|
2021-02-15 23:41:56 +01:00
|
|
|
return rt
|
|
|
|
end
|
2021-05-11 12:02:19 +02:00
|
|
|
|
2021-02-15 23:41:56 +01:00
|
|
|
local function find_nd(names)
|
|
|
|
local lp=minetest.localplayer:get_pos()
|
|
|
|
local epos=minetest.find_nodes_near(lp,60,names,true)
|
|
|
|
local rt=nil
|
|
|
|
local odst=500
|
2020-11-30 00:59:10 +01:00
|
|
|
if epos then
|
2021-02-15 23:41:56 +01:00
|
|
|
for k,v in pairs(epos) do
|
|
|
|
local node=minetest.get_node_or_nil(v)
|
2021-02-13 04:00:34 +01:00
|
|
|
local lp=minetest.localplayer:get_pos()
|
2021-02-15 23:41:56 +01:00
|
|
|
local dst=vector.distance(lp,v)
|
|
|
|
if odst > dst then
|
|
|
|
odst=dst
|
|
|
|
cpos=vv
|
|
|
|
rt=vv
|
|
|
|
fnd=true
|
|
|
|
end
|
|
|
|
end
|
2020-11-30 00:59:10 +01:00
|
|
|
end
|
2021-02-15 23:41:56 +01:00
|
|
|
return rt
|
|
|
|
end
|
2020-11-30 00:59:10 +01:00
|
|
|
|
2021-02-15 23:41:56 +01:00
|
|
|
|
|
|
|
local function find_bad_things()
|
|
|
|
if fnd then return true end
|
|
|
|
local lp=minetest.localplayer:get_pos()
|
|
|
|
local ob=find_ob(badobs)
|
|
|
|
if not ob then ob=find_nd(badnodes) end
|
|
|
|
if not ob then
|
|
|
|
set_kwp('nothing found',zz)
|
|
|
|
randomzz()
|
|
|
|
fnd=false
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
return true
|
2020-11-28 03:48:57 +01:00
|
|
|
end
|
|
|
|
|
2020-11-30 00:59:10 +01:00
|
|
|
|
|
|
|
|
|
|
|
local function flythere()
|
2021-02-15 23:41:56 +01:00
|
|
|
if not minetest.localplayer then return end
|
|
|
|
if not cpos then return end
|
|
|
|
ws.aim(cpos)
|
2021-05-11 12:02:19 +02:00
|
|
|
minetest.settings:set_bool("killaura",false)
|
2021-02-15 23:41:56 +01:00
|
|
|
if incremental_tp.tpactive then return end
|
|
|
|
local lp=minetest.localplayer:get_pos()
|
|
|
|
local dst=vector.distance(lp,cpos)
|
|
|
|
if tob and tob:get_item_textures() == searchtxt then
|
|
|
|
dst=vector.distance(lp,tob:get_pos())
|
|
|
|
cpos=tob:get_pos()
|
|
|
|
set_kwp(searchtxt,cpos)
|
|
|
|
end
|
2020-11-30 00:59:10 +01:00
|
|
|
minetest.settings:set_bool("continuous_forward",true)
|
|
|
|
end
|
|
|
|
|
2021-05-11 12:02:19 +02:00
|
|
|
|
2020-11-30 00:59:10 +01:00
|
|
|
local function stopflight()
|
2021-02-15 23:41:56 +01:00
|
|
|
local lp = minetest.localplayer:get_pos()
|
|
|
|
local dst=vector.distance(lp,cpos)
|
2021-02-13 04:00:34 +01:00
|
|
|
minetest.settings:set_bool("continuous_forward",false)
|
2021-02-15 23:41:56 +01:00
|
|
|
if tob and tob:get_item_textures():find(searchtxt) then
|
2021-05-11 12:02:19 +02:00
|
|
|
if searchtxt == 'mcl_end_crystal.png' then
|
|
|
|
minetest.dig_node(cpos)
|
|
|
|
tob:punch()
|
|
|
|
minetest.interact('start_digging')
|
2021-02-15 23:41:56 +01:00
|
|
|
searchtxt=""
|
2021-05-11 12:02:19 +02:00
|
|
|
tob=nil
|
|
|
|
else
|
|
|
|
minetest.settings:set_bool("killaura",true)
|
2021-02-15 23:41:56 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
fnd=false
|
|
|
|
tob=nil
|
2020-11-30 00:59:10 +01:00
|
|
|
end
|
|
|
|
|
2021-02-13 04:00:34 +01:00
|
|
|
|
2020-11-28 03:48:57 +01:00
|
|
|
|
2021-02-13 04:00:34 +01:00
|
|
|
ws.rg('Kamikaze','Bots','kamikaze', function()
|
2020-11-29 22:51:30 +01:00
|
|
|
local lp = minetest.localplayer:get_pos()
|
2021-02-15 23:41:56 +01:00
|
|
|
local dst=vector.distance(lp,cpos)
|
2021-05-11 12:02:19 +02:00
|
|
|
|
2020-11-30 00:59:10 +01:00
|
|
|
if not find_bad_things() then
|
2021-05-11 12:02:19 +02:00
|
|
|
if vector.distance(lp,zz) < 1 then
|
2020-11-30 00:59:10 +01:00
|
|
|
stopflight()
|
2020-11-29 22:51:30 +01:00
|
|
|
else
|
2020-11-30 00:59:10 +01:00
|
|
|
cpos=zz
|
2021-05-11 12:02:19 +02:00
|
|
|
flythere()
|
2020-11-29 22:51:30 +01:00
|
|
|
end
|
2021-05-11 12:02:19 +02:00
|
|
|
elseif dst < 1 then
|
2020-11-30 00:59:10 +01:00
|
|
|
stopflight()
|
2021-02-15 23:41:56 +01:00
|
|
|
else
|
2021-05-11 12:02:19 +02:00
|
|
|
flythere()
|
2020-11-29 22:51:30 +01:00
|
|
|
end
|
2021-05-11 12:02:19 +02:00
|
|
|
|
|
|
|
-- ws.dignodes(minetest.find_nodes_near(minetest.localplayer:get_pos(),5,badnodes,true))
|
2021-02-15 23:41:56 +01:00
|
|
|
if cpos then
|
2021-05-11 12:02:19 +02:00
|
|
|
minetest.dig_node(cpos)
|
|
|
|
--minetest.interact('start_digging')
|
|
|
|
|
2021-02-15 23:41:56 +01:00
|
|
|
end
|
2021-02-13 04:00:34 +01:00
|
|
|
|
|
|
|
end,function()
|
|
|
|
core.set_keypress("special1", true)
|
2021-05-11 12:02:19 +02:00
|
|
|
kamikaze.active=true
|
2021-02-13 04:00:34 +01:00
|
|
|
end, function()
|
2021-05-11 12:02:19 +02:00
|
|
|
kamikaze.active=false
|
2021-02-13 04:00:34 +01:00
|
|
|
core.set_keypress("special1", false)
|
|
|
|
fnd=false
|
|
|
|
if hud_wp then
|
|
|
|
minetest.localplayer:hud_remove(hud_wp)
|
2021-02-13 04:07:50 +01:00
|
|
|
hud_wp=nil
|
2021-02-13 04:00:34 +01:00
|
|
|
end
|
2021-05-11 12:02:19 +02:00
|
|
|
end,{"noclip","pitch_move","dighead","digbadnodes"})
|
2021-02-13 04:00:34 +01:00
|
|
|
|
|
|
|
|
2020-11-28 03:48:57 +01:00
|
|
|
|
|
|
|
minetest.register_on_death(function()
|
2020-11-30 01:03:51 +01:00
|
|
|
if not minetest.settings:get_bool("kamikaze") then return end
|
2021-02-15 23:41:56 +01:00
|
|
|
tob=nil
|
|
|
|
-- incremental_tp.tpactive=false
|
2021-02-13 04:00:34 +01:00
|
|
|
minetest.after("5.0",function()
|
|
|
|
fnd=false
|
|
|
|
end)
|
2020-11-28 03:48:57 +01:00
|
|
|
end)
|
2021-02-13 04:07:50 +01:00
|
|
|
|
|
|
|
ws.on_connect(function()
|
2021-05-11 12:02:19 +02:00
|
|
|
minetest.settings:set_bool("kamikaze",false)
|
|
|
|
--if minetest.localplayer and minetest.localplayer:get_name():find("kamikaze") then
|
|
|
|
-- minetest.settings:set_bool("kamikaze",true)
|
|
|
|
--else minetest.settings:set_bool("kamikaze",false)
|
|
|
|
--end
|
2021-02-13 04:07:50 +01:00
|
|
|
end)
|
2021-02-15 23:41:56 +01:00
|
|
|
|
|
|
|
minetest.register_cheat('KamiCrystals','Bots','kamikaze_crystals')
|