2019-08-29 19:51:23 +02:00
|
|
|
-- Fertilizer
|
|
|
|
|
|
|
|
local S = minetest.get_translator("default")
|
|
|
|
|
|
|
|
minetest.register_node(
|
|
|
|
"default:fertilized_dirt",
|
|
|
|
{
|
|
|
|
description = S("Fertilized Dirt"),
|
|
|
|
tiles = {
|
|
|
|
"default_dirt.png^default_fertilizer.png",
|
|
|
|
"default_dirt.png",
|
|
|
|
"default_dirt.png"
|
|
|
|
},
|
|
|
|
groups = {
|
|
|
|
crumbly = 3,
|
|
|
|
soil = 1,
|
2019-09-05 21:05:37 +02:00
|
|
|
normal_dirt = 1,
|
2019-08-29 19:51:23 +02:00
|
|
|
plantable_soil = 1,
|
|
|
|
plantable_fertilizer = 1,
|
|
|
|
fall_damage_add_percent = -5,
|
|
|
|
not_in_craft_guide = 1,
|
|
|
|
},
|
|
|
|
drop = "default:dirt",
|
|
|
|
sounds = default.node_sound_dirt_defaults(),
|
|
|
|
})
|
|
|
|
|
2019-09-05 21:30:49 +02:00
|
|
|
minetest.register_node(
|
|
|
|
"default:fertilized_dry_dirt",
|
|
|
|
{
|
|
|
|
description = S("Fertilized Dry Dirt"),
|
|
|
|
tiles = {
|
2019-09-05 22:12:02 +02:00
|
|
|
"default_dry_dirt.png^default_fertilizer.png",
|
|
|
|
"default_dry_dirt.png",
|
|
|
|
"default_dry_dirt.png"
|
2019-09-05 21:30:49 +02:00
|
|
|
},
|
|
|
|
groups = {
|
|
|
|
crumbly = 3,
|
|
|
|
soil = 1,
|
|
|
|
dry_dirt = 1,
|
|
|
|
plantable_dry = 1,
|
|
|
|
plantable_fertilizer = 1,
|
|
|
|
fall_damage_add_percent = -10,
|
|
|
|
not_in_craft_guide = 1,
|
|
|
|
},
|
|
|
|
drop = "default:dry_dirt",
|
|
|
|
sounds = default.node_sound_dirt_defaults(),
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node(
|
|
|
|
"default:fertilized_swamp_dirt",
|
|
|
|
{
|
|
|
|
description = S("Fertilized Swamp Dirt"),
|
|
|
|
tiles = {
|
|
|
|
"default_swamp_dirt.png^default_fertilizer.png",
|
|
|
|
"default_swamp_dirt.png",
|
|
|
|
"default_swamp_dirt.png"
|
|
|
|
},
|
|
|
|
groups = {
|
|
|
|
crumbly = 3,
|
|
|
|
soil = 1,
|
|
|
|
swamp_dirt = 1,
|
|
|
|
plantable_soil = 1,
|
|
|
|
plantable_fertilizer = 1,
|
|
|
|
fall_damage_add_percent = -10,
|
|
|
|
not_in_craft_guide = 1,
|
|
|
|
},
|
|
|
|
drop = "default:swamp_dirt",
|
|
|
|
sounds = default.node_sound_dirt_defaults(),
|
|
|
|
})
|
|
|
|
|
2019-08-29 19:51:23 +02:00
|
|
|
minetest.register_node(
|
|
|
|
"default:fertilized_sand",
|
|
|
|
{
|
|
|
|
description = S("Fertilized Sand"),
|
|
|
|
tiles = {"default_sand.png^default_fertilizer.png", "default_sand.png", "default_sand.png"},
|
|
|
|
groups = {
|
|
|
|
crumbly = 3,
|
|
|
|
falling_node = 1,
|
|
|
|
sand = 1,
|
|
|
|
plantable_sandy = 1,
|
|
|
|
plantable_fertilizer = 1,
|
|
|
|
fall_damage_add_percent = -10,
|
|
|
|
not_in_craft_guide = 1,
|
|
|
|
},
|
|
|
|
drop = "default:sand",
|
|
|
|
is_ground_content = false,
|
|
|
|
sounds = default.node_sound_sand_defaults(),
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craftitem(
|
|
|
|
"default:fertilizer",
|
|
|
|
{
|
|
|
|
description = S("Fertilizer"),
|
|
|
|
inventory_image = "default_fertilizer_inventory.png",
|
|
|
|
wield_scale = {x=1,y=1,z=2},
|
|
|
|
on_place = function(itemstack, user, pointed_thing)
|
|
|
|
local pos = pointed_thing.above
|
|
|
|
|
2019-08-31 14:58:40 +02:00
|
|
|
local undernode = minetest.get_node(pointed_thing.under)
|
2019-08-29 19:51:23 +02:00
|
|
|
|
2019-08-31 14:58:40 +02:00
|
|
|
local diff = vector.subtract(pointed_thing.above, pointed_thing.under)
|
|
|
|
if diff.y > 0 then
|
2019-09-05 21:05:37 +02:00
|
|
|
if minetest.get_item_group(undernode.name, "plantable_fertilizer") ~= 0 then
|
|
|
|
return itemstack
|
|
|
|
elseif minetest.get_item_group(undernode.name, "normal_dirt") ~= 0 then
|
|
|
|
minetest.set_node(pointed_thing.under, {name = "default:fertilized_dirt"})
|
2019-09-05 21:30:49 +02:00
|
|
|
elseif minetest.get_item_group(undernode.name, "swamp_dirt") ~= 0 then
|
|
|
|
minetest.set_node(pointed_thing.under, {name = "default:fertilized_swamp_dirt"})
|
|
|
|
elseif minetest.get_item_group(undernode.name, "dry_dirt") ~= 0 then
|
|
|
|
minetest.set_node(pointed_thing.under, {name = "default:fertilized_dry_dirt"})
|
2019-09-05 21:05:37 +02:00
|
|
|
elseif undernode.name == "default:sand" then
|
|
|
|
minetest.set_node(pointed_thing.under, {name = "default:fertilized_sand"})
|
2019-08-29 19:51:23 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-08-31 14:58:40 +02:00
|
|
|
if not minetest.settings:get_bool("creative_mode") then
|
|
|
|
itemstack:take_item()
|
|
|
|
end
|
2019-08-29 19:51:23 +02:00
|
|
|
|
|
|
|
return itemstack
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
default.log("fertilizer", "loaded")
|