Merge pull request 'Fix the Pumpkin/Melon grass position.' (#2973) from gourd_fix into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2973
Reviewed-by: cora <cora@noreply.git.minetest.land>
This commit is contained in:
cora 2022-11-17 01:24:36 +00:00
commit cdf28ec684
2 changed files with 85 additions and 95 deletions

@ -1,16 +1,12 @@
===FARMING MOD for MINETEST-C55=== ===FARMING MOD for MINETEST-C55===
by PilzAdam by PilzAdam
Modified heavily by MineClone 2 Dev Team.
Introduction: Introduction:
This mod adds farming to Minetest. This mod adds farming to Minetest.
How to install: How to install see:
Unzip the archive an place it in minetest-base-directory/mods/minetest/
if you have a windows client or a linux run-in-place client. If you have
a linux system-wide instalation place it in ~/.minetest/mods/minetest/.
If you want to install this mod only in one world create the folder
worldmods/ in your worlddirectory.
For further information or help see:
http://wiki.minetest.com/wiki/Installing_Mods http://wiki.minetest.com/wiki/Installing_Mods
How to use the mod: How to use the mod:
@ -25,22 +21,8 @@ For further information or help see:
http://minetest.net/forum/viewtopic.php?id=2787 http://minetest.net/forum/viewtopic.php?id=2787
License: License:
Sourcecode: WTFPL (see below) Sourcecode: CC-BY-SA 4 (see below)
Graphics: WTFPL (see below) Graphics: CC-BY-SA 4 (see below)
See also: See also:
http://minetest.net/ http://minetest.net/
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

@ -179,7 +179,7 @@ end
--[[ Helper function to create a gourd (e.g. melon, pumpkin), the connected stem nodes as --[[ Helper function to create a gourd (e.g. melon, pumpkin), the connected stem nodes as
- full_unconnected_stem: itemstring of the full-grown but unconnceted stem node. This node must already be done - full_unconnected_stem: itemstring of the full-grown but unconnected stem node. This node must already be done
- connected_stem_basename: prefix of the itemstrings used for the 4 connected stem nodes to create - connected_stem_basename: prefix of the itemstrings used for the 4 connected stem nodes to create
- stem_itemstring: Desired itemstring of the fully-grown unconnected stem node - stem_itemstring: Desired itemstring of the fully-grown unconnected stem node
- 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_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
@ -399,7 +399,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
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 } floorpos = vector.offset (blockpos, 0, -1,0) -- replaces { x = blockpos.x, y = blockpos.y - 1, z = blockpos.z }
floor = minetest.get_node(floorpos) 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")
@ -434,7 +434,15 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
else else
minetest.add_node(blockpos, { name = gourd_itemstring }) minetest.add_node(blockpos, { name = gourd_itemstring })
end end
-- Reset farmland, etc. to dirt when the gourd grows on top -- Reset farmland, etc. to dirt when the gourd grows on top
-- FIXED: The following 2 lines were missing, and wasn't being set (outside of the above loop that
-- finds the neighbors.)
-- FYI - don't factor this out thinking that the loop above is setting the positions correctly.
floorpos = vector.offset (blockpos, 0, -1,0) -- replaces { x = blockpos.x, y = blockpos.y - 1, z = blockpos.z }
floor = minetest.get_node(floorpos)
-- END OF FIX -------------------------------------
if minetest.get_item_group(floor.name, "dirtifies_below_solid") == 1 then if minetest.get_item_group(floor.name, "dirtifies_below_solid") == 1 then
minetest.set_node(floorpos, { name = "mcl_core:dirt" }) minetest.set_node(floorpos, { name = "mcl_core:dirt" })
end end