1
0
mirror of https://codeberg.org/tenplus1/farming.git synced 2024-11-05 09:50:36 +01:00

tweak soil types to work better with older 0.4.x clients

This commit is contained in:
tenplus1 2022-01-29 09:45:41 +00:00
parent 8842235ec6
commit 60a6bad9d0

129
soil.lua
View File

@ -1,6 +1,11 @@
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 = {
@ -34,29 +39,71 @@ minetest.override_item("default:dirt_with_rainforest_litter", {
}
})
minetest.override_item("default:dirt_with_coniferous_litter", {
soil = {
base = "default:dirt_with_coniferous_litter",
dry = "farming:soil",
wet = "farming:soil_wet"
}
})
if minetest.registered_nodes["default:dirt_with_coniferous_litter"] then
minetest.override_item("default:dry_dirt", {
soil = {
base = "default:dry_dirt",
dry = "farming:dry_soil",
wet = "farming:dry_soil_wet"
}
})
minetest.override_item("default:dirt_with_coniferous_litter", {
soil = {
base = "default:dirt_with_coniferous_litter",
dry = "farming:soil",
wet = "farming:soil_wet"
}
})
end
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"
}
})
-- savanna soil
if minetest.registered_nodes["default:dry_dirt"] then
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"
}
})
minetest.register_node("farming:dry_soil", {
description = S("Savanna Soil"),
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, 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", {
description = S("Wet Savanna Soil"),
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, field = 1},
sounds = default.node_sound_dirt_defaults(),
soil = {
base = "default:dry_dirt",
dry = "farming:dry_soil",
wet = "farming:dry_soil_wet"
}
})
dry_soil = "farming:dry_soil"
end
-- normal soil
minetest.register_node("farming:soil", {
@ -77,7 +124,8 @@ 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"},
"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(),
@ -88,42 +136,11 @@ minetest.register_node("farming:soil_wet", {
}
})
-- savanna soil
if minetest.registered_nodes["default:dry_dirt"] then
minetest.register_node("farming:dry_soil", {
description = S("Savanna Soil"),
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, 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", {
description = S("Wet Savanna Soil"),
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, field = 1},
sounds = default.node_sound_dirt_defaults(),
soil = {
base = "default:dry_dirt",
dry = "farming:dry_soil",
wet = "farming:dry_soil_wet"
}
})
end
-- sand is not soil, change existing sand-soil to use dry soil
minetest.register_alias("farming:desert_sand_soil", "farming:dry_soil")
minetest.register_alias("farming:desert_sand_soil_wet", "farming:dry_soil_wet")
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({