1
0
Fork 0

Add soil_sapling group

This commit is contained in:
Wuzzy 2017-01-12 07:07:30 +01:00
parent b513385e7b
commit de5f3d5618
4 changed files with 17 additions and 11 deletions

2
API.md
View File

@ -12,6 +12,8 @@ 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_sapling=2`: Soil for saplings. Intended to be natural soil. All saplings will grow on this
* `soil_sapling=1`: Artificial soil (such as farmland) for saplings. Some saplings will not grow on this
* `soil_sugarcane=1`: Sugar canes will grow on this near water
### Groups (mostly) used for crafting recipes

View File

@ -609,14 +609,16 @@ minetest.register_abm({
-- Normal tree
minetest.register_abm({
nodenames = {"default:sapling"},
neighbors = {"default:dirt", "default:dirt_with_grass"},
neighbors = {"group:soil_sapling"},
interval = 30,
chance = 15,
action = function(pos)
local light = minetest.get_node_light(pos)
if light or light > 10 then
minetest.add_node(pos, {name="air"})
generate_tree(pos, "default:tree", "default:leaves", 1)
local soilnode = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z})
local soiltype = mietest.get_item_group(soilnode.name, "soil_sapling")
if soiltype >= 1 and light and light >= 9 then
minetest.add_node(pos, {name="air"})
generate_tree(pos, "default:tree", "default:leaves", 1)
end
end,
})
@ -624,12 +626,14 @@ minetest.register_abm({
-- Jungle Tree
minetest.register_abm({
nodenames = {"default:junglesapling"},
neighbors = {"default:dirt", "default:dirt_with_grass"},
neighbors = {"group:soil_sapling"},
interval = 30,
chance = 15,
action = function(pos)
local light = minetest.get_node_light(pos)
if light or light > 10 then
local soilnode = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z})
local soiltype = mietest.get_item_group(soilnode.name, "soil_sapling")
if soiltype == 2 and light and light >= 9 then
minetest.add_node(pos, {name="air"})
generate_tree(pos, "default:jungletree", "default:jungleleaves", 2)
end

View File

@ -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, soil_sugarcane=1, cultivatable=2},
groups = {crumbly=3, soil=1, soil_sapling=2, 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, soil_sugarcane=1},
groups = {crumbly=3, soil=1, soil_sapling=2, 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, soil_sugarcane=1, cultivatable=2},
groups = {crumbly=3, soil=1, soil_sapling=2, soil_sugarcane=1, cultivatable=2},
sounds = default.node_sound_dirt_defaults(),
})

View File

@ -11,7 +11,7 @@ minetest.register_node("farming:soil", {
{-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5},
}
},
groups = {crumbly=3, not_in_creative_inventory=1,soil=2},
groups = { crumbly=3, not_in_creative_inventory=1, soil=2, soil_sapling=1 },
sounds = default.node_sound_dirt_defaults(),
})
@ -27,7 +27,7 @@ minetest.register_node("farming:soil_wet", {
{-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5},
}
},
groups = {crumbly=3, not_in_creative_inventory=1,soil=3},
groups = { crumbly=3, not_in_creative_inventory=1, soil=3, soil_sapling=1 },
sounds = default.node_sound_dirt_defaults(),
})