forked from Mineclonia/Mineclonia
Render mcl_farming plant stems 1/16 node lower
This patch shifts mcl_farming nodes that represent a stem 1/16 nodes downwards. It also replaces the plantlike drawtype of mcl_farming nodes that represent an unconnected stem (x) with a nodebox drawtype that looks like a plus (+), as Minetest has no option to rotate nodeboxes. The goal is to remove the gap between plants and farming soil with a node height of 15/16. This patch affects melon stem and pumpkin stem nodes.
This commit is contained in:
parent
14cbc63b5f
commit
0808b54192
|
@ -91,16 +91,18 @@ for s=1,7 do
|
||||||
_doc_items_longdesc = longdesc,
|
_doc_items_longdesc = longdesc,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
drawtype = "plantlike",
|
drawtype = "nodebox",
|
||||||
|
node_box = mcl_farming:get_plantlike_plus_nodebox(),
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
drop = stem_drop,
|
drop = stem_drop,
|
||||||
tiles = {texture},
|
tiles = { mcl_farming:align_plantlike_nodebox_texture(texture) },
|
||||||
|
use_texture_alpha = "clip",
|
||||||
wield_image = texture,
|
wield_image = texture,
|
||||||
inventory_image = texture,
|
inventory_image = texture,
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.15, -0.5, -0.15, 0.15, -0.5+h, 0.15}
|
{-0.15, -9/16, -0.15, 0.15, -9/16+h, 0.15}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1, plant_melon_stem=s},
|
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1, plant_melon_stem=s},
|
||||||
|
|
|
@ -63,16 +63,18 @@ for s=1,7 do
|
||||||
_doc_items_longdesc = longdesc,
|
_doc_items_longdesc = longdesc,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
drawtype = "plantlike",
|
drawtype = "nodebox",
|
||||||
|
node_box = mcl_farming:get_plantlike_plus_nodebox(),
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
drop = stem_drop,
|
drop = stem_drop,
|
||||||
tiles = {texture},
|
tiles = { mcl_farming:align_plantlike_nodebox_texture(texture) },
|
||||||
|
use_texture_alpha = "clip",
|
||||||
inventory_image = texture,
|
inventory_image = texture,
|
||||||
wield_image = texture,
|
wield_image = texture,
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.15, -0.5, -0.15, 0.15, -0.5+h, 0.15}
|
{-0.15, -9/16, -0.15, 0.15, -9/16+h, 0.15}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1,},
|
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1,},
|
||||||
|
|
|
@ -265,7 +265,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
|
||||||
stem_def.selection_box = {
|
stem_def.selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.15, -0.5, -0.15, 0.15, 0.5, 0.15}
|
{-0.15, -9/16, -0.15, 0.15, 7/16, 0.15}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -273,7 +273,20 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
|
||||||
stem_def.paramtype = "light"
|
stem_def.paramtype = "light"
|
||||||
end
|
end
|
||||||
if not stem_def.drawtype then
|
if not stem_def.drawtype then
|
||||||
stem_def.drawtype = "plantlike"
|
stem_def.drawtype = "nodebox"
|
||||||
|
end
|
||||||
|
if not stem_def.node_box then
|
||||||
|
stem_def.node_box = mcl_farming:get_plantlike_plus_nodebox()
|
||||||
|
end
|
||||||
|
if stem_def.tiles then
|
||||||
|
for i=1,#stem_def.tiles do
|
||||||
|
stem_def.tiles[i] = mcl_farming:align_plantlike_nodebox_texture(
|
||||||
|
stem_def.tiles[i]
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not stem_def.use_texture_alpha then
|
||||||
|
stem_def.use_texture_alpha = "clip"
|
||||||
end
|
end
|
||||||
if stem_def.walkable == nil then
|
if stem_def.walkable == nil then
|
||||||
stem_def.walkable = false
|
stem_def.walkable = false
|
||||||
|
@ -300,6 +313,9 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
|
||||||
minetest.register_node(stem_itemstring, stem_def)
|
minetest.register_node(stem_itemstring, stem_def)
|
||||||
|
|
||||||
-- Register connected stems
|
-- Register connected stems
|
||||||
|
local connected_stem_texture = mcl_farming:align_plantlike_nodebox_texture(
|
||||||
|
connected_stem_texture
|
||||||
|
)
|
||||||
local connected_stem_tiles = {
|
local connected_stem_tiles = {
|
||||||
{ "blank.png", --top
|
{ "blank.png", --top
|
||||||
"blank.png", -- bottom
|
"blank.png", -- bottom
|
||||||
|
@ -331,16 +347,16 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
local connected_stem_nodebox = {
|
local connected_stem_nodebox = {
|
||||||
{-0.5, -0.5, 0, 0.5, 0.5, 0},
|
{-0.5, -9/16, 0, 0.5, 7/16, 0},
|
||||||
{-0.5, -0.5, 0, 0.5, 0.5, 0},
|
{-0.5, -9/16, 0, 0.5, 7/16, 0},
|
||||||
{0, -0.5, -0.5, 0, 0.5, 0.5},
|
{0, -9/16, -0.5, 0, 7/16, 0.5},
|
||||||
{0, -0.5, -0.5, 0, 0.5, 0.5},
|
{0, -9/16, -0.5, 0, 7/16, 0.5},
|
||||||
}
|
}
|
||||||
local connected_stem_selectionbox = {
|
local connected_stem_selectionbox = {
|
||||||
{-0.1, -0.5, -0.1, 0.5, 0.2, 0.1},
|
{-0.1, -9/16, -0.1, 0.5, 0.2 - 1/16, 0.1},
|
||||||
{-0.5, -0.5, -0.1, 0.1, 0.2, 0.1},
|
{-0.5, -9/16, -0.1, 0.1, 0.2 - 1/16, 0.1},
|
||||||
{-0.1, -0.5, -0.1, 0.1, 0.2, 0.5},
|
{-0.1, -9/16, -0.1, 0.1, 0.2 - 1/16, 0.5},
|
||||||
{-0.1, -0.5, -0.5, 0.1, 0.2, 0.1},
|
{-0.1, -9/16, -0.5, 0.1, 0.2 - 1/16, 0.1},
|
||||||
}
|
}
|
||||||
|
|
||||||
for i=1, 4 do
|
for i=1, 4 do
|
||||||
|
@ -469,6 +485,19 @@ minetest.register_lbm({
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- This function returns a nodebox that imitates a plantlike plus (+)
|
||||||
|
-- drawtype, but is shifted 1/16 lower, into the empty space above
|
||||||
|
-- farming soil. The regular plantlike drawtype can not do this.
|
||||||
|
function mcl_farming:get_plantlike_plus_nodebox()
|
||||||
|
return {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{ 0, -9/16, -0.15, 0, 7/16, 0.15 },
|
||||||
|
{ -0.15, -9/16, 0, 0.15, 7/16, 0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
-- This function returns a nodebox that imitates a plantlike grid (#)
|
-- This function returns a nodebox that imitates a plantlike grid (#)
|
||||||
-- drawtype, but is shifted 1/16 lower, into the empty space above
|
-- drawtype, but is shifted 1/16 lower, into the empty space above
|
||||||
-- farming soil. The regular plantlike drawtype can not do this.
|
-- farming soil. The regular plantlike drawtype can not do this.
|
||||||
|
|
Loading…
Reference in New Issue