Browse Source

changed water checks, jackolantern protection added

pull/18/head
TenPlus1 1 year ago
parent
commit
7c22eea12c
4 changed files with 15 additions and 3 deletions
  1. +1
    -0
      README.md
  2. +4
    -0
      crops/pumpkin.lua
  3. +1
    -1
      init.lua
  4. +9
    -2
      soil.lua

+ 1
- 0
README.md View File

@@ -13,6 +13,7 @@ This mod works by adding your new plant to the {growing=1} group and numbering t

### Changelog:

- 1.42 - Soil needs water to be present within 3 blocks horizontally and 2 below to make wet soil, Jack 'o Lanterns now check protection.
- 1.41 - Each crop has it's own spawn rate (can be changed in farming.conf)
- 1.40 - Added Mithril Scythe to quick harvest and replant crops on right-click. Added Hoe's for MoreOres with Toolrank support.
- 1.39 - Added Rice, Rye and Oats thanks to Ademants Grains mod. Added Jaffa Cake and multigrain bread.


+ 4
- 0
crops/pumpkin.lua View File

@@ -46,6 +46,8 @@ minetest.register_node("farming:jackolantern", {
groups = {choppy = 1, oddly_breakable_by_hand = 1, flammable = 2},
sounds = default.node_sound_wood_defaults(),
on_punch = function(pos, node, puncher)
local name = puncher:get_player_name() or ""
if minetest.is_protected(pos, name) then return end
node.name = "farming:jackolantern_on"
minetest.swap_node(pos, node)
end,
@@ -69,6 +71,8 @@ minetest.register_node("farming:jackolantern_on", {
sounds = default.node_sound_wood_defaults(),
drop = "farming:jackolantern",
on_punch = function(pos, node, puncher)
local name = puncher:get_player_name() or ""
if minetest.is_protected(pos, name) then return end
node.name = "farming:jackolantern"
minetest.swap_node(pos, node)
end,


+ 1
- 1
init.lua View File

@@ -322,7 +322,7 @@ function farming.plant_growth_timer(pos, elapsed, node_name)
end

local growth
local light_pos = {x = pos.x, y = pos.y, z = pos.z} -- was y + 1
local light_pos = {x = pos.x, y = pos.y, z = pos.z}
local lambda = elapsed / STAGE_LENGTH_AVG

if lambda < 0.1 then


+ 9
- 2
soil.lua View File

@@ -52,7 +52,14 @@ minetest.register_abm({
end

-- check if there is water nearby and change soil accordingly
if minetest.find_node_near(pos, 3, {"group:water"}) then
-- if minetest.find_node_near(pos, 3, {"group:water"}) then

-- check if water is within 3 nodes horizontally and 2 below
if #minetest.find_nodes_in_area(
{x = pos.x + 3, y = pos.y + 2, z = pos.z + 3},
{x = pos.x - 3, y = pos.y , z = pos.z - 3},
{"group:water"}) > 0 then

if node.name == "farming:soil" then
minetest.set_node(pos, {name = "farming:soil_wet"})
end
@@ -64,4 +71,4 @@ minetest.register_abm({
minetest.set_node(pos, {name = "default:dirt"})
end
end,
})
})

Loading…
Cancel
Save