ITEMS/mcl_farming: Convert correct floor node to dirt as gourd grows #231

Merged
erlehmann merged 1 commits from fix-gourd-farmland-dirtification into master 2022-01-15 23:07:26 +01:00
Owner
Problem

TRACKING ISSUE: #227

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.

Solution

This patch fixes the problem by setting both variables in both loops.

Details

It seems to me that growing gourds was never properly tested.

Testing Steps
Prerequisites
  • 60 farming soil (mcl_farming:soil)
  • 10 melon seeds (mcl_farming:melon_seeds)
  • 10 pumpkin seeds (mcl_farming:pumpkin_seeds)
  • 40 bonemeal (mcl_dye:white)
  • A location with lots of water, ideally a lake or ocean.
Verify Bug

This step is not necessary for this PR, as it has been verified that the bug exists in Mineclonia.

Other users of the farming mod (MCL2, MCL5) should verify the behaviour themselves using this step.

  1. Enter a Minetest world in Minetest 5.4.1 with Mineclonia commit 7ede0ca79a in singleplayer survival mode.
  2. Create two 3×10 rectangles out of farming soil nodes in the overworld at a place where each farming soil node can receive sunlight and is not more than 4 nodes away from water. The longer side of the rectangles must be aligned with the north-south axis.
  3. Plant 10 melon seeds in a line along the middle of one rectangle.
  4. Plant 10 pumpkin seeds in a line along the middle of the other rectangle.
  5. Use bonemeal twice on each seed/plant to create fully grown stems.
  6. Wait for several melons and pumpkins to grow. This may take a while.
  7. Verify that some farmland that was never below a melon or pumpkin has been turned to dirt.
Verify Patch
  1. Enter a Minetest world in Minetest 5.4.1 with Mineclonia commit 4d02af8c94 in singleplayer survival mode.
  2. Create two 3×10 rectangles out of farming soil nodes in the overworld at a place where the each farming soil node can receive sunlight and is not more than 4 nodes away from water. The longer side of the rectangles must be aligned with the north-south axis.
  3. Plant 10 melon seeds in a line along the middle of one rectangle.
  4. Plant 10 pumpkin seeds in a line along the middle of the other rectangle.
  5. Use bonemeal twice on each seed/plant to create fully grown stems.
  6. Wait for several melons and pumpkins to grow. This may take a while.
  7. Verify that only farmland below melons and pumpkins has been turned to dirt.
##### Problem TRACKING ISSUE: https://git.minetest.land/Mineclonia/Mineclonia/issues/227 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. ##### Solution This patch fixes the problem by setting both variables in both loops. ##### Details It seems to me that growing gourds was never properly tested. ##### Testing Steps ###### Prerequisites * 60 farming soil (`mcl_farming:soil`) * 10 melon seeds (`mcl_farming:melon_seeds`) * 10 pumpkin seeds (`mcl_farming:pumpkin_seeds`) * 40 bonemeal (`mcl_dye:white`) * A location with lots of water, ideally a lake or ocean. ###### Verify Bug This step is not necessary for this PR, as it has been verified that the bug exists in Mineclonia. Other users of the farming mod (MCL2, MCL5) should verify the behaviour themselves using this step. 1. Enter a Minetest world in Minetest 5.4.1 with Mineclonia commit 7ede0ca79a933cba6deb0b0cbaf11bd2e4536eb9 in singleplayer survival mode. 2. Create two 3×10 rectangles out of farming soil nodes in the overworld at a place where each farming soil node can receive sunlight and is not more than 4 nodes away from water. The longer side of the rectangles must be aligned with the north-south axis. 3. Plant 10 melon seeds in a line along the middle of one rectangle. 4. Plant 10 pumpkin seeds in a line along the middle of the other rectangle. 5. Use bonemeal twice on each seed/plant to create fully grown stems. 6. Wait for several melons and pumpkins to grow. This may take a while. 7. Verify that some farmland that was never below a melon or pumpkin has been turned to dirt. ###### Verify Patch 1. Enter a Minetest world in Minetest 5.4.1 with Mineclonia commit 4d02af8c940061ace594950c353ab014751a7c81 in singleplayer survival mode. 2. Create two 3×10 rectangles out of farming soil nodes in the overworld at a place where the each farming soil node can receive sunlight and is not more than 4 nodes away from water. The longer side of the rectangles must be aligned with the north-south axis. 3. Plant 10 melon seeds in a line along the middle of one rectangle. 4. Plant 10 pumpkin seeds in a line along the middle of the other rectangle. 5. Use bonemeal twice on each seed/plant to create fully grown stems. 6. Wait for several melons and pumpkins to grow. This may take a while. 7. Verify that only farmland below melons and pumpkins has been turned to dirt.
erlehmann added 1 commit 2022-01-13 07:32:24 +01:00
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.
erlehmann changed title from WIP: Convert correct floor node to dirt as gourd grows to WIP: ITEMS/mcl_farming: Convert correct floor node to dirt as gourd grows 2022-01-13 08:44:14 +01:00
erlehmann changed title from WIP: ITEMS/mcl_farming: Convert correct floor node to dirt as gourd grows to ITEMS/mcl_farming: Convert correct floor node to dirt as gourd grows 2022-01-13 09:08:01 +01:00
Li0n_2 approved these changes 2022-01-15 22:38:05 +01:00
Li0n_2 left a comment
Member

I tested pumpkin and melon growth in survival mode with this patch and it did not seem to break anything related to farming pumpkin or melon. it also fixes the bug it claims to fix. I planted seeds, bonemealed them, and harvested the crops. since there is barely any change in the code, I think that is a thorough enough test. very nice fix :)

I tested pumpkin and melon growth in survival mode with this patch and it did not seem to break anything related to farming pumpkin or melon. it also fixes the bug it claims to fix. I planted seeds, bonemealed them, and harvested the crops. since there is barely any change in the code, I think that is a thorough enough test. very nice fix :)
erlehmann merged commit 23f1c51912 into master 2022-01-15 23:07:26 +01:00
erlehmann deleted branch fix-gourd-farmland-dirtification 2022-01-15 23:07:51 +01:00
This repo is archived. You cannot comment on pull requests.
No description provided.