From b513385e7baf1706ee088b06f7cc039fb25e245e Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 12 Jan 2017 06:54:16 +0100 Subject: [PATCH] Make sugar canes grow on more blocks --- API.md | 1 + mods/default/functions.lua | 2 +- mods/default/nodes.lua | 12 ++++++------ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/API.md b/API.md index 5eda0f12..8c6e5382 100644 --- a/API.md +++ b/API.md @@ -12,6 +12,7 @@ This section explains all the used groups in this subgame. * `cultivatable=1`: Block will be turned into Dirt by using a hoe on it * `flammable`: Block helps spreading fire and gets destroyed by nearby fire (rating doesn't matter) * `soil=1`: Saplings and other small plants can grow on it +* `soil_sugarcane=1`: Sugar canes will grow on this near water ### Groups (mostly) used for crafting recipes diff --git a/mods/default/functions.lua b/mods/default/functions.lua index b05867d4..210e8eda 100644 --- a/mods/default/functions.lua +++ b/mods/default/functions.lua @@ -77,7 +77,7 @@ end grow_reeds = function(pos, node) pos.y = pos.y-1 local name = minetest.get_node(pos).name - if name == "default:dirt" or name == "default:dirt_with_grass" then + if minetest.get_node_group(name, "soil_sugarcane") ~= 0 then if minetest.find_node_near(pos, 3, {"group:water"}) == nil then return end diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index 5cda4f33..0d52b330 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -257,7 +257,7 @@ minetest.register_node("default:dirt_with_grass", { tiles = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"}, is_ground_content = true, stack_max = 64, - groups = {crumbly=3, soil=1, cultivatable=2}, + groups = {crumbly=3, soil=1, soil_sugarcane=1, cultivatable=2}, drop = 'default:dirt', sounds = default.node_sound_dirt_defaults({ footstep = {name="default_grass_footstep", gain=0.4}, @@ -282,7 +282,7 @@ minetest.register_node("default:podzol", { tiles = {"default_dirt_podzol_top.png", "default_dirt.png", "default_dirt_podzol_side.png"}, is_ground_content = true, stack_max = 64, - groups = {crumbly=3, soil=1}, + groups = {crumbly=3, soil=1, soil_sugarcane=1}, drop = 'default:dirt', sounds = default.node_sound_dirt_defaults(), }) @@ -292,7 +292,7 @@ minetest.register_node("default:dirt", { tiles = {"default_dirt.png"}, is_ground_content = true, stack_max = 64, - groups = {crumbly=3, soil=1, cultivatable=2}, + groups = {crumbly=3, soil=1, soil_sugarcane=1, cultivatable=2}, sounds = default.node_sound_dirt_defaults(), }) @@ -301,7 +301,7 @@ minetest.register_node("default:coarse_dirt", { tiles = {"default_coarse_dirt.png"}, is_ground_content = true, stack_max = 64, - groups = {crumbly=3, soil=1, cultivatable=1}, + groups = {crumbly=3, soil=1, soil_sugarcane=1, cultivatable=1}, sounds = default.node_sound_dirt_defaults(), }) @@ -329,7 +329,7 @@ minetest.register_node("default:sand", { tiles = {"default_sand.png"}, is_ground_content = true, stack_max = 64, - groups = {crumbly=3, falling_node=1, sand=1}, + groups = {crumbly=3, falling_node=1, sand=1, soil_sugarcane=1}, sounds = default.node_sound_sand_defaults(), }) @@ -367,7 +367,7 @@ minetest.register_node("default:redsand", { tiles = {"default_red_sand.png"}, is_ground_content = true, stack_max = 64, - groups = {crumbly=3, falling_node=1, sand=1}, + groups = {crumbly=3, falling_node=1, sand=1, soil_sugarcane=1}, sounds = default.node_sound_sand_defaults(), })