Compare commits

...

5 Commits

Author SHA1 Message Date
erlehmann 20e44e4033 Merge pull request 'Add mod.confs to silence Minetest 5.5 warnings' (#298) from rudzik8/Mineclonia:add-mod-confs into master
Reviewed-on: https://git.minetest.land/Mineclonia/Mineclonia/pulls/298
Reviewed-by: cora <cora@noreply.git.minetest.land>
2022-05-11 23:33:15 +00:00
Mikita Wiśniewski ac3031c679 Add mod.confs to silence Minetest 5.5 warnings 2022-05-11 07:09:15 +07:00
erlehmann 54f72a1457 Merge pull request 'ITEMS/mcl_farming: Move farming plant nodes 1/16 downwards' (#293) from move-farming-plants-lower into master
Reviewed-on: https://git.minetest.land/Mineclonia/Mineclonia/pulls/293
Reviewed-by: Li0n_2 <li0n_2@noreply.git.minetest.land>
2022-04-30 22:01:30 +00:00
Nils Dagsson Moskopp 0808b54192
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.
2022-04-21 02:45:36 +02:00
Nils Dagsson Moskopp 14cbc63b5f
Render mcl_farming plant grids 1/16 node lower
This patch replaces the plantlike drawtype of mcl_farming plant nodes
that are rendered like a grid (#) with a nodebox drawtype. The nodebox
looks like a plantlike grid shifted 1/16 nodes downwards. The goal is to
remove gaps between plants and farming soil with a node height of 15/16.

This patch affects beetroot, carrots, potatoes, and wheat nodes.
2022-04-21 02:44:45 +02:00
15 changed files with 148 additions and 58 deletions

View File

@ -0,0 +1 @@
name = walkover

View File

@ -0,0 +1 @@
name = mcl_experience

View File

@ -1 +1,2 @@
name = mcl_formspec
description = Helper mod to simplify creation of formspecs a little bit

View File

@ -0,0 +1 @@
name = mcl_tmp_message

View File

@ -18,19 +18,21 @@ minetest.register_node("mcl_farming:beetroot_0", {
_doc_items_longdesc = S("Beetroot plants are plants which grow on farmland under sunlight in 4 stages. On hydrated farmland, they grow a bit faster. They can be harvested at any time but will only yield a profit when mature."),
_doc_items_entry_name = S("Premature Beetroot Plant"),
paramtype = "light",
paramtype2 = "meshoptions",
sunlight_propagates = true,
-- keep place_param2 for plantlike drawtype compatiblity
place_param2 = 3,
walkable = false,
drawtype = "plantlike",
drawtype = "nodebox",
node_box = mcl_farming:get_plantlike_grid_nodebox(),
drop = "mcl_farming:beetroot_seeds",
tiles = {"mcl_farming_beetroot_0.png"},
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_beetroot_0.png") },
use_texture_alpha = "clip",
inventory_image = "mcl_farming_beetroot_0.png",
wield_image = "mcl_farming_beetroot_0.png",
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
{-0.5, -9/16, -0.5, 0.5, -6/16, 0.5}
},
},
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
@ -42,19 +44,21 @@ minetest.register_node("mcl_farming:beetroot_1", {
description = S("Premature Beetroot Plant (Stage 2)"),
_doc_items_create_entry = false,
paramtype = "light",
paramtype2 = "meshoptions",
sunlight_propagates = true,
-- keep place_param2 for plantlike drawtype compatiblity
place_param2 = 3,
walkable = false,
drawtype = "plantlike",
drawtype = "nodebox",
node_box = mcl_farming:get_plantlike_grid_nodebox(),
drop = "mcl_farming:beetroot_seeds",
tiles = {"mcl_farming_beetroot_1.png"},
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_beetroot_1.png") },
use_texture_alpha = "clip",
inventory_image = "mcl_farming_beetroot_1.png",
wield_image = "mcl_farming_beetroot_1.png",
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -3/16, 0.5}
{-0.5, -9/16, -0.5, 0.5, -4/16, 0.5}
},
},
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
@ -66,19 +70,21 @@ minetest.register_node("mcl_farming:beetroot_2", {
description = S("Premature Beetroot Plant (Stage 3)"),
_doc_items_create_entry = false,
paramtype = "light",
paramtype2 = "meshoptions",
sunlight_propagates = true,
-- keep place_param2 for plantlike drawtype compatiblity
place_param2 = 3,
walkable = false,
drawtype = "plantlike",
drawtype = "nodebox",
node_box = mcl_farming:get_plantlike_grid_nodebox(),
drop = "mcl_farming:beetroot_seeds",
tiles = {"mcl_farming_beetroot_2.png"},
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_beetroot_2.png") },
use_texture_alpha = "clip",
inventory_image = "mcl_farming_beetroot_2.png",
wield_image = "mcl_farming_beetroot_2.png",
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 2/16, 0.5}
{-0.5, -9/16, -0.5, 0.5, 1/16, 0.5}
},
},
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
@ -91,11 +97,12 @@ minetest.register_node("mcl_farming:beetroot", {
_doc_items_longdesc = S("A mature beetroot plant is a farming plant which is ready to be harvested for a beetroot and some beetroot seeds. It won't grow any further."),
_doc_items_create_entry = true,
paramtype = "light",
paramtype2 = "meshoptions",
sunlight_propagates = true,
-- keep place_param2 for plantlike drawtype compatiblity
place_param2 = 3,
walkable = false,
drawtype = "plantlike",
drawtype = "nodebox",
node_box = mcl_farming:get_plantlike_grid_nodebox(),
drop = {
--[[ drops 1 beetroot guaranteed.
drops 1-4 beetroot seeds:
@ -112,13 +119,14 @@ minetest.register_node("mcl_farming:beetroot", {
{ items = {"mcl_farming:beetroot_seeds 1"}, rarity = 4 },
},
},
tiles = {"mcl_farming_beetroot_3.png"},
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_beetroot_3.png") },
use_texture_alpha = "clip",
inventory_image = "mcl_farming_beetroot_3.png",
wield_image = "mcl_farming_beetroot_3.png",
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 3/16, 0.5}
{-0.5, -9/16, -0.5, 0.5, 2/16, 0.5}
},
},
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,beetroot=4},

View File

@ -28,18 +28,20 @@ for i=1, 7 do
_doc_items_longdesc = longdesc,
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "meshoptions",
-- keep place_param2 for plantlike drawtype compatiblity
place_param2 = 3,
walkable = false,
drawtype = "plantlike",
drawtype = "nodebox",
node_box = mcl_farming:get_plantlike_grid_nodebox(),
drop = "mcl_farming:carrot_item",
tiles = {texture},
tiles = { mcl_farming:align_plantlike_nodebox_texture(texture) },
use_texture_alpha = "clip",
inventory_image = texture,
wield_image = texture,
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, sel_height, 0.5}
{-0.5, -9/16, -0.5, 0.5, sel_height - 1/16, 0.5}
},
},
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
@ -53,11 +55,13 @@ minetest.register_node("mcl_farming:carrot", {
_doc_items_longdesc = S("Mature carrot plants are ready to be harvested for carrots. They won't grow any further."),
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "meshoptions",
-- keep place_param2 for plantlike drawtype compatiblity
place_param2 = 3,
walkable = false,
drawtype = "plantlike",
tiles = {"farming_carrot_4.png"},
drawtype = "nodebox",
node_box = mcl_farming:get_plantlike_grid_nodebox(),
tiles = { mcl_farming:align_plantlike_nodebox_texture("farming_carrot_4.png") },
use_texture_alpha = "clip",
inventory_image = "farming_carrot_4.png",
wield_image = "farming_carrot_4.png",
drop = {
@ -72,7 +76,7 @@ minetest.register_node("mcl_farming:carrot", {
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 4/16, 0.5}
{-0.5, -9/16, -0.5, 0.5, 3/16, 0.5}
},
},
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},

View File

@ -91,16 +91,18 @@ for s=1,7 do
_doc_items_longdesc = longdesc,
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drawtype = "nodebox",
node_box = mcl_farming:get_plantlike_plus_nodebox(),
sunlight_propagates = true,
drop = stem_drop,
tiles = {texture},
tiles = { mcl_farming:align_plantlike_nodebox_texture(texture) },
use_texture_alpha = "clip",
wield_image = texture,
inventory_image = texture,
selection_box = {
type = "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},

View File

@ -6,13 +6,13 @@ for i=1, 7 do
local texture, selbox
if i < 3 then
texture = "mcl_farming_potatoes_stage_0.png"
selbox = { -0.5, -0.5, -0.5, 0.5, -5/16, 0.5 }
selbox = { -0.5, -9/16, -0.5, 0.5, -6/16, 0.5 }
elseif i < 5 then
texture = "mcl_farming_potatoes_stage_1.png"
selbox = { -0.5, -0.5, -0.5, 0.5, -2/16, 0.5 }
selbox = { -0.5, -9/16, -0.5, 0.5, -3/16, 0.5 }
else
texture = "mcl_farming_potatoes_stage_2.png"
selbox = { -0.5, -0.5, -0.5, 0.5, 2/16, 0.5 }
selbox = { -0.5, -9/16, -0.5, 0.5, 1/16, 0.5 }
end
local create, name, longdesc
@ -33,13 +33,15 @@ for i=1, 7 do
_doc_items_entry_name = name,
_doc_items_longdesc = longdesc,
paramtype = "light",
paramtype2 = "meshoptions",
sunlight_propagates = true,
-- keep place_param2 for plantlike drawtype compatiblity
place_param2 = 3,
walkable = false,
drawtype = "plantlike",
drawtype = "nodebox",
node_box = mcl_farming:get_plantlike_grid_nodebox(),
drop = "mcl_farming:potato_item",
tiles = { texture },
tiles = { mcl_farming:align_plantlike_nodebox_texture(texture) },
use_texture_alpha = "clip",
inventory_image = texture,
wield_image = texture,
selection_box = {
@ -57,12 +59,14 @@ minetest.register_node("mcl_farming:potato", {
description = S("Mature Potato Plant"),
_doc_items_longdesc = S("Mature potato plants are ready to be harvested for potatoes. They won't grow any further."),
paramtype = "light",
paramtype2 = "meshoptions",
sunlight_propagates = true,
-- keep place_param2 for plantlike drawtype compatiblity
place_param2 = 3,
walkable = false,
drawtype = "plantlike",
tiles = {"mcl_farming_potatoes_stage_3.png"},
drawtype = "nodebox",
node_box = mcl_farming:get_plantlike_grid_nodebox(),
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_potatoes_stage_3.png") },
use_texture_alpha = "clip",
wield_image = "mcl_farming_potatoes_stage_3.png",
inventory_image = "mcl_farming_potatoes_stage_3.png",
drop = {
@ -77,7 +81,7 @@ minetest.register_node("mcl_farming:potato", {
selection_box = {
type = "fixed",
fixed = {
{ -0.5, -0.5, -0.5, 0.5, 1/16, 0.5 }
{ -0.5, -9/16, -0.5, 0.5, 0, 0.5 }
}
},
groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},

View File

@ -63,16 +63,18 @@ for s=1,7 do
_doc_items_longdesc = longdesc,
paramtype = "light",
walkable = false,
drawtype = "plantlike",
drawtype = "nodebox",
node_box = mcl_farming:get_plantlike_plus_nodebox(),
sunlight_propagates = true,
drop = stem_drop,
tiles = {texture},
tiles = { mcl_farming:align_plantlike_nodebox_texture(texture) },
use_texture_alpha = "clip",
inventory_image = texture,
wield_image = texture,
selection_box = {
type = "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,},

View File

@ -265,7 +265,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
stem_def.selection_box = {
type = "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
@ -273,7 +273,20 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
stem_def.paramtype = "light"
end
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
if stem_def.walkable == nil then
stem_def.walkable = false
@ -300,7 +313,9 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
minetest.register_node(stem_itemstring, stem_def)
-- Register connected stems
local connected_stem_texture = mcl_farming:align_plantlike_nodebox_texture(
connected_stem_texture
)
local connected_stem_tiles = {
{ "blank.png", --top
"blank.png", -- bottom
@ -332,16 +347,16 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
}
}
local connected_stem_nodebox = {
{-0.5, -0.5, 0, 0.5, 0.5, 0},
{-0.5, -0.5, 0, 0.5, 0.5, 0},
{0, -0.5, -0.5, 0, 0.5, 0.5},
{0, -0.5, -0.5, 0, 0.5, 0.5},
{-0.5, -9/16, 0, 0.5, 7/16, 0},
{-0.5, -9/16, 0, 0.5, 7/16, 0},
{0, -9/16, -0.5, 0, 7/16, 0.5},
{0, -9/16, -0.5, 0, 7/16, 0.5},
}
local connected_stem_selectionbox = {
{-0.1, -0.5, -0.1, 0.5, 0.2, 0.1},
{-0.5, -0.5, -0.1, 0.1, 0.2, 0.1},
{-0.1, -0.5, -0.1, 0.1, 0.2, 0.5},
{-0.1, -0.5, -0.5, 0.1, 0.2, 0.1},
{-0.1, -9/16, -0.1, 0.5, 0.2 - 1/16, 0.1},
{-0.5, -9/16, -0.1, 0.1, 0.2 - 1/16, 0.1},
{-0.1, -9/16, -0.1, 0.1, 0.2 - 1/16, 0.5},
{-0.1, -9/16, -0.5, 0.1, 0.2 - 1/16, 0.1},
}
for i=1, 4 do
@ -469,3 +484,40 @@ minetest.register_lbm({
mcl_farming:grow_plant(identifier, pos, node, false, false, low_speed)
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 (#)
-- 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_grid_nodebox()
return {
type = "fixed",
fixed = {
{ 4/16, -9/16, -8/16, 4/16, 7/16, 8/16},
{-4/16, -9/16, -8/16, -4/16, 7/16, 8/16},
{-8/16, -9/16, -4/16, 8/16, 7/16, -4/16},
{-8/16, -9/16, 4/16, 8/16, 7/16, 4/16},
}
}
end
-- This function takes a texture and returns a modified texture where
-- the bottom row is at the top, assuming 16px × 16px textures. This
-- is used to align textures to a “plantlike” nodebox shifted 1/16
-- below its own node into the empty space above farming soil.
function mcl_farming:align_plantlike_nodebox_texture(texture)
local texture = texture:gsub("%^", "\\%^"):gsub(":", "\\:")
return "[combine:16x16:0,-15=" .. texture .. ":0,1=" .. texture
end

View File

@ -39,19 +39,21 @@ for i=1,7 do
_doc_items_entry_name = name,
_doc_items_longdesc = longdesc,
paramtype = "light",
paramtype2 = "meshoptions",
-- keep place_param2 for plantlike drawtype compatiblity
place_param2 = 3,
sunlight_propagates = true,
walkable = false,
drawtype = "plantlike",
drawtype = "nodebox",
node_box = mcl_farming:get_plantlike_grid_nodebox(),
drop = "mcl_farming:wheat_seeds",
tiles = {"mcl_farming_wheat_stage_"..(i-1)..".png"},
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_wheat_stage_"..(i-1)..".png") },
use_texture_alpha = "clip",
inventory_image = "mcl_farming_wheat_stage_"..(i-1)..".png",
wield_image = "mcl_farming_wheat_stage_"..(i-1)..".png",
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, sel_heights[i], 0.5}
{-0.5, -9/16, -0.5, 0.5, sel_heights[i] - 1/16, 0.5}
},
},
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1},
@ -65,13 +67,21 @@ minetest.register_node("mcl_farming:wheat", {
_doc_items_longdesc = S("Mature wheat plants are ready to be harvested for wheat and wheat seeds. They won't grow any further."),
sunlight_propagates = true,
paramtype = "light",
paramtype2 = "meshoptions",
-- keep place_param2 for plantlike drawtype compatiblity
place_param2 = 3,
walkable = false,
drawtype = "plantlike",
tiles = {"mcl_farming_wheat_stage_7.png"},
drawtype = "nodebox",
node_box = mcl_farming:get_plantlike_grid_nodebox(),
tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_wheat_stage_7.png") },
use_texture_alpha = "clip",
inventory_image = "mcl_farming_wheat_stage_7.png",
wield_image = "mcl_farming_wheat_stage_7.png",
selection_box = {
type = "fixed",
fixed = {
{ -0.5, -9/16, -0.5, 0.5, 7/16, 0.5 }
}
},
drop = {
max_items = 4,
items = {

View File

@ -0,0 +1 @@
name = screwdriver

View File

@ -0,0 +1 @@
name = mcl_engine_workarounds

View File

@ -0,0 +1 @@
name = mcl_selftests

View File

@ -0,0 +1 @@
name = mcl_player