undying: huge improvements!
This commit is contained in:
parent
a14b6aaf11
commit
b451b280b0
@ -9,11 +9,11 @@ local formspec = ""
|
||||
.. "set_focus[btn_respawn;true]"
|
||||
|
||||
minetest.register_on_death(function()
|
||||
local warp_success, warp_msg = warp.set_here("death")
|
||||
if warp_success then
|
||||
minetest.display_chat_message(warp_msg)
|
||||
else
|
||||
minetest.display_chat_message("You died at " .. minetest.pos_to_string(minetest.localplayer:get_pos()) .. ".")
|
||||
if minetest.settings:get_bool("deathwarp") then
|
||||
local warp_success, warp_msg = warp.set_here("death")
|
||||
if warp_success then
|
||||
minetest.display_chat_message(warp_msg)
|
||||
end
|
||||
end
|
||||
if minetest.settings:get_bool("autorespawn") then
|
||||
minetest.send_respawn()
|
||||
@ -45,3 +45,4 @@ minetest.register_chatcommand("respawn", {
|
||||
})
|
||||
|
||||
minetest.register_cheat("AutoRespawn", "Player", "autorespawn")
|
||||
minetest.register_cheat("DeathWarp", "Player", "deathwarp")
|
||||
|
@ -2,30 +2,49 @@
|
||||
-- undying
|
||||
|
||||
|
||||
local sh=false
|
||||
|
||||
local function findbones()
|
||||
return minetest.find_node_near(minetest.localplayer:get_pos(), 6, {"bones:bones"},true)
|
||||
end
|
||||
|
||||
local function digbones()
|
||||
local bn=findbones()
|
||||
if not bn then return false end
|
||||
minetest.dig_node(bn)
|
||||
if findbones() then minetest.after("0.1",digbones) end
|
||||
end
|
||||
|
||||
minetest.register_on_death(function()
|
||||
if not minetest.settings:get_bool("undying") then return end
|
||||
minetest.after(0.2,function()
|
||||
minetest.send_chat_message("/home")
|
||||
minetest.after(1.0,function()
|
||||
local bn=minetest.find_node_near(minetest.localplayer:get_pos(), 6, {"bones:bones"},true)
|
||||
if not bn then return end
|
||||
minetest.dig_node(bn)
|
||||
end)
|
||||
sh=false
|
||||
minetest.after("0.1",function() minetest.send_chat_message("/home") end)
|
||||
minetest.after("0.2",function()
|
||||
digbones()
|
||||
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)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
minetest.register_on_damage_taken(function(hp)
|
||||
local hhp=minetest.localplayer:get_hp()
|
||||
if (hhp==0 ) then return end
|
||||
if (hhp < 3 ) then
|
||||
if minetest.settings:get_bool("undying") then
|
||||
if not sh and minetest.settings:get_bool("undying") then
|
||||
local hhp=minetest.localplayer:get_hp()
|
||||
--if (hhp==0 ) then return end
|
||||
if (hhp < 2 ) then
|
||||
sh=true
|
||||
minetest.settings:set_bool("autorespawn",true)
|
||||
minetest.send_chat_message("/sethome") end
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
minetest.register_on_receiving_chat_message(function(msg)
|
||||
if (msg:find('Teleported to home!') or msg:find('Home set!')) then return true end
|
||||
end)
|
||||
|
||||
-- REG cheats on DF
|
||||
if (_G["minetest"]["register_cheat"] ~= nil) then
|
||||
|
Loading…
x
Reference in New Issue
Block a user