incrementaltp: respect physics overrides
[waspsaliva.git] / clientmods / undying / init.lua
blobdbf0074074f121a8d883a1f36443d006bf3a0c4c
1 --
2 -- undying
5 local sh=false
7 local function findbones()
8 return minetest.find_node_near(minetest.localplayer:get_pos(), 6, {"bones:bones"},true)
9 end
11 local function digbones()
12 local bn=findbones()
13 if not bn then return false end
14 minetest.dig_node(bn)
15 if findbones() then minetest.after("0.1",digbones) end
16 end
18 minetest.register_on_death(function()
19 if not minetest.settings:get_bool("undying") then return end
20 sh=false
21 minetest.after("0.1",function() minetest.send_chat_message("/home") end)
22 minetest.after("0.2",function()
23 digbones()
24 for k, v in ipairs(minetest.localplayer.get_nearby_objects(10)) do
25 if (v:is_player() and v:get_name() ~= minetest.localplayer:get_name()) then
26 local pos = v:get_pos()
27 pos.y = pos.y - 1
28 autofly.aim(pos)
29 end
30 end
31 end)
32 end)
34 minetest.register_on_damage_taken(function(hp)
35 if not sh and minetest.settings:get_bool("undying") then
36 local hhp=minetest.localplayer:get_hp()
37 --if (hhp==0 ) then return end
38 if (hhp < 2 ) then
39 sh=true
40 minetest.settings:set_bool("autorespawn",true)
41 minetest.send_chat_message("/sethome") end
42 end
43 end
45 minetest.register_on_receiving_chat_message(function(msg)
46 if (msg:find('Teleported to home!') or msg:find('Home set!')) then return true end
47 end)
49 -- REG cheats on DF
50 if (_G["minetest"]["register_cheat"] ~= nil) then
51 minetest.register_cheat("Undying", "Combat", "undying")
52 else
53 minetest.settings:set_bool('undying',true)
54 end