spawn no kill

This commit is contained in:
Juraj Vajda 2018-02-27 22:45:40 -05:00
parent 14123cc34b
commit ef881cc23d
2 changed files with 46 additions and 21 deletions

View File

@ -1,6 +1,8 @@
-- main settings
dofile(minetest.get_modpath("enhancements").."/settings.txt")
defaultx = {}
--
-- tools enhancements
--
@ -67,13 +69,10 @@ if TP_REQUEST then
print("[Mod][enhancements] TP_REQUEST enabled")
end
--
-- move player head up/down
--
if PLAYER_ANIM then
dofile(minetest.get_modpath("enhancements").."/playeranim.lua")
if SPAWNNOKILL then
dofile(minetest.get_modpath("enhancements").."/spawnnokill.lua")
print("[Mod][enhancements] PLAYER_ANIM enabled")
print("[Mod][enhancements] SPAWNNOKILL enabled")
end
-- manage privileges i areas mod - if using areas mod only for admin purposes

26
spawnnokill.lua Normal file
View File

@ -0,0 +1,26 @@
--- 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)