1
0
Fork 0

Add new groups for cultivation

This commit is contained in:
Wuzzy 2017-01-10 04:01:53 +01:00
parent 2083b6a76b
commit e29a905ab8
3 changed files with 15 additions and 8 deletions

View File

@ -5,11 +5,16 @@ This document is a WORK IN PROGRESS.
Currently, it only contains some information about the used groups. Currently, it only contains some information about the used groups.
Groups Groups for interactions
dig_by_water=1 dig_by_water=1
Blocks with this group will drop when they are near flowing water 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 Groups (mostly) used for crafting recipes

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"}, tiles = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
is_ground_content = true, is_ground_content = true,
stack_max = 64, stack_max = 64,
groups = {crumbly=3, soil=1}, groups = {crumbly=3, soil=1, cultivatable=2},
drop = 'default:dirt', drop = 'default:dirt',
sounds = default.node_sound_dirt_defaults({ sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4}, 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"}, tiles = {"default_mycelium_top.png", "default_dirt.png", "default_mycelium_side.png"},
is_ground_content = true, is_ground_content = true,
stack_max = 64, stack_max = 64,
groups = {crumbly=3, soil=1}, -- TODO: Add mushroom soil group
groups = {crumbly=3, cultivatable=2},
drop = 'default:dirt', drop = 'default:dirt',
sounds = default.node_sound_dirt_defaults({ sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4}, footstep = {name="default_grass_footstep", gain=0.4},
}), }),
}) })
-- TODO: Update for real snowy blocks
minetest.register_node("default:dirt_with_snow", { minetest.register_node("default:dirt_with_snow", {
description = "Dirt with Snow", description = "Dirt with Snow",
tiles = {"default_snow.png", "default_dirt.png", "default_dirt.png^default_snow_side.png"}, tiles = {"default_snow.png", "default_dirt.png", "default_dirt.png^default_snow_side.png"},
is_ground_content = true, is_ground_content = true,
stack_max = 64, stack_max = 64,
groups = {crumbly=3}, groups = {crumbly=3, cultivatable=2},
drop = 'default:dirt', drop = 'default:dirt',
sounds = default.node_sound_dirt_defaults({ sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4}, footstep = {name="default_grass_footstep", gain=0.4},
@ -293,7 +295,7 @@ minetest.register_node("default:dirt", {
tiles = {"default_dirt.png"}, tiles = {"default_dirt.png"},
is_ground_content = true, is_ground_content = true,
stack_max = 64, stack_max = 64,
groups = {crumbly=3, soil=1}, groups = {crumbly=3, soil=1, cultivatable=2},
sounds = default.node_sound_dirt_defaults(), sounds = default.node_sound_dirt_defaults(),
}) })
@ -302,7 +304,7 @@ minetest.register_node("default:coarse_dirt", {
tiles = {"default_coarse_dirt.png"}, tiles = {"default_coarse_dirt.png"},
is_ground_content = true, is_ground_content = true,
stack_max = 64, stack_max = 64,
groups = {crumbly=3, soil=1}, groups = {crumbly=3, soil=1, cultivatable=1},
sounds = default.node_sound_dirt_defaults(), sounds = default.node_sound_dirt_defaults(),
}) })

View File

@ -5,13 +5,13 @@ local function create_soil(pos, inv)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
local name = node.name local name = node.name
local above = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}) 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 if above.name == "air" then
node.name = "farming:soil" node.name = "farming:soil"
minetest.set_node(pos, node) minetest.set_node(pos, node)
return true return true
end end
elseif name == "default:coarse_dirt" then elseif minetest.get_item_group(name, "cultivatable") == 1 then
if above.name == "air" then if above.name == "air" then
node.name = "default:dirt" node.name = "default:dirt"
minetest.set_node(pos, node) minetest.set_node(pos, node)