Compare commits

...

24 Commits

Author SHA1 Message Date
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. 20e44e4033 Merge pull request 'Add mod.confs to silence Minetest 5.5 warnings' (#298) from rudzik8/Mineclonia:add-mod-confs into master
Reviewed-on: Mineclonia/Mineclonia#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
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. 54f72a1457 Merge pull request 'ITEMS/mcl_farming: Move farming plant nodes 1/16 downwards' (#293) from move-farming-plants-lower into master
Reviewed-on: Mineclonia/Mineclonia#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
Nils Dagsson Moskopp de8ea11b39
Add debug command to spawn mcl_farming plant nodes
This patch adds the debug command “/generate_farming_plant_rows”. The
command generates rows of plants and stems per plant type near a player.
A farming soil or glass node is placed below each node, so players can
find and examine possible gaps between a plant node and a node below.
2022-04-18 21:43:21 +02:00
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. 1ce88e7528 Merge pull request 'ITEMS/mcl_tnt: Add setting for TNT drop rate (default 100%)' (#291) from add-tnt-drop-rate-setting into master
Reviewed-on: Mineclonia/Mineclonia#291
Reviewed-by: Li0n_2 <li0n_2@noreply.git.minetest.land>
2022-04-18 19:36:10 +00:00
Nils Dagsson Moskopp 6e11819b79
Increase TNT drop rate to 100%
This makes the TNT drop rate match Minecraft 1.14.
2022-04-17 18:44:09 +02:00
Nils Dagsson Moskopp 5acc9191fa
Add setting for TNT drop rate 2022-04-17 18:42:46 +02:00
Nils Dagsson Moskopp 32d89d6d5f
Add TNT test structure
This patch adds a new test structure to the “/spawnstruct” command which
can be spawned with this command: /spawnstruct test_structure_tnt

The structure was added to reduce manual work when examining or
verifying TNT explosion results after changes to TNT drop rate.
2022-04-17 17:24:54 +02:00
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. d2c335d8fb Merge pull request 'ITEMS/mcl_farming: Use uncarved pumpkin in survival' (#285) from uncarved-pumpkin-4 into master
Reviewed-on: Mineclonia/Mineclonia#285
Reviewed-by: Li0n_2 <li0n_2@noreply.git.minetest.land>
2022-04-15 22:51:58 +00:00
Nils Dagsson Moskopp 7d2ef66175
Trigger node callbacks when pumpkin is sheared
The code for shearing a pumpkin used minetest.swap_node() to replace a
faceless pumpkin with a carved pumpkin. This did not trigger the node
callbacks of the carved pumpkin, which meant that shearing a pumpkin
would not check for the snow golem or iron golem spawn conditions.

This patch replaces minetest.swap_node() in the code for shearing a
pumpkin with minetest.set_node(), which does trigger the callbacks;
therefore snow and iron golems can now spawn as a pumpkin is carved.
2022-04-14 18:52:31 +02:00
Nils Dagsson Moskopp fdd3c5db86
Drop carved pumpkin when shearing snow golem 2022-04-14 00:23:01 +02:00
Nils Dagsson Moskopp c4912effaf
Disconnect gourd stems after destruct
While testing the previous commit, it became clear that gourd stems do
not disconnect properly if the gourd disappears while not being dug. A
simple method to create illegal curved stems was to explode the gourd.

This patch changes gourds so that the stem curves back after a gourd is
destroyed, regardless of reason. This hopefully makes curved stems that
are not connected to matching gourds a relict of the past.
2022-04-14 00:23:01 +02:00
Nils Dagsson Moskopp 1967e10a52
Disconnect stems from carved pumpkins after dig
Carved pumpkins can end up being connected to a stem – either if they
were grown in a previous version of MineClone2 or Mineclonia, or if a
player carves them before harvesting them. This patch makes sure that
stems turn into unconnected stems after such a carved pumpkin is dug.
2022-04-14 00:23:00 +02:00
Nils Dagsson Moskopp f8d55ee61b
Make villagers accept uncarved pumpkin in trades
As map generation and growing mechanics have been changed to generate
uncarved pumpkins instead of carved, requiring players to shear every
pumpkin before trading it with villagers seems like useless busywork.
2022-04-14 00:23:00 +02:00
Nils Dagsson Moskopp 3948a0e7af
Remove pumpkin pie recipe with carved pumpkin
Shearing an uncarved pumpkin turns it into a carved pumpkin and drops
four pumpkin seeds. As map generation and growing mechanics have been
changed to generate uncarved pumpkins instead of carved, preserving a
recipe to get pumpkin pie from carved pumpkins enabled players to get
both seeds and pumpkin pie from grown pumpkins, which was unintended.
2022-04-14 00:22:59 +02:00
Nils Dagsson Moskopp a44fd9c88b
Remove pumpkin seeds recipe with carved pumpkin
Shearing an uncarved pumpkin turns it into a carved pumpkin and drops
four pumpkin seeds. As map generation and growing mechanics have been
changed to generate uncarved pumpkins instead of carved, preserving a
recipe to get seeds from carved pumpkins enables players to get twice
the amount of seeds as intended. Because of this, the recipe must go.
2022-04-14 00:22:59 +02:00
Alexander Minges 6381d65dbb
Use correct location for pumpkin shearing sound
The code for turning an uncarved pumpkin into a carved pumpkin using
the shears was using “above” instead of “pointed_thing.above” as the
location for its sound. This resulted in a warning being logged when
shears were being used on a pumpkin. This patch rectifies the issue.
2022-04-14 00:22:59 +02:00
Alexander Minges 59b013f766
Grow uncarved pumpkin from seeds instead of carved
Carved pumpkin has to be explicitly registered as a separate node, as
registering a carved pumpkin node happened as a side effect of invoking
mcl_farming:add_gourd() for the carved pumpkin.

The iron / snow golem spawning checks that trigger whenever a carved
pumpkin is placed had to be moved out of the mcl_farming:add_gourd()
invocation to preserve the existing behaviour.

Note that uncarved pumpkin must not be registered as a separate node,
as invoking mcl_farming:add_gourd() for a registered node name leads to
stems not updating when an adjacent node is manually placed or mined.
2022-04-14 00:22:58 +02:00
Alexander Minges d59888c4df
Use uncarved pumpkin instead of carved in mapgen 2022-04-14 00:22:58 +02:00
cora 8810a24ce0 Merge pull request 'ITEMS/REDSTONE/mcl_comparators: Fix redstone comparator flooding crash' (#284) from fix-comparator-cauldron-water-crash into master
Reviewed-on: Mineclonia/Mineclonia#284
Reviewed-by: cora <cora@noreply.git.minetest.land>
2022-02-23 22:30:44 +00:00
Nils Dagsson Moskopp be915478af
Fix redstone comparator flooding crash
Redstone comparators have two modes, comparison mode & subtraction mode.
Before this patch, the functions to turn comparators on or off attempted
to swap nodes with comparators in the same mode, but failed to determine
the correct replacement node, if the existing node was not a comparator.

When a comparator in an on state (e.g. powered by a filled cauldron) was
flooded, the flooding dropped the comparator and replaced the comparator
node that was to be swapped out with air, which lead to a server crash.

This patch changes the functions that turn comparators on or off so they
only swap existing nodes with comparators in the same mode if the name
of the replacement node can be determined – i.e. if it is not nil.
2022-02-23 00:27:56 +01:00
Nils Dagsson Moskopp d9764fdac6
Add comparator test structure
This patch adds a new test structure to the “/spawnstruct” command which
can be spawned with this command: /spawnstruct test_structure_comparator

The structure was added to reduce manual work when examining or
verifying comparator behaviour after changes to comparator code.
2022-02-22 23:48:10 +01:00
27 changed files with 268 additions and 87 deletions

View File

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

View File

@ -123,6 +123,10 @@ mobs:register_mob("mobs_mc:snowman", {
local pos = self.object:get_pos()
minetest.sound_play("mcl_tools_shears_cut", {pos = pos}, true)
if minetest.registered_items["mcl_farming:pumpkin_face"] then
minetest.add_item({x=pos.x, y=pos.y+1.4, z=pos.z}, "mcl_farming:pumpkin_face")
end
-- Wear out
if not minetest.is_creative_enabled(clicker:get_player_name()) then
item:add_wear(mobs_mc.misc.shears_wear)

View File

@ -74,7 +74,7 @@ local professions = {
},
{
{ { "mcl_farming:pumpkin_face", 8, 13 }, E1 },
{ { "mcl_farming:pumpkin", 8, 13 }, E1 },
{ E1, { "mcl_farming:pumpkin_pie", 2, 3} },
},

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

@ -43,14 +43,20 @@ end
local comparator_activate = function(pos, node)
local def = minetest.registered_nodes[node.name]
minetest.swap_node(pos, { name = def.comparator_onstate, param2 = node.param2 })
local onstate = def.comparator_onstate
if onstate then
minetest.swap_node(pos, { name = onstate, param2 = node.param2 })
end
minetest.after(0.1, comparator_turnon , {pos = pos, node = node})
end
local comparator_deactivate = function(pos, node)
local def = minetest.registered_nodes[node.name]
minetest.swap_node(pos, { name = def.comparator_offstate, param2 = node.param2 })
local offstate = def.comparator_offstate
if offstate then
minetest.swap_node(pos, { name = offstate, param2 = node.param2 })
end
minetest.after(0.1, comparator_turnoff, {pos = pos, node = node})
end

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

@ -27,3 +27,73 @@ dofile(minetest.get_modpath("mcl_farming").."/potatoes.lua")
-- ========= BEETROOT =========
dofile(minetest.get_modpath("mcl_farming").."/beetroot.lua")
-- This function generates a row of plantlike and nodebox nodes whose
-- name starts with a given string, starting at a given position. It
-- places a given node below so that the rendering can be examined.
local function generate_plant_row(prefix, pos, below_node)
local i = 1
for node_name, node in pairs(minetest.registered_nodes) do
if (
1 == node_name:find(prefix) and
(
"plantlike" == node.drawtype or
"nodebox" == node.drawtype
)
) then
local node_pos = {
x = pos.x + i,
y = pos.y,
z = pos.z,
}
minetest.set_node(
node_pos,
{
name = node_name,
param2 = node.place_param2 or 0
}
)
local below_pos = {
x = node_pos.x,
y = node_pos.y - 1,
z = node_pos.z
}
minetest.set_node(
below_pos,
below_node
)
i = i + 1
end
end
end
minetest.register_chatcommand("generate_farming_plant_rows",{
description = "Generates rows of mcl_farming plant nodes on farming soil and glass",
privs = { debug = true },
func = function(name, param)
local player = minetest.get_player_by_name(name)
local pos = player:get_pos()
local node_prefixes = {
"mcl_farming:beetroot",
"mcl_farming:carrot",
"mcl_farming:melon",
"mcl_farming:potato",
"mcl_farming:pumpkin",
"mcl_farming:wheat",
}
for i,node_prefix in ipairs(node_prefixes) do
generate_plant_row(
node_prefix,
pos,
{ name = "mcl_farming:soil" }
)
pos.z = pos.z + 2
generate_plant_row(
node_prefix,
pos,
{ name = "mcl_core:glass" }
)
pos.z = pos.z + 2
end
end
})

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,},
@ -104,7 +106,6 @@ local pumpkin_base_def = {
_mcl_blast_resistance = 1,
_mcl_hardness = 1,
}
minetest.register_node("mcl_farming:pumpkin", pumpkin_base_def)
local pumpkin_face_base_def = table.copy(pumpkin_base_def)
pumpkin_face_base_def.description = S("Pumpkin")
@ -115,6 +116,11 @@ pumpkin_face_base_def.groups.armor_head=1
pumpkin_face_base_def._mcl_armor_mob_range_factor = 0
pumpkin_face_base_def._mcl_armor_mob_range_mob = "mobs_mc:enderman"
pumpkin_face_base_def.groups.non_combat_armor=1
pumpkin_face_base_def.on_construct = function(pos)
-- Attempt to spawn iron golem or snow golem
mobs_mc.tools.check_iron_golem_summon(pos)
mobs_mc.tools.check_snow_golem_summon(pos)
end
if minetest.get_modpath("mcl_armor") then
pumpkin_face_base_def.on_secondary_use = armor.on_armor_use
end
@ -123,12 +129,11 @@ end
mcl_farming:add_plant("plant_pumpkin_stem", "mcl_farming:pumpkintige_unconnect", {"mcl_farming:pumpkin_1", "mcl_farming:pumpkin_2", "mcl_farming:pumpkin_3", "mcl_farming:pumpkin_4", "mcl_farming:pumpkin_5", "mcl_farming:pumpkin_6", "mcl_farming:pumpkin_7"}, 30, 5)
-- Register actual pumpkin, connected stems and stem-to-pumpkin growth
mcl_farming:add_gourd("mcl_farming:pumpkintige_unconnect", "mcl_farming:pumpkintige_linked", "mcl_farming:pumpkintige_unconnect", stem_def, stem_drop, "mcl_farming:pumpkin_face", pumpkin_face_base_def, 30, 15, "mcl_farming_pumpkin_stem_connected.png^[colorize:#FFA800:127",
function(pos)
-- Attempt to spawn iron golem or snow golem
mobs_mc.tools.check_iron_golem_summon(pos)
mobs_mc.tools.check_snow_golem_summon(pos)
end)
mcl_farming:add_gourd("mcl_farming:pumpkintige_unconnect", "mcl_farming:pumpkintige_linked", "mcl_farming:pumpkintige_unconnect", stem_def, stem_drop, "mcl_farming:pumpkin", pumpkin_base_def, 30, 15, "mcl_farming_pumpkin_stem_connected.png^[colorize:#FFA800:127")
-- Steal function to properly disconnect a carved pumpkin
pumpkin_face_base_def.after_destruct = minetest.registered_nodes["mcl_farming:pumpkin"].after_destruct
minetest.register_node("mcl_farming:pumpkin_face", pumpkin_face_base_def)
-- Jack o'Lantern
minetest.register_node("mcl_farming:pumpkin_face_light", {
@ -165,11 +170,6 @@ minetest.register_craft({
recipe = {{"mcl_farming:pumpkin"}}
})
minetest.register_craft({
output = "mcl_farming:pumpkin_seeds 4",
recipe = {{"mcl_farming:pumpkin_face"}}
})
minetest.register_craftitem("mcl_farming:pumpkin_pie", {
description = S("Pumpkin Pie"),
_doc_items_longdesc = S("A pumpkin pie is a tasty food item which can be eaten."),
@ -187,11 +187,6 @@ minetest.register_craft({
output = "mcl_farming:pumpkin_pie",
recipe = {"mcl_farming:pumpkin", "mcl_core:sugar", "mcl_throwing:egg"},
})
minetest.register_craft({
type = "shapeless",
output = "mcl_farming:pumpkin_pie",
recipe = {"mcl_farming:pumpkin_face", "mcl_core:sugar", "mcl_throwing:egg"},
})
if minetest.get_modpath("doc") then

View File

@ -178,7 +178,7 @@ end
- stem_def: Partial node definition of the fully-grown unconnected stem node. Many fields are already defined. You need to add `tiles` and `description` at minimum. Don't define on_construct without good reason
- stem_drop: Drop probability table for all stem
- gourd_itemstring: Desired itemstring of the full gourd node
- gourd_def: (almost) full definition of the gourd node. This function will add on_construct and after_dig_node to the definition for unconnecting any connected stems
- gourd_def: (almost) full definition of the gourd node. This function will add on_construct and after_destruct to the definition for unconnecting any connected stems
- grow_interval: Will attempt to grow a gourd periodically at this interval in seconds
- grow_chance: Chance of 1/grow_chance to grow a gourd next to the full unconnected stem after grow_interval has passed. Must be a natural number
- connected_stem_texture: Texture of the connected stem
@ -228,8 +228,8 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
end
-- Register gourd
if not gourd_def.after_dig_node then
gourd_def.after_dig_node = function(blockpos, oldnode, oldmetadata, user)
if not gourd_def.after_destruct then
gourd_def.after_destruct = function(blockpos, oldnode)
-- Disconnect any connected stems, turning them back to normal stems
for n=1, #neighbors do
local offset = neighbors[n]
@ -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

@ -1,4 +1,5 @@
local S = minetest.get_translator("mcl_tnt")
local tnt_drop_rate = tonumber(minetest.settings:get("mcl_tnt_drop_rate") or 1.0)
local tnt_griefing = minetest.settings:get_bool("mcl_tnt_griefing", true)
local mod_death_messages = minetest.get_modpath("mcl_death_messages")
@ -180,7 +181,7 @@ function TNT:on_step(dtime)
self.blinkstatus = not self.blinkstatus
end
if self.timer > tnt.BOOMTIMER then
mcl_explosions.explode(self.object:get_pos(), 4, {}, self.object)
mcl_explosions.explode(self.object:get_pos(), 4, { drop_chance = tnt_drop_rate }, self.object)
self.object:remove()
end
end

View File

@ -232,10 +232,10 @@ if minetest.get_modpath("mcl_farming") then
local wear = mcl_autogroup.get_wear(toolname, "shearsy")
itemstack:add_wear(wear)
end
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above}, true)
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = pointed_thing.above}, true)
local dir = vector.subtract(pointed_thing.under, pointed_thing.above)
local param2 = minetest.dir_to_facedir(dir)
minetest.swap_node(pointed_thing.under, {name="mcl_farming:pumpkin_face", param2 = param2})
minetest.set_node(pointed_thing.under, {name="mcl_farming:pumpkin_face", param2 = param2})
minetest.add_item(pointed_thing.above, "mcl_farming:pumpkin_seeds 4")
end
return itemstack

View File

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

View File

@ -3532,7 +3532,7 @@ local function register_decorations()
-- Pumpkin
minetest.register_decoration({
deco_type = "simple",
decoration = "mcl_farming:pumpkin_face",
decoration = "mcl_farming:pumpkin",
param2 = 0,
param2_max = 3,
place_on = {"group:grass_block_no_snow"},

View File

@ -868,7 +868,7 @@ local function register_mgv6_decorations()
-- Pumpkin
minetest.register_decoration({
deco_type = "simple",
decoration = "mcl_farming:pumpkin_face",
decoration = "mcl_farming:pumpkin",
param2 = 0,
param2_max = 3,
place_on = {"group:grass_block_no_snow"},

View File

@ -532,14 +532,24 @@ local function dir_to_rotation(dir)
return "0"
end
mcl_structures.generate_test_structure_comparator = function(pos, rotation, pr)
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_test_structure_comparator.mts"
mcl_structures.place_schematic(pos, path, rotation, nil, true, nil, nil, pr)
end
mcl_structures.generate_test_structure_fireproof = function(pos, rotation, pr)
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_test_structure_fireproof.mts"
mcl_structures.place_schematic(pos, path, rotation, nil, true, nil, nil, pr)
end
mcl_structures.generate_test_structure_tnt = function(pos, rotation, pr)
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_test_structure_tnt.mts"
mcl_structures.place_schematic(pos, path, rotation, nil, true, nil, nil, pr)
end
-- Debug command
minetest.register_chatcommand("spawnstruct", {
params = "desert_temple | desert_well | igloo | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_portal_shrine | test_structure_fireproof",
params = "desert_temple | desert_well | igloo | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_portal_shrine | test_structure_comparator | test_structure_fireproof | test_structure_tnt",
description = S("Generate a pre-defined structure near your position."),
privs = {debug = true},
func = function(name, param)
@ -573,8 +583,12 @@ minetest.register_chatcommand("spawnstruct", {
mcl_structures.generate_end_exit_portal(pos, rot, pr)
elseif param == "end_portal_shrine" then
mcl_structures.generate_end_portal_shrine(pos, rot, pr)
elseif param == "test_structure_comparator" then
mcl_structures.generate_test_structure_comparator(pos, rot, pr)
elseif param == "test_structure_fireproof" then
mcl_structures.generate_test_structure_fireproof(pos, rot, pr)
elseif param == "test_structure_tnt" then
mcl_structures.generate_test_structure_tnt(pos, rot, pr)
elseif param == "" then
message = S("Error: No structure type given. Please use “/spawnstruct <type>”.")
errord = true

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

View File

@ -24,6 +24,9 @@ mcl_doWeatherCycle (Change weather) bool true
# Note that blocks never have drops when in Creative Mode.
mcl_doTileDrops (Blocks have drops) bool true
# Chance of a node destroyed by a TNT explosion to be dropped as an item
mcl_tnt_drop_rate (TNT drop rate) float 1.0 0.0 1.0
# If enabled, TNT explosions destroy blocks.
mcl_tnt_griefing (TNT destroys blocks) bool true