upgrade beds,boats,bucket,carts,creative,doors,farming,fire,stairs,tnt,wool
* beds https://codeberg.org/minenux/minetest-mod-beds/commit/7b6fae96d5e273dad9a373e63eb958145c9bfbef
* boats https://codeberg.org/minenux/minetest-mod-boats/commit/3832de08f705d5d2e7b5a971760e5fad1653305f
* bucket https://codeberg.org/minenux/minetest-mod-bucket/commit/1d9f32295aba3ef2a86be302050f34c1766e93d5
* carts https://codeberg.org/minenux/minetest-mod-carts/commit/dcbca916cffdcec281f0129ef350db2686bda933
* creative https://codeberg.org/minenux/minetest-mod-creative/commit/ca09e773701f834fec7de18bf13598b3323778db
* doors https://codeberg.org/minenux/minetest-mod-doors/commit/a89ab0454deb4933b6e4971c57055c40b7938e5b
* farming https://codeberg.org/minenux/minetest-mod-farming/commit/00e4b3cb89d3c1b1d66b6af4821191c1d667e1bc
* fire https://codeberg.org/minenux/minetest-mod-fire/commit/4e5f7ad55314bd9b126fb133cfc5a32fa58b20d2
* stairs https://codeberg.org/minenux/minetest-mod-stairs/commit/c3a5af6c452daca599d226df694df1b75f15c110
* tnt https://codeberg.org/minenux/minetest-mod-tnt/commit/8195861f905a90b53cd52348deb34df41a053027
* wool https://codeberg.org/minenux/minetest-mod-wool/commit/de642a08e80bfd7a4a1e5629e50458a609dbda3a
2022-03-09 12:47:54 -04:00
|
|
|
|
|
|
|
local S = farming.intllib
|
|
|
|
|
|
|
|
|
|
|
|
-- default dry soil node
|
|
|
|
local dry_soil = "farming:soil"
|
|
|
|
|
|
|
|
|
|
|
|
-- add soil types to existing dirt blocks
|
|
|
|
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"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.override_item("default:dirt_with_dry_grass", {
|
|
|
|
soil = {
|
|
|
|
base = "default:dirt_with_dry_grass",
|
|
|
|
dry = "farming:soil",
|
|
|
|
wet = "farming:soil_wet"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.override_item("default:dirt_with_rainforest_litter", {
|
|
|
|
soil = {
|
|
|
|
base = "default:dirt_with_rainforest_litter",
|
|
|
|
dry = "farming:soil",
|
|
|
|
wet = "farming:soil_wet"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
if not minetest.registered_nodes[":default:dirt_with_coniferous_litter"] then
|
|
|
|
minetest.register_alias("default:dirt_with_coniferous_litter", "default:dirt_with_dry_grass")
|
|
|
|
end
|
|
|
|
minetest.override_item("default:dirt_with_coniferous_litter", {
|
|
|
|
soil = {
|
|
|
|
base = "default:dirt_with_dry_grass",
|
|
|
|
dry = "farming:soil",
|
|
|
|
wet = "farming:soil_wet"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
if not minetest.registered_nodes[":default:dry_dirt"] then
|
|
|
|
minetest.register_alias("default:dry_dirt", "default:dirt")
|
|
|
|
end
|
|
|
|
minetest.override_item("default:dry_dirt", {
|
|
|
|
soil = {
|
|
|
|
base = "default:dirt",
|
|
|
|
dry = "farming:dry_soil",
|
|
|
|
wet = "farming:dry_soil_wet"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
if not minetest.registered_nodes[":default:dry_dirt_with_dry_grass"] then
|
|
|
|
minetest.register_alias("default:dry_dirt_with_dry_grass", "default:dirt_with_dry_grass")
|
|
|
|
end
|
|
|
|
minetest.override_item("default:dry_dirt_with_dry_grass", {
|
|
|
|
soil = {
|
|
|
|
base = "default:dirt_with_dry_grass",
|
|
|
|
dry = "farming:dry_soil",
|
|
|
|
wet = "farming:dry_soil_wet"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
-- normal soil
|
|
|
|
minetest.register_node("farming:soil", {
|
|
|
|
description = S("Soil"),
|
|
|
|
tiles = {"default_dirt.png^farming_soil.png", "default_dirt.png"},
|
|
|
|
drop = "default:dirt",
|
|
|
|
groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 2, field = 1},
|
|
|
|
sounds = default.node_sound_dirt_defaults(),
|
|
|
|
soil = {
|
|
|
|
base = "default:dirt",
|
|
|
|
dry = "farming:soil",
|
|
|
|
wet = "farming:soil_wet"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
-- wet soil
|
|
|
|
minetest.register_node("farming:soil_wet", {
|
|
|
|
description = S("Wet Soil"),
|
|
|
|
tiles = {
|
|
|
|
"default_dirt.png^farming_soil_wet.png",
|
|
|
|
"default_dirt.png^farming_soil_wet_side.png"
|
|
|
|
},
|
|
|
|
drop = "default:dirt",
|
|
|
|
groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 3, field = 1},
|
|
|
|
sounds = default.node_sound_dirt_defaults(),
|
|
|
|
soil = {
|
|
|
|
base = "default:dirt",
|
|
|
|
dry = "farming:soil",
|
|
|
|
wet = "farming:soil_wet"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
-- sand is not soil, change existing sand-soil to use dry soil
|
|
|
|
minetest.register_alias("farming:desert_sand_soil", dry_soil)
|
|
|
|
minetest.register_alias("farming:desert_sand_soil_wet", dry_soil .. "_wet")
|
|
|
|
|
|
|
|
|
|
|
|
-- if water near soil then change to wet soil
|
|
|
|
minetest.register_abm({
|
2023-06-06 11:30:05 -04:00
|
|
|
label = "Soil changes",
|
upgrade beds,boats,bucket,carts,creative,doors,farming,fire,stairs,tnt,wool
* beds https://codeberg.org/minenux/minetest-mod-beds/commit/7b6fae96d5e273dad9a373e63eb958145c9bfbef
* boats https://codeberg.org/minenux/minetest-mod-boats/commit/3832de08f705d5d2e7b5a971760e5fad1653305f
* bucket https://codeberg.org/minenux/minetest-mod-bucket/commit/1d9f32295aba3ef2a86be302050f34c1766e93d5
* carts https://codeberg.org/minenux/minetest-mod-carts/commit/dcbca916cffdcec281f0129ef350db2686bda933
* creative https://codeberg.org/minenux/minetest-mod-creative/commit/ca09e773701f834fec7de18bf13598b3323778db
* doors https://codeberg.org/minenux/minetest-mod-doors/commit/a89ab0454deb4933b6e4971c57055c40b7938e5b
* farming https://codeberg.org/minenux/minetest-mod-farming/commit/00e4b3cb89d3c1b1d66b6af4821191c1d667e1bc
* fire https://codeberg.org/minenux/minetest-mod-fire/commit/4e5f7ad55314bd9b126fb133cfc5a32fa58b20d2
* stairs https://codeberg.org/minenux/minetest-mod-stairs/commit/c3a5af6c452daca599d226df694df1b75f15c110
* tnt https://codeberg.org/minenux/minetest-mod-tnt/commit/8195861f905a90b53cd52348deb34df41a053027
* wool https://codeberg.org/minenux/minetest-mod-wool/commit/de642a08e80bfd7a4a1e5629e50458a609dbda3a
2022-03-09 12:47:54 -04:00
|
|
|
nodenames = {"group:field"},
|
|
|
|
interval = 15,
|
|
|
|
chance = 4,
|
|
|
|
catch_up = false,
|
|
|
|
|
|
|
|
action = function(pos, node)
|
|
|
|
|
|
|
|
local ndef = minetest.registered_nodes[node.name]
|
|
|
|
if not ndef or not ndef.soil or not ndef.soil.wet
|
|
|
|
or not ndef.soil.base or not ndef.soil.dry then return end
|
|
|
|
|
|
|
|
pos.y = pos.y + 1
|
|
|
|
local nn = minetest.get_node_or_nil(pos)
|
|
|
|
pos.y = pos.y - 1
|
|
|
|
|
|
|
|
if nn then nn = nn.name else return end
|
|
|
|
|
|
|
|
-- what's on top of soil, if solid/not plant change soil to dirt
|
|
|
|
if minetest.registered_nodes[nn]
|
|
|
|
and minetest.registered_nodes[nn].walkable
|
2023-06-06 11:30:05 -04:00
|
|
|
and minetest.get_item_group(nn, "plant") == 0
|
|
|
|
and minetest.get_item_group(nn, "growing") == 0 then
|
|
|
|
|
upgrade beds,boats,bucket,carts,creative,doors,farming,fire,stairs,tnt,wool
* beds https://codeberg.org/minenux/minetest-mod-beds/commit/7b6fae96d5e273dad9a373e63eb958145c9bfbef
* boats https://codeberg.org/minenux/minetest-mod-boats/commit/3832de08f705d5d2e7b5a971760e5fad1653305f
* bucket https://codeberg.org/minenux/minetest-mod-bucket/commit/1d9f32295aba3ef2a86be302050f34c1766e93d5
* carts https://codeberg.org/minenux/minetest-mod-carts/commit/dcbca916cffdcec281f0129ef350db2686bda933
* creative https://codeberg.org/minenux/minetest-mod-creative/commit/ca09e773701f834fec7de18bf13598b3323778db
* doors https://codeberg.org/minenux/minetest-mod-doors/commit/a89ab0454deb4933b6e4971c57055c40b7938e5b
* farming https://codeberg.org/minenux/minetest-mod-farming/commit/00e4b3cb89d3c1b1d66b6af4821191c1d667e1bc
* fire https://codeberg.org/minenux/minetest-mod-fire/commit/4e5f7ad55314bd9b126fb133cfc5a32fa58b20d2
* stairs https://codeberg.org/minenux/minetest-mod-stairs/commit/c3a5af6c452daca599d226df694df1b75f15c110
* tnt https://codeberg.org/minenux/minetest-mod-tnt/commit/8195861f905a90b53cd52348deb34df41a053027
* wool https://codeberg.org/minenux/minetest-mod-wool/commit/de642a08e80bfd7a4a1e5629e50458a609dbda3a
2022-03-09 12:47:54 -04:00
|
|
|
minetest.set_node(pos, {name = ndef.soil.base})
|
|
|
|
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2023-06-06 11:30:05 -04:00
|
|
|
-- check if water is within 3 nodes
|
|
|
|
if minetest.find_node_near(pos, 3, {"group:water"}) then
|
upgrade beds,boats,bucket,carts,creative,doors,farming,fire,stairs,tnt,wool
* beds https://codeberg.org/minenux/minetest-mod-beds/commit/7b6fae96d5e273dad9a373e63eb958145c9bfbef
* boats https://codeberg.org/minenux/minetest-mod-boats/commit/3832de08f705d5d2e7b5a971760e5fad1653305f
* bucket https://codeberg.org/minenux/minetest-mod-bucket/commit/1d9f32295aba3ef2a86be302050f34c1766e93d5
* carts https://codeberg.org/minenux/minetest-mod-carts/commit/dcbca916cffdcec281f0129ef350db2686bda933
* creative https://codeberg.org/minenux/minetest-mod-creative/commit/ca09e773701f834fec7de18bf13598b3323778db
* doors https://codeberg.org/minenux/minetest-mod-doors/commit/a89ab0454deb4933b6e4971c57055c40b7938e5b
* farming https://codeberg.org/minenux/minetest-mod-farming/commit/00e4b3cb89d3c1b1d66b6af4821191c1d667e1bc
* fire https://codeberg.org/minenux/minetest-mod-fire/commit/4e5f7ad55314bd9b126fb133cfc5a32fa58b20d2
* stairs https://codeberg.org/minenux/minetest-mod-stairs/commit/c3a5af6c452daca599d226df694df1b75f15c110
* tnt https://codeberg.org/minenux/minetest-mod-tnt/commit/8195861f905a90b53cd52348deb34df41a053027
* wool https://codeberg.org/minenux/minetest-mod-wool/commit/de642a08e80bfd7a4a1e5629e50458a609dbda3a
2022-03-09 12:47:54 -04:00
|
|
|
|
2023-06-06 11:30:05 -04:00
|
|
|
-- only change if it's not already wet soil
|
|
|
|
if node.name ~= ndef.soil.wet then
|
|
|
|
minetest.set_node(pos, {name = ndef.soil.wet})
|
|
|
|
end
|
upgrade beds,boats,bucket,carts,creative,doors,farming,fire,stairs,tnt,wool
* beds https://codeberg.org/minenux/minetest-mod-beds/commit/7b6fae96d5e273dad9a373e63eb958145c9bfbef
* boats https://codeberg.org/minenux/minetest-mod-boats/commit/3832de08f705d5d2e7b5a971760e5fad1653305f
* bucket https://codeberg.org/minenux/minetest-mod-bucket/commit/1d9f32295aba3ef2a86be302050f34c1766e93d5
* carts https://codeberg.org/minenux/minetest-mod-carts/commit/dcbca916cffdcec281f0129ef350db2686bda933
* creative https://codeberg.org/minenux/minetest-mod-creative/commit/ca09e773701f834fec7de18bf13598b3323778db
* doors https://codeberg.org/minenux/minetest-mod-doors/commit/a89ab0454deb4933b6e4971c57055c40b7938e5b
* farming https://codeberg.org/minenux/minetest-mod-farming/commit/00e4b3cb89d3c1b1d66b6af4821191c1d667e1bc
* fire https://codeberg.org/minenux/minetest-mod-fire/commit/4e5f7ad55314bd9b126fb133cfc5a32fa58b20d2
* stairs https://codeberg.org/minenux/minetest-mod-stairs/commit/c3a5af6c452daca599d226df694df1b75f15c110
* tnt https://codeberg.org/minenux/minetest-mod-tnt/commit/8195861f905a90b53cd52348deb34df41a053027
* wool https://codeberg.org/minenux/minetest-mod-wool/commit/de642a08e80bfd7a4a1e5629e50458a609dbda3a
2022-03-09 12:47:54 -04:00
|
|
|
|
2023-06-06 11:30:05 -04:00
|
|
|
-- only dry out soil if no unloaded blocks nearby, just incase
|
|
|
|
elseif not minetest.find_node_near(pos, 3, {"ignore"}) then
|
upgrade beds,boats,bucket,carts,creative,doors,farming,fire,stairs,tnt,wool
* beds https://codeberg.org/minenux/minetest-mod-beds/commit/7b6fae96d5e273dad9a373e63eb958145c9bfbef
* boats https://codeberg.org/minenux/minetest-mod-boats/commit/3832de08f705d5d2e7b5a971760e5fad1653305f
* bucket https://codeberg.org/minenux/minetest-mod-bucket/commit/1d9f32295aba3ef2a86be302050f34c1766e93d5
* carts https://codeberg.org/minenux/minetest-mod-carts/commit/dcbca916cffdcec281f0129ef350db2686bda933
* creative https://codeberg.org/minenux/minetest-mod-creative/commit/ca09e773701f834fec7de18bf13598b3323778db
* doors https://codeberg.org/minenux/minetest-mod-doors/commit/a89ab0454deb4933b6e4971c57055c40b7938e5b
* farming https://codeberg.org/minenux/minetest-mod-farming/commit/00e4b3cb89d3c1b1d66b6af4821191c1d667e1bc
* fire https://codeberg.org/minenux/minetest-mod-fire/commit/4e5f7ad55314bd9b126fb133cfc5a32fa58b20d2
* stairs https://codeberg.org/minenux/minetest-mod-stairs/commit/c3a5af6c452daca599d226df694df1b75f15c110
* tnt https://codeberg.org/minenux/minetest-mod-tnt/commit/8195861f905a90b53cd52348deb34df41a053027
* wool https://codeberg.org/minenux/minetest-mod-wool/commit/de642a08e80bfd7a4a1e5629e50458a609dbda3a
2022-03-09 12:47:54 -04:00
|
|
|
|
2023-06-06 11:30:05 -04:00
|
|
|
if node.name == ndef.soil.wet then
|
|
|
|
minetest.set_node(pos, {name = ndef.soil.dry})
|
|
|
|
|
|
|
|
-- if crop or seed found don't turn to dry soil
|
|
|
|
elseif node.name == ndef.soil.dry
|
|
|
|
and minetest.get_item_group(nn, "plant") == 0
|
|
|
|
and minetest.get_item_group(nn, "growing") == 0 then
|
|
|
|
minetest.set_node(pos, {name = ndef.soil.base})
|
|
|
|
end
|
upgrade beds,boats,bucket,carts,creative,doors,farming,fire,stairs,tnt,wool
* beds https://codeberg.org/minenux/minetest-mod-beds/commit/7b6fae96d5e273dad9a373e63eb958145c9bfbef
* boats https://codeberg.org/minenux/minetest-mod-boats/commit/3832de08f705d5d2e7b5a971760e5fad1653305f
* bucket https://codeberg.org/minenux/minetest-mod-bucket/commit/1d9f32295aba3ef2a86be302050f34c1766e93d5
* carts https://codeberg.org/minenux/minetest-mod-carts/commit/dcbca916cffdcec281f0129ef350db2686bda933
* creative https://codeberg.org/minenux/minetest-mod-creative/commit/ca09e773701f834fec7de18bf13598b3323778db
* doors https://codeberg.org/minenux/minetest-mod-doors/commit/a89ab0454deb4933b6e4971c57055c40b7938e5b
* farming https://codeberg.org/minenux/minetest-mod-farming/commit/00e4b3cb89d3c1b1d66b6af4821191c1d667e1bc
* fire https://codeberg.org/minenux/minetest-mod-fire/commit/4e5f7ad55314bd9b126fb133cfc5a32fa58b20d2
* stairs https://codeberg.org/minenux/minetest-mod-stairs/commit/c3a5af6c452daca599d226df694df1b75f15c110
* tnt https://codeberg.org/minenux/minetest-mod-tnt/commit/8195861f905a90b53cd52348deb34df41a053027
* wool https://codeberg.org/minenux/minetest-mod-wool/commit/de642a08e80bfd7a4a1e5629e50458a609dbda3a
2022-03-09 12:47:54 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
})
|