Its quite annoying how players can just dig through steel doors easily with even small lag, especially now that doors are one piece. This solves the problem, add to door node definition:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
groups.level = 99
and
on_punch = function(pos, node, puncher, pointed_thing) -- remove node if owner repeatedly punches it 3x
local pname = puncher:get_player_name();
local meta = minetest.get_meta(pos);
local owner = meta:get_string("doors_owner")
if pname==owner or not minetest.is_protected(pos,pname) then -- can be dug by owner or if unprotected
local t0 = meta:get_int("punchtime");local count = meta:get_int("punchcount");
local t = minetest.get_gametime();
if t-t0<2 then count = (count +1 ) % 3 else count = 0 end
if count == 1 then
minetest.chat_send_player(pname, "#steel door: punch me one more time to remove me");
end
if count == 2 then -- remove steel door and drop it
minetest.set_node(pos, {name = "air"});
local stack = ItemStack(dropname);minetest.add_item(pos,stack)
end
meta:set_int("punchcount",count);meta:set_int("punchtime",t);
end
end
It basically makes doors undigable , but they can be easily removed by repeated punches by owner only or if not protected.