2 local cpos
={x
=0,y
=0,z
=0}
5 local zz
={x
=0,y
=64,z
=0}
6 local badnodes
={'mcl_tnt:tnt','mcl_fire:basic_flame','mcl_fire:eternal_fire','mcl_fire:fire','mcl_fire:fire_charge'}
7 --'mcl_sponges:sponge','mcl_sponges:sponge_wet'
10 local function set_kwp(name
,pos
)
12 minetest
.localplayer
:hud_change(hud_wp
, 'world_pos', pos
)
13 minetest
.localplayer
:hud_change(hud_wp
, 'name', name
)
15 hud_wp
= minetest
.localplayer
:hud_add({
16 hud_elem_type
= 'waypoint',
25 local function randomzz()
26 if nextzz
> os
.clock() then return false end
27 math
.randomseed(os
.time())
28 zz
.x
=math
.random(-128,128)
29 zz
.y
=math
.random(64,searchheight
)
30 zz
.z
=math
.random(-128,128)
34 local function find_bad_things()
35 if fnd
then return true end
36 local obs
=minetest
.localplayer
.get_nearby_objects(crange
)
37 local lp
=minetest
.localplayer
:get_pos()
39 for k
, v
in ipairs(obs
) do -- look for crystals first
40 if ( v
:get_item_textures():find("mcl_end_crystal") ) then
42 set_kwp(v
:get_item_textures(),v
:get_pos())
48 for k
, v
in ipairs(obs
) do
49 if ( v
:get_item_textures():find("arrow_box") ) then
51 set_kwp(v
:get_item_textures(),v
:get_pos())
57 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)
60 for k
,v
in pairs(epos
) do for kk
,vv
in pairs(v
) do
61 lp
=minetest
.localplayer
:get_pos()
62 local dst
=vector
.distance(lp
,vv
)
63 if odst
> dst
then odst
=dst cpos
=vv fnd
=true end
65 if fnd
then set_kwp('badnode',cpos
) return true end
68 set_kwp('nothing found',zz
)
76 local function flythere()
77 minetest
.settings
:set_bool('noclip',true)
78 minetest
.settings
:set_bool("pitch_move",true)
79 minetest
.settings
:set_bool("continuous_forward",true)
81 core
.set_keypress("special1", true)
84 local function stopflight()
85 minetest
.settings
:set_bool("continuous_forward",false)
86 minetest
.settings
:set_bool("noclip",false)
87 minetest
.settings
:set_bool("pitch_move",false)
88 core
.set_keypress("special1", false)
89 minetest
.after("0",function()
90 minetest
.interact("start_digging")
91 minetest
.dig_node(cpos
)
96 minetest
.register_globalstep(function()
97 if not minetest
.settings
:get_bool("kamikaze") and not minetest
.localplayer
:get_name():find("kamikaze") then
99 minetest
.localplayer
:hud_remove(hud_wp
) hud_wp
=nil
100 minetest
.settings
:set_bool("continuous_forward",false)
101 minetest
.settings
:set_bool("noclip",false)
102 minetest
.settings
:set_bool("pitch_move",false)
103 core
.set_keypress("special1", false)
109 local lp
= minetest
.localplayer
:get_pos()
110 if not find_bad_things() then
111 if vector
.distance(lp
,zz
) < 1 then
117 elseif vector
.distance(lp
,cpos
) < 1 then
124 minetest
.register_on_death(function()
125 if not minetest
.settings
:get_bool("kamikaze") then return end
129 minetest
.register_cheat("Kamikaze", "Combat", "kamikaze")