2019-09-10 19:09:51 +02:00
|
|
|
-- farming/nodes.lua
|
|
|
|
|
|
|
|
-- support for MT game translation.
|
|
|
|
local S = farming.get_translator
|
|
|
|
|
2014-04-16 23:44:58 +02:00
|
|
|
minetest.override_item("default:dirt", {
|
|
|
|
soil = {
|
|
|
|
base = "default:dirt",
|
|
|
|
dry = "farming:soil",
|
|
|
|
wet = "farming:soil_wet"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.override_item("default:dirt_with_grass", {
|
|
|
|
soil = {
|
|
|
|
base = "default:dirt_with_grass",
|
|
|
|
dry = "farming:soil",
|
|
|
|
wet = "farming:soil_wet"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2016-04-06 23:52:53 +02:00
|
|
|
minetest.override_item("default:dirt_with_dry_grass", {
|
|
|
|
soil = {
|
|
|
|
base = "default:dirt_with_dry_grass",
|
|
|
|
dry = "farming:soil",
|
|
|
|
wet = "farming:soil_wet"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2017-03-15 22:23:31 +01:00
|
|
|
minetest.override_item("default:dirt_with_rainforest_litter", {
|
|
|
|
soil = {
|
|
|
|
base = "default:dirt_with_rainforest_litter",
|
|
|
|
dry = "farming:soil",
|
|
|
|
wet = "farming:soil_wet"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2017-12-24 03:23:29 +01:00
|
|
|
minetest.override_item("default:dirt_with_coniferous_litter", {
|
|
|
|
soil = {
|
|
|
|
base = "default:dirt_with_coniferous_litter",
|
|
|
|
dry = "farming:soil",
|
|
|
|
wet = "farming:soil_wet"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2019-07-26 18:50:44 +02:00
|
|
|
minetest.override_item("default:dry_dirt", {
|
|
|
|
soil = {
|
|
|
|
base = "default:dry_dirt",
|
|
|
|
dry = "farming:dry_soil",
|
|
|
|
wet = "farming:dry_soil_wet"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.override_item("default:dry_dirt_with_dry_grass", {
|
|
|
|
soil = {
|
|
|
|
base = "default:dry_dirt_with_dry_grass",
|
|
|
|
dry = "farming:dry_soil",
|
|
|
|
wet = "farming:dry_soil_wet"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2014-04-16 23:44:58 +02:00
|
|
|
minetest.register_node("farming:soil", {
|
2019-09-10 19:09:51 +02:00
|
|
|
description = S("Soil"),
|
2014-12-06 11:28:24 +01:00
|
|
|
tiles = {"default_dirt.png^farming_soil.png", "default_dirt.png"},
|
2014-04-16 23:44:58 +02:00
|
|
|
drop = "default:dirt",
|
2014-08-21 12:45:14 +02:00
|
|
|
groups = {crumbly=3, not_in_creative_inventory=1, soil=2, grassland = 1, field = 1},
|
2014-04-16 23:44:58 +02:00
|
|
|
sounds = default.node_sound_dirt_defaults(),
|
|
|
|
soil = {
|
|
|
|
base = "default:dirt",
|
|
|
|
dry = "farming:soil",
|
|
|
|
wet = "farming:soil_wet"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("farming:soil_wet", {
|
2019-09-10 19:09:51 +02:00
|
|
|
description = S("Wet Soil"),
|
2014-12-06 11:28:24 +01:00
|
|
|
tiles = {"default_dirt.png^farming_soil_wet.png", "default_dirt.png^farming_soil_wet_side.png"},
|
2014-04-16 23:44:58 +02:00
|
|
|
drop = "default:dirt",
|
2014-08-21 12:45:14 +02:00
|
|
|
groups = {crumbly=3, not_in_creative_inventory=1, soil=3, wet = 1, grassland = 1, field = 1},
|
2014-04-16 23:44:58 +02:00
|
|
|
sounds = default.node_sound_dirt_defaults(),
|
|
|
|
soil = {
|
|
|
|
base = "default:dirt",
|
|
|
|
dry = "farming:soil",
|
|
|
|
wet = "farming:soil_wet"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2019-07-26 18:50:44 +02:00
|
|
|
minetest.register_node("farming:dry_soil", {
|
2020-04-06 22:03:57 +02:00
|
|
|
description = S("Savanna Soil"),
|
2019-07-26 18:50:44 +02:00
|
|
|
tiles = {"default_dry_dirt.png^farming_soil.png", "default_dry_dirt.png"},
|
|
|
|
drop = "default:dry_dirt",
|
|
|
|
groups = {crumbly=3, not_in_creative_inventory=1, soil=2, grassland = 1, field = 1},
|
|
|
|
sounds = default.node_sound_dirt_defaults(),
|
|
|
|
soil = {
|
|
|
|
base = "default:dry_dirt",
|
|
|
|
dry = "farming:dry_soil",
|
|
|
|
wet = "farming:dry_soil_wet"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("farming:dry_soil_wet", {
|
2020-04-06 22:03:57 +02:00
|
|
|
description = S("Wet Savanna Soil"),
|
2019-07-26 18:50:44 +02:00
|
|
|
tiles = {"default_dry_dirt.png^farming_soil_wet.png", "default_dry_dirt.png^farming_soil_wet_side.png"},
|
|
|
|
drop = "default:dry_dirt",
|
|
|
|
groups = {crumbly=3, not_in_creative_inventory=1, soil=3, wet = 1, grassland = 1, field = 1},
|
|
|
|
sounds = default.node_sound_dirt_defaults(),
|
|
|
|
soil = {
|
|
|
|
base = "default:dry_dirt",
|
|
|
|
dry = "farming:dry_soil",
|
|
|
|
wet = "farming:dry_soil_wet"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2014-04-16 23:44:58 +02:00
|
|
|
minetest.override_item("default:desert_sand", {
|
|
|
|
groups = {crumbly=3, falling_node=1, sand=1, soil = 1},
|
|
|
|
soil = {
|
|
|
|
base = "default:desert_sand",
|
|
|
|
dry = "farming:desert_sand_soil",
|
|
|
|
wet = "farming:desert_sand_soil_wet"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_node("farming:desert_sand_soil", {
|
2019-09-10 19:09:51 +02:00
|
|
|
description = S("Desert Sand Soil"),
|
2014-07-22 12:31:47 +02:00
|
|
|
drop = "default:desert_sand",
|
2014-04-16 23:44:58 +02:00
|
|
|
tiles = {"farming_desert_sand_soil.png", "default_desert_sand.png"},
|
2014-08-21 12:45:14 +02:00
|
|
|
groups = {crumbly=3, not_in_creative_inventory = 1, falling_node=1, sand=1, soil = 2, desert = 1, field = 1},
|
2014-04-16 23:44:58 +02:00
|
|
|
sounds = default.node_sound_sand_defaults(),
|
|
|
|
soil = {
|
|
|
|
base = "default:desert_sand",
|
|
|
|
dry = "farming:desert_sand_soil",
|
|
|
|
wet = "farming:desert_sand_soil_wet"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("farming:desert_sand_soil_wet", {
|
2019-09-10 19:09:51 +02:00
|
|
|
description = S("Wet Desert Sand Soil"),
|
2014-04-16 23:44:58 +02:00
|
|
|
drop = "default:desert_sand",
|
|
|
|
tiles = {"farming_desert_sand_soil_wet.png", "farming_desert_sand_soil_wet_side.png"},
|
2014-08-21 12:45:14 +02:00
|
|
|
groups = {crumbly=3, falling_node=1, sand=1, not_in_creative_inventory=1, soil=3, wet = 1, desert = 1, field = 1},
|
2014-04-16 23:44:58 +02:00
|
|
|
sounds = default.node_sound_sand_defaults(),
|
|
|
|
soil = {
|
|
|
|
base = "default:desert_sand",
|
|
|
|
dry = "farming:desert_sand_soil",
|
|
|
|
wet = "farming:desert_sand_soil_wet"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2015-01-12 20:21:06 +01:00
|
|
|
minetest.register_node("farming:straw", {
|
2019-09-10 19:09:51 +02:00
|
|
|
description = S("Straw"),
|
2015-01-12 20:21:06 +01:00
|
|
|
tiles = {"farming_straw.png"},
|
|
|
|
is_ground_content = false,
|
2016-06-11 18:50:22 +02:00
|
|
|
groups = {snappy=3, flammable=4, fall_damage_add_percent=-30},
|
2015-01-12 20:21:06 +01:00
|
|
|
sounds = default.node_sound_leaves_defaults(),
|
|
|
|
})
|
|
|
|
|
2020-04-13 11:34:10 +02:00
|
|
|
-- Registered before the stairs so the stairs get fuel recipes.
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "fuel",
|
|
|
|
recipe = "farming:straw",
|
|
|
|
burntime = 3,
|
|
|
|
})
|
|
|
|
|
2019-09-18 20:38:27 +02:00
|
|
|
do
|
|
|
|
local recipe = "farming:straw"
|
|
|
|
local groups = {snappy = 3, flammable = 4}
|
|
|
|
local images = {"farming_straw.png"}
|
|
|
|
local sounds = default.node_sound_leaves_defaults()
|
|
|
|
|
|
|
|
stairs.register_stair("straw", recipe, groups, images, S("Straw Stair"),
|
|
|
|
sounds, true)
|
|
|
|
stairs.register_stair_inner("straw", recipe, groups, images, "",
|
|
|
|
sounds, true, S("Inner Straw Stair"))
|
|
|
|
stairs.register_stair_outer("straw", recipe, groups, images, "",
|
|
|
|
sounds, true, S("Outer Straw Stair"))
|
|
|
|
stairs.register_slab("straw", recipe, groups, images, S("Straw Slab"),
|
|
|
|
sounds, true)
|
|
|
|
end
|
2017-07-22 16:11:40 +02:00
|
|
|
|
2014-04-16 23:44:58 +02:00
|
|
|
minetest.register_abm({
|
2016-08-08 11:56:13 +02:00
|
|
|
label = "Farming soil",
|
2014-08-21 12:45:14 +02:00
|
|
|
nodenames = {"group:field"},
|
|
|
|
interval = 15,
|
|
|
|
chance = 4,
|
2014-04-16 23:44:58 +02:00
|
|
|
action = function(pos, node)
|
2014-08-21 12:45:14 +02:00
|
|
|
local n_def = minetest.registered_nodes[node.name] or nil
|
|
|
|
local wet = n_def.soil.wet or nil
|
|
|
|
local base = n_def.soil.base or nil
|
|
|
|
local dry = n_def.soil.dry or nil
|
|
|
|
if not n_def or not n_def.soil or not wet or not base or not dry then
|
2014-04-16 23:44:58 +02:00
|
|
|
return
|
|
|
|
end
|
2014-08-21 12:45:14 +02:00
|
|
|
|
|
|
|
pos.y = pos.y + 1
|
|
|
|
local nn = minetest.get_node_or_nil(pos)
|
|
|
|
if not nn or not nn.name then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
local nn_def = minetest.registered_nodes[nn.name] or nil
|
|
|
|
pos.y = pos.y - 1
|
2016-11-20 04:24:37 +01:00
|
|
|
|
2014-08-21 12:45:14 +02:00
|
|
|
if nn_def and nn_def.walkable and minetest.get_item_group(nn.name, "plant") == 0 then
|
|
|
|
minetest.set_node(pos, {name = base})
|
|
|
|
return
|
2014-04-16 23:44:58 +02:00
|
|
|
end
|
|
|
|
-- check if there is water nearby
|
2014-11-25 21:34:40 +01:00
|
|
|
local wet_lvl = minetest.get_item_group(node.name, "wet")
|
2014-04-16 23:44:58 +02:00
|
|
|
if minetest.find_node_near(pos, 3, {"group:water"}) then
|
|
|
|
-- if it is dry soil and not base node, turn it into wet soil
|
2014-08-21 12:45:14 +02:00
|
|
|
if wet_lvl == 0 then
|
|
|
|
minetest.set_node(pos, {name = wet})
|
2014-04-16 23:44:58 +02:00
|
|
|
end
|
|
|
|
else
|
2014-12-03 18:46:02 +01:00
|
|
|
-- only turn back if there are no unloaded blocks (and therefore
|
|
|
|
-- possible water sources) nearby
|
|
|
|
if not minetest.find_node_near(pos, 3, {"ignore"}) then
|
|
|
|
-- turn it back into base if it is already dry
|
|
|
|
if wet_lvl == 0 then
|
|
|
|
-- only turn it back if there is no plant/seed on top of it
|
|
|
|
if minetest.get_item_group(nn.name, "plant") == 0 and minetest.get_item_group(nn.name, "seed") == 0 then
|
|
|
|
minetest.set_node(pos, {name = base})
|
|
|
|
end
|
2016-11-20 04:24:37 +01:00
|
|
|
|
2014-12-03 18:46:02 +01:00
|
|
|
-- if its wet turn it back into dry soil
|
|
|
|
elseif wet_lvl == 1 then
|
|
|
|
minetest.set_node(pos, {name = dry})
|
2014-04-16 23:44:58 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
|
2020-05-15 00:49:17 +02:00
|
|
|
-- Make default:grass_* occasionally drop wheat seed
|
|
|
|
|
2016-11-20 04:24:37 +01:00
|
|
|
for i = 1, 5 do
|
2014-04-16 23:44:58 +02:00
|
|
|
minetest.override_item("default:grass_"..i, {drop = {
|
|
|
|
max_items = 1,
|
|
|
|
items = {
|
2020-05-15 00:49:17 +02:00
|
|
|
{items = {"farming:seed_wheat"}, rarity = 5},
|
2019-08-01 03:40:39 +02:00
|
|
|
{items = {"default:grass_1"}},
|
2014-04-16 23:44:58 +02:00
|
|
|
}
|
|
|
|
}})
|
|
|
|
end
|
2016-11-20 04:24:37 +01:00
|
|
|
|
2020-05-15 00:49:17 +02:00
|
|
|
|
|
|
|
-- Make default:junglegrass occasionally drop cotton seed.
|
|
|
|
|
|
|
|
-- This is the old source of cotton seeds that makes no sense. It is a leftover
|
|
|
|
-- from Mapgen V6 where junglegrass was the only plant available to be a source.
|
|
|
|
-- This source is kept for now to avoid disruption but should probably be
|
|
|
|
-- removed in future as players get used to the new source.
|
|
|
|
|
2014-04-16 23:44:58 +02:00
|
|
|
minetest.override_item("default:junglegrass", {drop = {
|
|
|
|
max_items = 1,
|
|
|
|
items = {
|
2020-05-15 00:49:17 +02:00
|
|
|
{items = {"farming:seed_cotton"}, rarity = 8},
|
2019-08-01 03:40:39 +02:00
|
|
|
{items = {"default:junglegrass"}},
|
2014-04-16 23:44:58 +02:00
|
|
|
}
|
|
|
|
}})
|
2020-05-15 00:49:17 +02:00
|
|
|
|
|
|
|
|
|
|
|
-- Wild cotton as a source of cotton seed
|
|
|
|
|
|
|
|
minetest.register_node("farming:cotton_wild", {
|
|
|
|
description = S("Wild Cotton"),
|
|
|
|
drawtype = "plantlike",
|
|
|
|
waving = 1,
|
|
|
|
tiles = {"farming_cotton_wild.png"},
|
|
|
|
inventory_image = "farming_cotton_wild.png",
|
|
|
|
wield_image = "farming_cotton_wild.png",
|
|
|
|
paramtype = "light",
|
|
|
|
sunlight_propagates = true,
|
|
|
|
walkable = false,
|
|
|
|
buildable_to = true,
|
|
|
|
groups = {snappy = 3, attached_node = 1, flammable = 4},
|
|
|
|
drop = "farming:seed_cotton",
|
|
|
|
sounds = default.node_sound_leaves_defaults(),
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-6 / 16, -8 / 16, -6 / 16, 6 / 16, 5 / 16, 6 / 16},
|
|
|
|
},
|
|
|
|
})
|