fix crash when trying to sleep on a mat

This commit is contained in:
flux 2023-01-22 19:04:19 -08:00
parent cdbc22b9dc
commit 116ea12a79
No known key found for this signature in database
GPG Key ID: 9333B27816848A15
1 changed files with 19 additions and 18 deletions

View File

@ -1,6 +1,6 @@
local S = cottages.S
if not (minetest.registered_nodes["farming:straw"]) then
if not minetest.registered_nodes["farming:straw"] then
minetest.register_node("cottages:straw", {
drawtype = "normal",
description = S("straw"),
@ -14,7 +14,6 @@ else
minetest.register_alias("cottages:straw", "farming:straw")
end
minetest.register_node("cottages:straw_mat", {
description = S("layer of straw"),
drawtype = "nodebox",
@ -31,18 +30,20 @@ minetest.register_node("cottages:straw_mat", {
type = "fixed",
fixed = {
{ -0.48, -0.5, -0.48, 0.48, -0.45, 0.48 },
}
},
},
selection_box = {
type = "fixed",
fixed = {
{ -0.48, -0.5, -0.48, 0.48, -0.25, 0.48 },
}
},
},
is_ground_content = false,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
return cottages.sleep_in_bed(pos, node, clicker, itemstack, pointed_thing)
if cottages.furniture then
return cottages.furniture.sleep_in_bed(pos, node, clicker, itemstack, pointed_thing)
end
end,
})
-- straw bales are a must for farming environments; if you for some reason do not have the darkage mod installed, this
@ -59,13 +60,13 @@ minetest.register_node("cottages:straw_bale", {
type = "fixed",
fixed = {
{ -0.45, -0.5, -0.45, 0.45, 0.45, 0.45 },
}
},
},
selection_box = {
type = "fixed",
fixed = {
{ -0.45, -0.5, -0.45, 0.45, 0.45, 0.45 },
}
},
},
is_ground_content = false,
})