forked from mtcontrib/homedecor_modpack
Beds : use default sleeping function and adjust s/c_box
This commit is contained in:
parent
f1428f7be7
commit
ff6073664d
@ -189,16 +189,34 @@ local bedcolors = {
|
|||||||
"pink",
|
"pink",
|
||||||
}
|
}
|
||||||
|
|
||||||
local bed_cbox = {
|
local bed_sbox = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 1.5 }
|
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 1.5 }
|
||||||
}
|
}
|
||||||
|
|
||||||
local kbed_cbox = {
|
local bed_cbox = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{ -0.5, -0.5, -0.5, 0.5, -0.05, 1.5 },
|
||||||
|
{ -0.5, -0.5, 1.44, 0.5, 0.5, 1.5 },
|
||||||
|
{ -0.5, -0.5, -0.5, 0.5, 0.18, -0.44 },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
local kbed_sbox = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = { -0.5, -0.5, -0.5, 1.5, 0.5, 1.5 }
|
fixed = { -0.5, -0.5, -0.5, 1.5, 0.5, 1.5 }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local kbed_cbox = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{ -0.5, -0.5, -0.5, 1.5, -0.05, 1.5 },
|
||||||
|
{ -0.5, -0.5, 1.44, 1.5, 0.5, 1.5 },
|
||||||
|
{ -0.5, -0.5, -0.5, 1.5, 0.18, -0.44 },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for _, color in ipairs(bedcolors) do
|
for _, color in ipairs(bedcolors) do
|
||||||
local color2=color
|
local color2=color
|
||||||
if color == "darkgrey" then
|
if color == "darkgrey" then
|
||||||
@ -217,7 +235,7 @@ for _, color in ipairs(bedcolors) do
|
|||||||
inventory_image = "homedecor_bed_"..color.."_inv.png",
|
inventory_image = "homedecor_bed_"..color.."_inv.png",
|
||||||
description = S("Bed (%s)"):format(color),
|
description = S("Bed (%s)"):format(color),
|
||||||
groups = {snappy=3},
|
groups = {snappy=3},
|
||||||
selection_box = bed_cbox,
|
selection_box = bed_sbox,
|
||||||
collision_box = bed_cbox,
|
collision_box = bed_cbox,
|
||||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
if not placer:get_player_control().sneak then
|
if not placer:get_player_control().sneak then
|
||||||
@ -227,6 +245,11 @@ for _, color in ipairs(bedcolors) do
|
|||||||
after_dig_node = function(pos)
|
after_dig_node = function(pos)
|
||||||
homedecor.unextend_bed(pos, color)
|
homedecor.unextend_bed(pos, color)
|
||||||
end,
|
end,
|
||||||
|
on_rightclick = function(pos, node, clicker)
|
||||||
|
if minetest.get_modpath("beds") then
|
||||||
|
beds.on_rightclick(pos, clicker)
|
||||||
|
else return end
|
||||||
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
homedecor.register("bed_"..color.."_extended", {
|
homedecor.register("bed_"..color.."_extended", {
|
||||||
@ -240,12 +263,17 @@ for _, color in ipairs(bedcolors) do
|
|||||||
"wool_"..color2..".png^[brighten",
|
"wool_"..color2..".png^[brighten",
|
||||||
},
|
},
|
||||||
groups = {snappy=3, not_in_creative_inventory=1},
|
groups = {snappy=3, not_in_creative_inventory=1},
|
||||||
selection_box = bed_cbox,
|
selection_box = bed_sbox,
|
||||||
collision_box = bed_cbox,
|
collision_box = bed_cbox,
|
||||||
expand = { forward = "air" },
|
expand = { forward = "air" },
|
||||||
after_dig_node = function(pos)
|
after_dig_node = function(pos)
|
||||||
homedecor.unextend_bed(pos, color)
|
homedecor.unextend_bed(pos, color)
|
||||||
end,
|
end,
|
||||||
|
on_rightclick = function(pos, node, clicker)
|
||||||
|
if minetest.get_modpath("beds") then
|
||||||
|
beds.on_rightclick(pos, clicker)
|
||||||
|
else return end
|
||||||
|
end,
|
||||||
drop = "homedecor:bed_"..color.."_regular"
|
drop = "homedecor:bed_"..color.."_regular"
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -262,7 +290,7 @@ for _, color in ipairs(bedcolors) do
|
|||||||
inventory_image = "homedecor_bed_kingsize_"..color.."_inv.png",
|
inventory_image = "homedecor_bed_kingsize_"..color.."_inv.png",
|
||||||
description = S("Bed (%s, king sized)"):format(color),
|
description = S("Bed (%s, king sized)"):format(color),
|
||||||
groups = {snappy=3, not_in_creative_inventory=1},
|
groups = {snappy=3, not_in_creative_inventory=1},
|
||||||
selection_box = kbed_cbox,
|
selection_box = kbed_sbox,
|
||||||
collision_box = kbed_cbox,
|
collision_box = kbed_cbox,
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||||
local inv = digger:get_inventory()
|
local inv = digger:get_inventory()
|
||||||
@ -271,6 +299,11 @@ for _, color in ipairs(bedcolors) do
|
|||||||
inv:add_item("main", "homedecor:bed_"..color.."_regular 2")
|
inv:add_item("main", "homedecor:bed_"..color.."_regular 2")
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
on_rightclick = function(pos, node, clicker)
|
||||||
|
if minetest.get_modpath("beds") then
|
||||||
|
beds.on_rightclick(pos, clicker)
|
||||||
|
else return end
|
||||||
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_alias("homedecor:bed_"..color.."_foot", "homedecor:bed_"..color.."_regular")
|
minetest.register_alias("homedecor:bed_"..color.."_foot", "homedecor:bed_"..color.."_regular")
|
||||||
|
Loading…
Reference in New Issue
Block a user