Byakuren wrote:The debug dump indicates that mobe has no name field. I am talking about obj, not mobe.
Here is a reannotated version of your code:
(snip)
Thanks, however that's still not it.
I appreciate I may have left some remnants of my debugging that may have confused what I posted, so I have cleared it up, and taken into account your suggestion to check the object rather than the lua entity, as well as checking for players:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
if pointed_thing.type ~= "node" then
if not pointed_thing.ref then return end
local mob = pointed_thing.ref
local mobe = mob:get_luaentity()
if mob:is_player() then return end
minetest.debug("Mob clicked: "..tostring(mobe.name))
for _,obj in pairs(minetest.get_objects_inside_radius(mob:getpos() ,radius)) do
if not obj:is_player() then
minetest.debug("Obj: "..dump(obj))
local oname = obj.name or "nothing"
minetest.debug("Obj name: "..oname)
minetest.debug("Obj: "..dump(obj:get_luaentity() ))
vivarium:bomf(obj:getpos(),1 )
obj:remove()
else
minetest.debug("got a player - skipped")
end -- playercheck
end
return
end
And the resulting debug. Player is detected and skipped, panda object has no name, panda lua entity has no name.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
2016-08-30 03:35:42: [Server]: Mob clicked: dmobs:panda
2016-08-30 03:35:42: [Server]: got a player - skipped
2016-08-30 03:35:42: [Server]: Obj: <userdata>
2016-08-30 03:35:42: [Server]: Obj name: nothing
2016-08-30 03:35:42: [Server]: Obj: {
base_size = {
y = 1,
x = 1
},
base_mesh = "panda.b3d",
health = 18,
old_y = 48,
mesh = "panda.b3d",
time_of_day = 0.75358331203461,
collisionbox = {
-0.4,
-0.5,
-0.4,
0.4,
0.5,
0.4
},
object = <userdata>,
remove_ok = true,
textures = {
"dmobs_panda.png"
},
base_texture = {
"dmobs_panda.png"
},
timer = 0.10799999907613,
path = {
stuck = false,
following = false,
way = {
},
lastpos = {
y = 0,
x = 0,
z = 0
},
stuck_timer = 0
},
env_damage_timer = 0,
lifetimer = 175.81099998765,
old_health = 18,
state = "walk",
standing_in = "air",
visual_size = {
y = 1,
x = 1
},
base_colbox = {
-0.4,
-0.5,
-0.4,
0.4,
0.5,
0.4
}
}
2016-08-30 03:35:42: WARNING[Server]: Deprecated add_particlespawner call with individual parameters instead of definition
2016-08-30 03:35:42: [Server]: Obj: <userdata>
2016-08-30 03:35:42: [Server]: Obj name: nothing
2016-08-30 03:35:42: [Server]: Obj: {
base_size = {
y = 1,
x = 1
},
base_mesh = "panda.b3d",
health = 20,
old_y = 49,
mesh = "panda.b3d",
time_of_day = 0.75358331203461,
collisionbox = {
-0.4,
-0.5,
-0.4,
0.4,
0.5,
0.4
},
object = <userdata>,
remove_ok = true,
textures = {
"dmobs_panda.png"
},
base_texture = {
"dmobs_panda.png"
},
timer = 0.10799999907613,
path = {
stuck = false,
following = false,
way = {
},
lastpos = {
y = 0,
x = 0,
z = 0
},
stuck_timer = 0
},
env_damage_timer = 0,
lifetimer = 177.85100000724,
old_health = 20,
state = "walk",
standing_in = "air",
visual_size = {
y = 1,
x = 1
},
base_colbox = {
-0.4,
-0.5,
-0.4,
0.4,
0.5,
0.4
}
}