Fix fertilizer turning some blocks into sth. else

This commit is contained in:
Wuzzy 2019-09-05 21:05:37 +02:00
parent 963f1c67e1
commit cb6937bfa9
3 changed files with 15 additions and 15 deletions

View File

@ -14,6 +14,7 @@ minetest.register_node(
groups = { groups = {
crumbly = 3, crumbly = 3,
soil = 1, soil = 1,
normal_dirt = 1,
plantable_soil = 1, plantable_soil = 1,
plantable_fertilizer = 1, plantable_fertilizer = 1,
fall_damage_add_percent = -5, fall_damage_add_percent = -5,
@ -52,18 +53,17 @@ minetest.register_craftitem(
local pos = pointed_thing.above local pos = pointed_thing.above
local undernode = minetest.get_node(pointed_thing.under) local undernode = minetest.get_node(pointed_thing.under)
local underdef = minetest.registered_nodes[undernode.name]
local diff = vector.subtract(pointed_thing.above, pointed_thing.under) local diff = vector.subtract(pointed_thing.above, pointed_thing.under)
if diff.y > 0 then if diff.y > 0 then
if underdef.groups then if minetest.get_item_group(undernode.name, "plantable_fertilizer") ~= 0 then
if underdef.groups.plantable_soil then return itemstack
elseif minetest.get_item_group(undernode.name, "normal_dirt") ~= 0 then
minetest.set_node(pointed_thing.under, {name = "default:fertilized_dirt"}) minetest.set_node(pointed_thing.under, {name = "default:fertilized_dirt"})
elseif underdef.groups.plantable_sandy then elseif undernode.name == "default:sand" then
minetest.set_node(pointed_thing.under, {name = "default:fertilized_sand"}) minetest.set_node(pointed_thing.under, {name = "default:fertilized_sand"})
end end
end end
end
if not minetest.settings:get_bool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() itemstack:take_item()

View File

@ -171,7 +171,7 @@ minetest.register_node(
description = S("Dirt"), description = S("Dirt"),
tiles = {"default_dirt.png"}, tiles = {"default_dirt.png"},
stack_max = 240, stack_max = 240,
groups = {crumbly = 3, soil = 1, plantable_soil = 1, fall_damage_add_percent = -5}, groups = {crumbly = 3, soil = 1, normal_dirt = 1, plantable_soil = 1, fall_damage_add_percent = -5},
sounds = default.node_sound_dirt_defaults(), sounds = default.node_sound_dirt_defaults(),
}) })
@ -181,7 +181,7 @@ minetest.register_node(
description = S("Dry Dirt"), description = S("Dry Dirt"),
tiles = {"default_dirt.png"}, tiles = {"default_dirt.png"},
stack_max = 240, stack_max = 240,
groups = {crumbly = 3, soil = 1, plantable_sandy = 1, fall_damage_add_percent = -10}, groups = {crumbly = 3, soil = 1, dry_dirt = 1, plantable_dry = 1, fall_damage_add_percent = -10},
sounds = default.node_sound_dirt_defaults(), sounds = default.node_sound_dirt_defaults(),
}) })
@ -191,7 +191,7 @@ minetest.register_node(
description = S("Swamp Dirt"), description = S("Swamp Dirt"),
tiles = {"default_swamp_dirt.png"}, tiles = {"default_swamp_dirt.png"},
stack_max = 240, stack_max = 240,
groups = {crumbly = 3, soil = 1, plantable_soil = 1, fall_damage_add_percent = -10}, groups = {crumbly = 3, soil = 1, swamp_dirt = 1, plantable_soil = 1, fall_damage_add_percent = -10},
sounds = default.node_sound_dirt_defaults(), sounds = default.node_sound_dirt_defaults(),
}) })
@ -204,7 +204,7 @@ minetest.register_node(
"default_dirt.png", "default_dirt.png",
"default_dirt.png^default_dry_grass_side.png" "default_dirt.png^default_dry_grass_side.png"
}, },
groups = {crumbly = 3, soil = 1, plantable_sandy = 1, grass_cover = 1, groups = {crumbly = 3, soil = 1, normal_dirt = 1, plantable_sandy = 1, grass_cover = 1,
fall_damage_add_percent = -5, not_in_craft_guide = 1}, fall_damage_add_percent = -5, not_in_craft_guide = 1},
drop = { drop = {
max_items = 3, max_items = 3,
@ -230,7 +230,7 @@ minetest.register_node(
"default_swamp_dirt.png", "default_swamp_dirt.png",
"default_swamp_dirt.png^default_swamp_grass_side.png" "default_swamp_dirt.png^default_swamp_grass_side.png"
}, },
groups = {crumbly = 3, soil = 1, plantable_soil = 1, grass_cover = 1, groups = {crumbly = 3, soil = 1, swamp_dirt = 1, plantable_soil = 1, grass_cover = 1,
fall_damage_add_percent = -5, not_in_craft_guide = 1}, fall_damage_add_percent = -5, not_in_craft_guide = 1},
drop = { drop = {
max_items = 3, max_items = 3,
@ -256,7 +256,7 @@ minetest.register_node(
"default_dirt.png", "default_dirt.png",
"default_dirt.png^default_grass_side.png" "default_dirt.png^default_grass_side.png"
}, },
groups = {crumbly = 3, soil = 1, plantable_soil = 1, grass_cover = 1, groups = {crumbly = 3, soil = 1, normal_dirt = 1, plantable_soil = 1, grass_cover = 1,
fall_damage_add_percent = -5, not_in_craft_guide = 1}, fall_damage_add_percent = -5, not_in_craft_guide = 1},
drop = { drop = {
max_items = 3, max_items = 3,
@ -279,7 +279,7 @@ minetest.register_node(
{ {
description = S("Dirt with Grass and Footsteps"), description = S("Dirt with Grass and Footsteps"),
tiles = {"default_grass_footstep.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"}, tiles = {"default_grass_footstep.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
groups = {crumbly = 3, soil = 1, plantable_soil = 1, grass_cover = 1, fall_damage_add_percent = -5, not_in_craft_guide = 1}, groups = {crumbly = 3, soil = 1, normal_dirt = 1, plantable_soil = 1, grass_cover = 1, fall_damage_add_percent = -5, not_in_craft_guide = 1},
drop = { drop = {
max_items = 3, max_items = 3,
items = { items = {

View File

@ -21,7 +21,7 @@ farming.register_plant(
grow_time = 780, grow_time = 780,
grows_near = {"group:water"}, grows_near = {"group:water"},
growing_distance = 4, growing_distance = 4,
grows_on = {"group:plantable_sandy", "group:plantable_soil"}, grows_on = {"group:plantable_sandy", "group:plantable_soil", "group:plantable_dry"},
light_min = 12, light_min = 12,
light_max = 15, light_max = 15,
} }