minetest.env:get_objects_inside_radius(p, r)
for _,object in ipairs(minetest.env:get_objects_inside_radius(p, r)) do
[your code here]
end
pandaro wrote:Can I run a function within an area not loaded?
I tried using the "on_step", but if I walk away too, minetest off my entity.
I tried through minetest.register_ABM, but the result is the same.
I doing something wrong? Maybe I can not do it?
if this topic has already been discussed, I apologize, and ask you only to show me the link.
thanks
test={}
minetest.register_node("test:key", {
description = "key",
tiles = {"testkey.png"},
is_ground_content = true,
groups = {cracky=1},
drop = 'test:key',
legacy_mineral = true,
stack_max = 49,
paramtype="none",
paramtype1="none",
paramtype2="none",
after_place_node = function(pos)
local chest = minetest.env:get_node({x=pos.x,y=pos.y-1,z=pos.z})
local key = minetest.env:get_node(pos)
print(dump(chest))
print(dump(key))
end,
})
minetest.register_node("test:chest", {
description = "chest",
tiles = {"testchest.png"},
is_ground_content = true,
groups = {cracky=1},
drop = 'test:chest',
legacy_mineral = true,
stack_max = 49,
on_construct = function(pos)
local code = pos.x..","..pos.y..","..pos.z
minetest.env:place_node({x=pos.x,y=pos.y+1,z=pos.z},{name="test:key",param1=99,param2=34})
end,
})
13:07:36: ACTION[ServerThread]: singleplayer places node test:chest at (3,2,2)
13:07:36: ACTION[ServerThread]: places node test:key at (3,3,2)
{param1 = 0, name = "test:chest", param2 = 0}
{param1 = 0, name = "test:key", param2 = 0}
minetest.register_node("test:x", {
description = "test ",
inventory_image = ("x.png"),
tiles = {"x.png"},
on_blast=function(pos,intensity)
print("hello")
print(dump(pos))
print(tostring(intensity))
end,
})
pandaro wrote:hello guys....
again:
I'm trying to use the function on_blast (pos, intensity)
but I can not
what is wrong?
here the code:minetest.register_node("test:x", {
description = "test ",
inventory_image = ("x.png"),
tiles = {"x.png"},
on_blast=function(pos,intensity)
print("hello")
print(dump(pos))
print(tostring(intensity))
end,
})
Nothing prints
pandaro wrote:hello guys....
again:
I'm trying to use the function on_blast (pos, intensity)
but I can not
what is wrong?
here the code:minetest.register_node("test:x", {
description = "test ",
inventory_image = ("x.png"),
tiles = {"x.png"},
on_blast=function(pos,intensity)
print("hello")
print(dump(pos))
print(tostring(intensity))
end,
})
Nothing prints
That's normal, you should never put a "," after "end" if I recall correctly.
23:07:55: ERROR[main]: ...-5/minetest-master/bin/../games/minetest_game/mods/closed_chest/init.lua:256: '}' expected (to close '{' at line 184) near 'can_dig'
Users browsing this forum: No registered users and 4 guests