diff options
| -rw-r--r-- | README.md | 3 | ||||
| -rw-r--r-- | init.lua | 17 | 
2 files changed, 18 insertions, 2 deletions
| @@ -16,4 +16,5 @@ Released under WTFPL  0.8 - Updated to work with Minetest 0.4.12, simplified textures  0.9 - Tweaked code  1.0 - Only owner can remove protector -1.1 - PVP can be disabled for player inside their own protected area using protector_pvp in minetest.conf (requires Minetest 0.4.12 dev and above)
\ No newline at end of file +1.1 - Set protector_pvp to true in minetest.conf to disable pvp in player's own area +      also setting protector_pvp_spawn will disable pvp in spawn area up to a radius of n blocks
\ No newline at end of file @@ -1,9 +1,13 @@  minetest.register_privilege("delprotect","Ignore player protection") +-- get static spawn position +local statspawn = (minetest.setting_get_pos("static_spawnpoint") or {x = 0, y = 2, z = 0}) +  protector = {}  protector.mod = "redo"  protector.radius = (tonumber(minetest.setting_get("protector_radius")) or 5)  protector.pvp = minetest.setting_get("protector_pvp") or false +protector.spawn = (tonumber(minetest.setting_get("protector_pvp_spawn")) or 0)  protector.get_member_list = function(meta)  	return meta:get_string("members"):split(" ") @@ -713,7 +717,18 @@ if minetest.setting_getbool("enable_pvp") and protector.pvp == "true" then  				return false  			end -			if minetest.is_protected(player:getpos(), hitter:get_player_name()) then +			-- no pvp at spawn area +			local pos = player:getpos() +			if pos.x < statspawn.x + protector.spawn +			and pos.x > statspawn.x - protector.spawn +			and pos.y < statspawn.y + protector.spawn +			and pos.y > statspawn.y - protector.spawn +			and pos.z < statspawn.z + protector.spawn +			and pos.z > statspawn.z - protector.spawn then +				return true +			end + +			if minetest.is_protected(pos, hitter:get_player_name()) then  				return true  			else  				return false | 
