1
0
mirror of https://github.com/minetest/minetest_game.git synced 2025-06-29 13:20:25 +02:00

Disallow digging a bed if in use

Use a new table beds.bed_position to check if a bed is in use.
This commit is contained in:
bell07
2018-06-19 23:07:01 +02:00
committed by Paramat
parent e9fbd3d75d
commit 5692c15b4d
4 changed files with 22 additions and 0 deletions

View File

@ -141,6 +141,9 @@ function beds.register_bed(name, def)
minetest.set_node(newp, {name = name .. "_top", param2 = new_param2})
return true
end,
can_dig = function(pos, player)
return beds.can_dig(pos)
end,
})
minetest.register_node(name .. "_top", {
@ -160,6 +163,12 @@ function beds.register_bed(name, def)
on_destruct = function(pos)
destruct_bed(pos, 2)
end,
can_dig = function(pos, player)
local node = minetest.get_node(pos)
local dir = minetest.facedir_to_dir(node.param2)
local p = vector.add(pos, dir)
return beds.can_dig(p)
end,
})
minetest.register_alias(name, name .. "_bottom")