Compare commits

..

4 Commits

Author SHA1 Message Date
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. 23f1c51912 Merge pull request 'ITEMS/mcl_farming: Convert correct floor node to dirt as gourd grows' (#231) from fix-gourd-farmland-dirtification into master
Reviewed-on: Mineclonia/Mineclonia#231
Reviewed-by: Li0n_2 <li0n_2@noreply.git.minetest.land>
2022-01-15 22:07:24 +00:00
Nils Dagsson Moskopp 4d02af8c94
Convert correct floor node to dirt as gourd grows
Before this patch, growing a gourd (e.g. melon, pumpkin) would always
convert a node west of the node below the stem to dirt if belonged to
the group “dirtifies_below_solid”. This happened because of a loop in
which the variables floorpos and floor were re-used without setting a
new value … therefore, both floorpos and floor were always containing
the last values set in a previous loop instead of the correct values.

This patch fixes the problem by setting both variables in both loops.
2022-01-13 07:29:57 +01:00
Li0n_2 7ede0ca79a Merge pull request 'Fix shearsy wool typo in GROUPS.md' (#229) from JosiahWI/Mineclonia:fix-groups-typo into master
Reviewed-on: Mineclonia/Mineclonia#229
Reviewed-by: Li0n_2 <li0n_2@noreply.git.minetest.land>
2022-01-12 21:19:10 +00:00
JosiahWI e2e7e15b39
fix one character typo in GROUPS.md 2022-01-12 11:09:07 -06:00
3 changed files with 19 additions and 28 deletions

View File

@ -21,7 +21,7 @@ The basic digging time groups determine by which tools a node can be dug.
* `swordy=1`: Diggable by sword (any material), and this node is *not* a cobweb * `swordy=1`: Diggable by sword (any material), and this node is *not* a cobweb
* `swordy_cobweb=1`: Diggable by sword (any material), and this node is a cobweb * `swordy_cobweb=1`: Diggable by sword (any material), and this node is a cobweb
* `shearsy=1`: Diggable by shears, and this node is *not* wool * `shearsy=1`: Diggable by shears, and this node is *not* wool
* `shearsy=wool=1`: Diggable by shears, and this node is wool * `shearsy_wool=1`: Diggable by shears, and this node is wool
* `handy=1`: Breakable by hand and this node gives it useful drop when dug by hand. All nodes which are breakable by pickaxe, axe, shovel, sword or shears are also automatically breakable by hand, but not neccess * `handy=1`: Breakable by hand and this node gives it useful drop when dug by hand. All nodes which are breakable by pickaxe, axe, shovel, sword or shears are also automatically breakable by hand, but not neccess
* `creative_breakable=1`: Block is breakable by hand in creative mode. This group is implied if the node belongs to any other digging group * `creative_breakable=1`: Block is breakable by hand in creative mode. This group is implied if the node belongs to any other digging group

View File

@ -149,22 +149,19 @@ minetest.register_craftitem("mcl_enchanting:book_enchanted", {
minetest.register_alias("mcl_books:book_enchanted", "mcl_enchanting:book_enchanted") minetest.register_alias("mcl_books:book_enchanted", "mcl_enchanting:book_enchanted")
local spawn_book_entity = function(pos, respawn) local spawn_book_entity = function(pos, respawn)
local cnt=0 if respawn then
-- Check if we already have books within 5 nodes distance to avoid too many entities -- Check if we already have a book
local objs = minetest.get_objects_inside_radius(pos, 5) local objs = minetest.get_objects_inside_radius(pos, 1)
for o=1, #objs do for o=1, #objs do
local obj = objs[o] local obj = objs[o]
local lua = obj:get_luaentity() local lua = obj:get_luaentity()
if lua and lua.name == "mcl_enchanting:book" then if lua and lua.name == "mcl_enchanting:book" then
if respawn and lua._table_pos and vector.equals(pos, lua._table_pos) then if lua._table_pos and vector.equals(pos, lua._table_pos) then
return return
end
end end
cnt=cnt+1
end end
end end
if cnt > 10 then return end
local obj = minetest.add_entity(vector.add(pos, mcl_enchanting.book_offset), "mcl_enchanting:book") local obj = minetest.add_entity(vector.add(pos, mcl_enchanting.book_offset), "mcl_enchanting:book")
if obj then if obj then
local lua = obj:get_luaentity() local lua = obj:get_luaentity()
@ -195,8 +192,8 @@ minetest.register_entity("mcl_enchanting:book", {
local old_player_near = self._player_near local old_player_near = self._player_near
local player_near = false local player_near = false
local player local player
for _,obj in pairs(minetest.get_connected_players()) do for _, obj in ipairs(minetest.get_objects_inside_radius(vector.subtract(self.object:get_pos(), mcl_enchanting.book_offset), 2.5)) do
if vector.distance(obj:get_pos(),self.object:get_pos()) < 2.5 then if obj:is_player() then
player_near = true player_near = true
player = obj player = obj
end end
@ -213,13 +210,6 @@ minetest.register_entity("mcl_enchanting:book", {
end end
self._player_near = player_near self._player_near = player_near
mcl_enchanting.check_animation_schedule(self, dtime) mcl_enchanting.check_animation_schedule(self, dtime)
if self._table_pos then
local tn=minetest.get_node_or_nil(self._table_pos)
if tn and tn.name ~= "mcl_enchanting:table" then
self.object:remove()
end
end
end, end,
}) })
@ -319,8 +309,8 @@ minetest.register_abm({
nodenames = "mcl_enchanting:table", nodenames = "mcl_enchanting:table",
action = function(pos) action = function(pos)
local playernames = {} local playernames = {}
for _,obj in pairs(minetest.get_connected_players()) do for _, obj in ipairs(minetest.get_objects_inside_radius(pos, 15)) do
if vector.distance(obj:get_pos(),pos) < 15 then if obj:is_player() then
table.insert(playernames, obj:get_player_name()) table.insert(playernames, obj:get_player_name())
end end
end end

View File

@ -388,12 +388,11 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
{ x=0, y=0, z=-1 }, { x=0, y=0, z=-1 },
{ x=0, y=0, z=1 }, { x=0, y=0, z=1 },
} }
local floorpos, floor
for n=#neighbors, 1, -1 do for n=#neighbors, 1, -1 do
local offset = neighbors[n] local offset = neighbors[n]
local blockpos = vector.add(stempos, offset) local blockpos = vector.add(stempos, offset)
floorpos = { x=blockpos.x, y=blockpos.y-1, z=blockpos.z } local floorpos = { x=blockpos.x, y=blockpos.y-1, z=blockpos.z }
floor = minetest.get_node(floorpos) local floor = minetest.get_node(floorpos)
local block = minetest.get_node(blockpos) local block = minetest.get_node(blockpos)
local soilgroup = minetest.get_item_group(floor.name, "soil") local soilgroup = minetest.get_item_group(floor.name, "soil")
if not ((minetest.get_item_group(floor.name, "grass_block") == 1 or floor.name=="mcl_core:dirt" or soilgroup == 2 or soilgroup == 3) and block.name == "air") then if not ((minetest.get_item_group(floor.name, "grass_block") == 1 or floor.name=="mcl_core:dirt" or soilgroup == 2 or soilgroup == 3) and block.name == "air") then
@ -407,6 +406,8 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
local r = math.random(1, #neighbors) local r = math.random(1, #neighbors)
local offset = neighbors[r] local offset = neighbors[r]
local blockpos = vector.add(stempos, offset) local blockpos = vector.add(stempos, offset)
local floorpos = { x=blockpos.x, y=blockpos.y-1, z=blockpos.z }
local floor = minetest.get_node(floorpos)
local p2 local p2
if offset.x == 1 then if offset.x == 1 then
minetest.set_node(stempos, {name=connected_stem_names[1]}) minetest.set_node(stempos, {name=connected_stem_names[1]})