1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-16 15:30:30 +01:00
player can't take items when usebug respawn
This commit is contained in:
crabman77 2015-11-01 13:35:59 +01:00
parent 5b54007099
commit af27321751

View File

@ -1,6 +1,40 @@
item_drop = {}
local enable_damage = minetest.setting_getbool("enable_damage")
local creative_mode = minetest.setting_getbool("creative_mode")
local TICK_UPDATE = 0.1
local die_timeout = 20
local die_time = {}
local die_respawned = {}
minetest.register_on_joinplayer(function(player)
local player_name = player:get_player_name()
die_time[player_name] = 0
die_respawned[player_name] = false
end)
minetest.register_on_leaveplayer(function(player)
local player_name = player:get_player_name()
minetest.after(3, function()
die_time[player_name] = nil
die_respawned[player_name] = nil
end)
end)
minetest.register_on_dieplayer(function(player)
local player_name = player:get_player_name()
if not player_name then return end
die_respawned[player_name] = false
die_time[player_name] = die_timeout
end)
minetest.register_on_respawnplayer(function(player)
local player_name = player:get_player_name()
if not player_name then return end
die_respawned[player_name] = true
end)
-- Following edits by gravgun
@ -33,9 +67,10 @@ local pickup_duration = 0.1
local pickup_inv_duration = 1/pickup_duration*0.7
local function tick()
minetest.after(0.1, tick)
local tstamp = minetest.get_us_time()
for _,player in ipairs(minetest.get_connected_players()) do
local player_name = player:get_player_name()
if die_time[player_name] < 1 then
if player:get_hp() > 0 or not enable_damage then
local pos = player:getpos()
pos.y = pos.y + player_half_height
@ -107,7 +142,13 @@ local function tick()
end
end
end
else
if die_respawned[player_name] then
die_time[player_name] = (die_time[player_name] or die_timeout) - TICK_UPDATE
end
end
end
minetest.after(TICK_UPDATE, tick)
end
local mt_handle_node_drops = minetest.handle_node_drops