From e6112839b1a516085c84f50df9d3037dce940400 Mon Sep 17 00:00:00 2001 From: kaadmy Date: Wed, 7 Oct 2015 13:56:45 -0700 Subject: [PATCH] clams spawn less naturally and grow instead --- mods/default/functions.lua | 20 ++++++++++++++++++++ mods/default/mapgen.lua | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/mods/default/functions.lua b/mods/default/functions.lua index 048362b..a2d0e05 100644 --- a/mods/default/functions.lua +++ b/mods/default/functions.lua @@ -222,6 +222,26 @@ minetest.register_abm( -- grass expands end }) +minetest.register_abm( -- clams grow + { + nodenames = {"default:clam"}, + interval = 20, + chance = 160, + action = function(pos, node) + local rx = math.random(0, 2) - 1 + local rz = math.random(0, 2) - 1 + + local edgepos = {x = pos.x+rx, y = pos.y, z = pos.z+rz} + local downpos = {x = pos.x+rx, y = pos.y-1, z = pos.z+rz} + local edgenode = minetest.get_node(edgepos) + local downnode = minetest.get_node(downpos) + + if edgenode.name == "air" and downnode.name ~= "air" and downnode.buildable_to == false and walkable == true then + minetest.set_node(edgepos, {name = "default:clam"}) + end + end + }) + minetest.register_abm( -- cactus grows { nodenames = {"default:cactus"}, diff --git a/mods/default/mapgen.lua b/mods/default/mapgen.lua index b2de729..f65204b 100644 --- a/mods/default/mapgen.lua +++ b/mods/default/mapgen.lua @@ -517,10 +517,10 @@ minetest.register_decoration( deco_type = "simple", place_on = {"default:sand", "default:gravel"}, sidelen = 16, - fill_ratio = 0.04, + fill_ratio = 0.02, biomes = {"Grassland Ocean", "Gravel Beach"}, decoration = {"default:clam"}, - y_min = -32000, + y_min = 0, y_max = 1, })