spawn no kill

master
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,9 +1,11 @@
-- main settings
dofile(minetest.get_modpath("enhancements").."/settings.txt")
--
defaultx = {}
--
-- tools enhancements
--
--
if TOOLS_ENHANCE then
dofile(minetest.get_modpath("enhancements").."/swords.lua")
dofile(minetest.get_modpath("enhancements").."/axe.lua")
@ -13,71 +15,68 @@ if TOOLS_ENHANCE then
print("[Mod][enhancements] TOOLS_ENHANCE enabled")
end
--
--
-- clean-up unknown nodes and entities (configuration in that file)
--
--
if CLEAN_UNKNOWN then
dofile(minetest.get_modpath("enhancements").."/clean_unknown.lua")
print("[Mod][enhancements] CLEAN_UNKNOWN enabled")
end
--
--
-- allow external command from outside of minetest (see readme)
--
--
if EXTERNAL_CMD then
dofile(minetest.get_modpath("enhancements").."/external_cmd.lua")
print("[Mod][enhancements] EXTERNAL_CMD enabled")
end
--
--
-- detect AFK players
--
--
if PLAYER_AFK then
dofile(minetest.get_modpath("enhancements").."/afk.lua")
print("[Mod][enhancements] PLAYER_AFK enabled")
end
--
--
-- go to and set SPAWN_POINT
--
--
if SPAWN_POINT then
dofile(minetest.get_modpath("enhancements").."/spawn.lua")
print("[Mod][enhancements] SPAWN_POINT enabled")
end
--
--
-- pick dropped items by holding shift (sneak)
--
--
if ITEM_DROP then
dofile(minetest.get_modpath("enhancements").."/item_drop.lua")
print("[Mod][enhancements] ITEM_DROP enabled")
end
--
--
-- teleport request to/from another player
--
--
if TP_REQUEST then
dofile(minetest.get_modpath("enhancements").."/teleport_request.lua")
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
-- WIP DON'T ENABLE!
-- WIP DON'T ENABLE!
if AREAS_ENHANCE and minetest.get_modpath("areas") then
dofile(minetest.get_modpath("enhancements").."/areas.lua")

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)