From 7931470ddb3fe1ea1547bd18ddfcdd552ab9f029 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Sun, 3 Nov 2013 17:46:15 -0500 Subject: [PATCH] Made bushes also spawn on wet or dry farming soil (at the same rates as anywhere else) Slowed down overall berry regrowth and at the same time make it so that if a bush is planted on wet farming soil, it will re-grow its berries faster, provided the soil remains wet. On average, a wild bush will regrow its berries 50% slower than before, while a farmed bush will regrow its berries twice as fast as the wild ones did before (about 3x faster than wild ones do now). --- bushes_classic/init.lua | 4 +++- bushes_classic/nodes.lua | 16 ++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/bushes_classic/init.lua b/bushes_classic/init.lua index b19d539..81e2776 100644 --- a/bushes_classic/init.lua +++ b/bushes_classic/init.lua @@ -37,7 +37,9 @@ plantslib:spawn_on_surfaces({ "default:dirt_with_grass", "woodsoils:dirt_with_leaves_1", "woodsoils:grass_with_leaves_1", - "woodsoils:grass_with_leaves_2" + "woodsoils:grass_with_leaves_2", + "farming:soil", + "farming:soil_wet" }, avoid_nodes = {"group:bush"}, seed_diff = 545342534, -- chosen by a fair mashing of the keyboard - guaranteed to be random :P diff --git a/bushes_classic/nodes.lua b/bushes_classic/nodes.lua index 03ef3fc..d34dc10 100644 --- a/bushes_classic/nodes.lua +++ b/bushes_classic/nodes.lua @@ -123,15 +123,19 @@ end minetest.register_abm({ nodenames = { "bushes:fruitless_bush" }, interval = 500, - chance = 10, + chance = 5, action = function(pos, node, active_object_count, active_object_count_wider) - local meta = minetest.env:get_meta( pos ); - local bush_name = meta:get_string( 'bush_type' ); - if( bush_name ~= nil and bush_name ~= '' ) then - minetest.env:set_node( pos, {type='node',name='bushes:'..bush_name..'_bush'}); + local meta = minetest.env:get_meta( pos ); + local bush_name = meta:get_string( 'bush_type' ); + if( bush_name ~= nil and bush_name ~= '' ) then + local dirtpos = { x = pos.x, y = pos.y-1, z = pos.z } + local dirt = minetest.get_node(dirtpos) + if dirt.name == "farming:soil_wet" or math.random(1,3) == 1 then + minetest.env:set_node( pos, {type='node',name='bushes:'..bush_name..'_bush'}) end - end + end + end }) -- Define the basket and bush nodes