mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-06-06 05:44:26 -04:00
resort that abm content
This commit is contained in:
parent
d00a2bb792
commit
32533f4fd7
1 changed files with 14 additions and 17 deletions
|
@ -125,18 +125,6 @@ minetest.register_abm({
|
||||||
interval = 15,
|
interval = 15,
|
||||||
chance = 4,
|
chance = 4,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
local soil = minetest.registered_nodes[node.name].soil
|
|
||||||
if not soil then
|
|
||||||
error("[farming] field "..node.name.." doesn't have soil")
|
|
||||||
end
|
|
||||||
local wet = soil.wet
|
|
||||||
local base = soil.base
|
|
||||||
local dry = soil.dry
|
|
||||||
if not (wet and base and dry) then
|
|
||||||
error("[farming] field "..node.name..
|
|
||||||
"'s soil must have wet, base and dry")
|
|
||||||
end
|
|
||||||
|
|
||||||
pos.y = pos.y + 1
|
pos.y = pos.y + 1
|
||||||
local nn = minetest.get_node_or_nil(pos)
|
local nn = minetest.get_node_or_nil(pos)
|
||||||
if not nn then
|
if not nn then
|
||||||
|
@ -145,6 +133,14 @@ minetest.register_abm({
|
||||||
local nn_def = minetest.registered_nodes[nn.name]
|
local nn_def = minetest.registered_nodes[nn.name]
|
||||||
pos.y = pos.y - 1
|
pos.y = pos.y - 1
|
||||||
|
|
||||||
|
local soil = minetest.registered_nodes[node.name].soil
|
||||||
|
assert(soil, "[farming] field "..node.name.." doesn't have soil")
|
||||||
|
local wet = soil.wet
|
||||||
|
local base = soil.base
|
||||||
|
local dry = soil.dry
|
||||||
|
assert(wet and base and dry, "[farming] field "..node.name..
|
||||||
|
"'s soil must have wet, base and dry")
|
||||||
|
|
||||||
if nn_def and nn_def.walkable and
|
if nn_def and nn_def.walkable and
|
||||||
minetest.get_item_group(nn.name, "plant") == 0 then
|
minetest.get_item_group(nn.name, "plant") == 0 then
|
||||||
node.name = base
|
node.name = base
|
||||||
|
@ -152,6 +148,12 @@ minetest.register_abm({
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- only turn back if there are no unloaded blocks (and therefore
|
||||||
|
-- possible water sources) nearby
|
||||||
|
if minetest.find_node_near(pos, 3, {"ignore"}) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- check if there is water nearby
|
-- check if there is water nearby
|
||||||
local wet_lvl = minetest.get_item_group(node.name, "wet")
|
local wet_lvl = minetest.get_item_group(node.name, "wet")
|
||||||
if minetest.find_node_near(pos, 3, {"group:water"}) then
|
if minetest.find_node_near(pos, 3, {"group:water"}) then
|
||||||
|
@ -163,11 +165,6 @@ minetest.register_abm({
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- only turn back if there are no unloaded blocks (and therefore
|
|
||||||
-- possible water sources) nearby
|
|
||||||
if minetest.find_node_near(pos, 3, {"ignore"}) then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
-- turn it back into base if it is already dry
|
-- turn it back into base if it is already dry
|
||||||
if wet_lvl == 0 then
|
if wet_lvl == 0 then
|
||||||
-- only turn it back if there is no plant/seed on top of it
|
-- only turn it back if there is no plant/seed on top of it
|
||||||
|
|
Loading…
Add table
Reference in a new issue