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,11 +1,11 @@
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"),
tiles = {cottages.textures.straw},
groups = {hay = 3, snappy = 2, oddly_breakable_by_hand = 2, flammable = 3},
tiles = { cottages.textures.straw },
groups = { hay = 3, snappy = 2, oddly_breakable_by_hand = 2, flammable = 3 },
sounds = cottages.sounds.leaves,
-- the bale is slightly smaller than a full node
is_ground_content = false,
@ -14,35 +14,36 @@ else
minetest.register_alias("cottages:straw", "farming:straw")
end
minetest.register_node("cottages:straw_mat", {
description = S("layer of straw"),
drawtype = "nodebox",
tiles = {cottages.textures.straw}, -- done by VanessaE
tiles = { cottages.textures.straw }, -- done by VanessaE
wield_image = cottages.textures.straw,
inventory_image = cottages.textures.straw,
sunlight_propagates = true,
paramtype = "light",
paramtype2 = "facedir",
walkable = false,
groups = {hay = 3, snappy = 2, oddly_breakable_by_hand = 2, flammable = 3},
groups = { hay = 3, snappy = 2, oddly_breakable_by_hand = 2, flammable = 3 },
sounds = cottages.sounds.leaves,
node_box = {
type = "fixed",
fixed = {
{-0.48, -0.5, -0.48, 0.48, -0.45, 0.48},
}
{ -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},
}
{ -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)
end
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
@ -50,22 +51,22 @@ minetest.register_node("cottages:straw_mat", {
minetest.register_node("cottages:straw_bale", {
drawtype = "nodebox",
description = S("straw bale"),
tiles = {"cottages_darkage_straw_bale.png"},
tiles = { "cottages_darkage_straw_bale.png" },
paramtype = "light",
groups = {hay = 3, snappy = 2, oddly_breakable_by_hand = 2, flammable = 3},
groups = { hay = 3, snappy = 2, oddly_breakable_by_hand = 2, flammable = 3 },
sounds = cottages.sounds.leaves,
-- the bale is slightly smaller than a full node
node_box = {
type = "fixed",
fixed = {
{-0.45, -0.5, -0.45, 0.45, 0.45, 0.45},
}
{ -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},
}
{ -0.45, -0.5, -0.45, 0.45, 0.45, 0.45 },
},
},
is_ground_content = false,
})