It looks like I cannot prevent it from happening because it is probably connected to the villager entity unloading and refill_plant calling via minetest.after.
So, can you please add some code like
Code: Select all
if not inv then
return
end
Code: Select all
if not inv then
return
end
Code: Select all
minetest.register_abm({
nodenames = {"default:dirt_with_grass"},
neighbors = {"default:water_source", "default:water_flowing"},
interval = 10.0, -- Run every 10 seconds
chance = 50, -- Select every 1 in 50 nodes
action = function(pos, node, active_object_count, active_object_count_wider)
minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z}, {name = "aliens:grass"})
end
})
Code: Select all
minetest.register_abm()
Code: Select all
minetest.register_abm({
key = value,
key = value,
key = value,
})
Code: Select all
minetest.register_abm({
key = value,
key = value,
action = function(pos)
SOME CODE GOES HERE
end,
})
Code: Select all
pos = {x = pos.x, y = pos.y + 1, z = pos.z}
Code: Select all
if pos{"default:air"} then
Code: Select all
local node = minetest.get_node(pos)
if node.name = "air" then
SOME CODE GOES HERE
end
Code: Select all
minetest.register_abm({
key = value,
key = value,
key = value,
})
Code: Select all
minetest.register_abm({
-- key-value pairs
nodenames = {"farming:infinisoil"},
interval = 10.0, -- Run every 10 seconds,
-- all of the code should be inside the function
action = function(infiniy)
infiniy = {x = pos.x, y = pos.y + 1, z = pos.z}
infinimeta = set_string("infinisoilplant", minetest.get_meta {infiniy})
local node = minetest.get_node(infiniy)
if node.name == "air" then
minetest.swap_node{x = pos.x, y = pos.y + 1, z = pos.z, infinimeta}
end
end
})
Code: Select all
minetest.get_meta {infiniy}
Code: Select all
minetest.swap_node{x = pos.x, y = pos.y + 1, z = pos.z, infinimeta}
Code: Select all
infiniy = {x = pos.x, y = pos.y + 1, z = pos.z}
Code: Select all
minetest.register_abm({
nodenames = {"farming:infinisoil"},
interval = 10.0, -- Run every 10 seconds,
action = function(infiniy)
infiniy = {x = pos.x, y = pos.y + 1, z = pos.z}
infinimeta = set_string("infinisoilplant", minetest.get_meta(infiniy))
local node = minetest.get_node(infiniy)
if node.name == "air" then
minetest.swap_node(x = pos.x, y = pos.y + 1, z = pos.z, infinimeta)
end
end
})
Code: Select all
minetest.swap_node(pos, node)
Code: Select all
minetest.swap_node({x = pos.x, y = pos.y + 1, z = pos.z}, node)
minetest.swap_node(infiniy, node)
Code: Select all
infinimeta = set_string("infinisoilplant", minetest.get_meta(infiniy))
Code: Select all
local meta = minetest.get_meta(pos)
meta:set_string("key", "value")
Code: Select all
local infiniy = {x = pos.x, y = pos.y + 1, z = pos.z}
local infinimeta = minetest.get_meta(pos)
I am not quite sure why you would want to use an ABM for this. ABMs and LBMs run continuously on the background; why would you use an ABM for something that only happens when a block is right-clicked?okay, so heres what i have now, the infiniy is supposed to grab the block above the current block, and then get its data on right click, then if the block above is air, replace it with the stored metadata (infinimeta) block
Code: Select all
minetest.register_node(":farming:admin_soil", {
description = "Admin Soil",
tiles = {
"default_dirt.png^farming_soil_wet.png",
"default_dirt.png^farming_soil_wet_side.png"
},
drop = "default:dirt", -- drops normal soil so players cannot steal admin soil
groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 3, field = 1},
sounds = default.node_sound_dirt_defaults(),
on_timer = function(pos, elapsed)
-- get meta string inside soil and node above with definition
local meta = minetest.get_meta(pos)
local crop = meta:get_string("crop") or ""
local pos2 = {x = pos.x, y = pos.y + 1, z = pos.z}
local node = minetest.get_node(pos2)
local def = minetest.registered_nodes[node.name]
local is_crop = def and def.groups and def.groups.growing
-- if 'crop' meta is empty and crop planted above, set default crop
if crop == "" and is_crop then
meta:set_string("crop", node.name) ; print("==set")
end
-- if no crop planted and default 'crop' set then replant
if node.name == "air" and crop ~= "" then
minetest.set_node(pos2, {name = crop}) ; print("==planted")
end
return true -- restart timer
end,
on_construct = function(pos)
local timer = minetest.get_node_timer(pos)
timer:start(10) -- every 10 seconds
end
})
In /usr/share/ it is the original (?) mod, in /.minetest/mods Farming Redo.2022-08-10 20:06:28: WARNING[Main]: Will not load: /usr/share/minetest/games/minetest_game/mods/farming
2022-08-10 20:06:28: WARNING[Main]: Overridden by: /home/beheerder/.minetest/mods/farming
Ignore it, it's working as intended. This mod will override the farming mod that's included with Minetest Game. Don't worry though, it's a superset of the base game's farming mod.
Users browsing this forum: No registered users and 41 guests