mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-06-07 06:06:10 -04:00
Merge c79bfeef33
into f80fafbcfb
This commit is contained in:
commit
7174a7f75b
2 changed files with 23 additions and 10 deletions
|
@ -37,14 +37,7 @@ function beds.register_bed(name, def)
|
||||||
return false
|
return false
|
||||||
end,
|
end,
|
||||||
on_destruct = function(pos)
|
on_destruct = function(pos)
|
||||||
local n = minetest.get_node_or_nil(pos)
|
beds.destroy_bed(pos, false)
|
||||||
if not n then return end
|
|
||||||
local dir = minetest.facedir_to_dir(n.param2)
|
|
||||||
local p = vector.add(pos, dir)
|
|
||||||
local n2 = minetest.get_node(p)
|
|
||||||
if minetest.get_item_group(n2.name, "bed") == 2 and n.param2 == n2.param2 then
|
|
||||||
minetest.remove_node(p)
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
on_rightclick = function(pos, node, clicker)
|
on_rightclick = function(pos, node, clicker)
|
||||||
beds.on_rightclick(pos, clicker)
|
beds.on_rightclick(pos, clicker)
|
||||||
|
@ -89,12 +82,20 @@ function beds.register_bed(name, def)
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
pointable = false,
|
pointable = false,
|
||||||
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 2},
|
groups = {bed = 2},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = def.nodebox.top,
|
fixed = def.nodebox.top,
|
||||||
},
|
},
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {0, 0, 0, 0, 0, 0},
|
||||||
|
},
|
||||||
|
on_destruct = function(pos)
|
||||||
|
beds.destroy_bed(pos, true)
|
||||||
|
end,
|
||||||
|
drop = name .. "_bottom",
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_alias(name, name .. "_bottom")
|
minetest.register_alias(name, name .. "_bottom")
|
||||||
|
|
|
@ -7,6 +7,7 @@ if enable_respawn == nil then
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- helper functions
|
-- helper functions
|
||||||
|
|
||||||
local function get_look_yaw(pos)
|
local function get_look_yaw(pos)
|
||||||
|
@ -174,6 +175,17 @@ function beds.on_rightclick(pos, player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function beds.destroy_bed(pos, reverse)
|
||||||
|
local n = minetest.get_node_or_nil(pos)
|
||||||
|
if not n then return end
|
||||||
|
local dir = minetest.facedir_to_dir(n.param2)
|
||||||
|
local p = vector.add(pos, dir)
|
||||||
|
local n2 = minetest.get_node(p)
|
||||||
|
if minetest.get_item_group(n2.name, "bed") == 2 then
|
||||||
|
minetest.remove_node(p)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- callbacks
|
-- callbacks
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue