mirror of
https://codeberg.org/tenplus1/farming.git
synced 2024-12-28 11:40:16 +01:00
return to default wet soil behaviour (within 3 nodes all axis)
tweak wet soil > dry soil behaviour to run better
This commit is contained in:
parent
2446f3d76c
commit
ad9b0dc255
19
soil.lua
19
soil.lua
@ -165,8 +165,11 @@ minetest.register_abm({
|
|||||||
-- what's on top of soil, if solid/not plant change soil to dirt
|
-- what's on top of soil, if solid/not plant change soil to dirt
|
||||||
if minetest.registered_nodes[nn]
|
if minetest.registered_nodes[nn]
|
||||||
and minetest.registered_nodes[nn].walkable
|
and minetest.registered_nodes[nn].walkable
|
||||||
and minetest.get_item_group(nn, "plant") == 0 then
|
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})
|
minetest.set_node(pos, {name = ndef.soil.base})
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -175,19 +178,21 @@ minetest.register_abm({
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- check if water is within 3 nodes horizontally and 1 below
|
-- check if water is within 3 nodes
|
||||||
if #minetest.find_nodes_in_area(
|
if minetest.find_node_near(pos, 3, {"group:water"}) then
|
||||||
{x = pos.x + 3, y = pos.y - 1, z = pos.z + 3},
|
|
||||||
{x = pos.x - 3, y = pos.y , z = pos.z - 3},
|
|
||||||
{"group:water"}) > 0 then
|
|
||||||
|
|
||||||
|
-- only change if it's not already wet soil
|
||||||
|
if node.name ~= ndef.soil.wet then
|
||||||
minetest.set_node(pos, {name = ndef.soil.wet})
|
minetest.set_node(pos, {name = ndef.soil.wet})
|
||||||
|
end
|
||||||
|
|
||||||
elseif node.name == ndef.soil.wet then
|
elseif node.name == ndef.soil.wet then
|
||||||
minetest.set_node(pos, {name = ndef.soil.dry})
|
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
|
elseif node.name == ndef.soil.dry
|
||||||
and minetest.get_item_group(nn, "plant") == 0 then
|
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})
|
minetest.set_node(pos, {name = ndef.soil.base})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user