Initial commit.

master
James Stevenson 2016-07-14 17:04:25 -04:00
commit 27f836f2e4
1 changed files with 18 additions and 0 deletions

18
init.lua Normal file
View File

@ -0,0 +1,18 @@
minetest.register_node("nopvp:nopvp", {
description = "No PvP Radial",
tiles = {"default_obsidian.png^[colorize:white:36^heart.png"},
})
minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage)
if damage > 0 then
local pos = player:getpos()
local p1 = {x = pos.x - 5, y = pos.y - 5, z = pos.z - 5}
local p2 = {x = pos.y + 5, y = pos.y + 5, z = pos.z + 5}
if #minetest.find_nodes_in_area(p1, p2, {"nopvp:nopvp"}) > 0 then
hitter:set_hp(hitter:get_hp() - damage)
return true
else
return false
end
end
end)