forked from VoxeLibre/VoxeLibre
Add new groups for cultivation
This commit is contained in:
parent
2083b6a76b
commit
e29a905ab8
7
API.txt
7
API.txt
|
@ -5,11 +5,16 @@ This document is a WORK IN PROGRESS.
|
|||
Currently, it only contains some information about the used groups.
|
||||
|
||||
|
||||
Groups
|
||||
Groups for interactions
|
||||
|
||||
dig_by_water=1
|
||||
Blocks with this group will drop when they are near flowing water
|
||||
|
||||
cultivatable=2
|
||||
Block will be turned into Farmland by using a hoe on it
|
||||
cultivatable=1
|
||||
Block will be turned into Dirt by using a hoe on it
|
||||
|
||||
|
||||
Groups (mostly) used for crafting recipes
|
||||
|
||||
|
|
|
@ -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},
|
||||
groups = {crumbly=3, soil=1, cultivatable=2},
|
||||
drop = 'default:dirt',
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_grass_footstep", gain=0.4},
|
||||
|
@ -269,19 +269,21 @@ minetest.register_node("default:mycelium", {
|
|||
tiles = {"default_mycelium_top.png", "default_dirt.png", "default_mycelium_side.png"},
|
||||
is_ground_content = true,
|
||||
stack_max = 64,
|
||||
groups = {crumbly=3, soil=1},
|
||||
-- TODO: Add mushroom soil group
|
||||
groups = {crumbly=3, cultivatable=2},
|
||||
drop = 'default:dirt',
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_grass_footstep", gain=0.4},
|
||||
}),
|
||||
})
|
||||
|
||||
-- TODO: Update for real snowy blocks
|
||||
minetest.register_node("default:dirt_with_snow", {
|
||||
description = "Dirt with Snow",
|
||||
tiles = {"default_snow.png", "default_dirt.png", "default_dirt.png^default_snow_side.png"},
|
||||
is_ground_content = true,
|
||||
stack_max = 64,
|
||||
groups = {crumbly=3},
|
||||
groups = {crumbly=3, cultivatable=2},
|
||||
drop = 'default:dirt',
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_grass_footstep", gain=0.4},
|
||||
|
@ -293,7 +295,7 @@ minetest.register_node("default:dirt", {
|
|||
tiles = {"default_dirt.png"},
|
||||
is_ground_content = true,
|
||||
stack_max = 64,
|
||||
groups = {crumbly=3, soil=1},
|
||||
groups = {crumbly=3, soil=1, cultivatable=2},
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
|
||||
|
@ -302,7 +304,7 @@ minetest.register_node("default:coarse_dirt", {
|
|||
tiles = {"default_coarse_dirt.png"},
|
||||
is_ground_content = true,
|
||||
stack_max = 64,
|
||||
groups = {crumbly=3, soil=1},
|
||||
groups = {crumbly=3, soil=1, cultivatable=1},
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@ local function create_soil(pos, inv)
|
|||
local node = minetest.get_node(pos)
|
||||
local name = node.name
|
||||
local above = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z})
|
||||
if name == "default:dirt" or name == "default:dirt_with_grass" or name == "default:mycelium" then
|
||||
if minetest.get_item_group(name, "cultivatable") == 2 then
|
||||
if above.name == "air" then
|
||||
node.name = "farming:soil"
|
||||
minetest.set_node(pos, node)
|
||||
return true
|
||||
end
|
||||
elseif name == "default:coarse_dirt" then
|
||||
elseif minetest.get_item_group(name, "cultivatable") == 1 then
|
||||
if above.name == "air" then
|
||||
node.name = "default:dirt"
|
||||
minetest.set_node(pos, node)
|
||||
|
|
Reference in New Issue