27 lines
705 B
Lua
27 lines
705 B
Lua
--- Heal player when punched around the spawn area - eliminate spawn killing / killers
|
|
-- @author SaKeL
|
|
|
|
local spawn_spawnpos = minetest.setting_get_pos("static_spawnpoint")
|
|
|
|
function defaultx.register_on_punchplayer(player, hitter, time_from_last_punch, tool_capabilities, dir, damage)
|
|
if not player or not hitter then
|
|
return
|
|
end
|
|
if not player:is_player() or not hitter:is_player() then
|
|
return
|
|
end
|
|
|
|
-- local hp = player:get_hp()
|
|
-- print("get hp: ", hp)
|
|
|
|
if spawn_spawnpos then
|
|
if vector.distance(player:get_pos(), spawn_spawnpos) < 48 then
|
|
-- print("set hp: ", hp)
|
|
-- player:set_hp(hp)
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
|
|
minetest.register_on_punchplayer(defaultx.register_on_punchplayer)
|