ABM gets executed even if node(block) is not longer in group

User avatar
addi
Member
 
Posts: 605
Joined: Thu Sep 20, 2012 03:16

ABM gets executed even if node(block) is not longer in group

by addi » Sun Jan 10, 2016 10:09

If you remove a group of an node (igniter group of lava_source) and there is a abm registered to this node (fire) than the abm does trigger on this node. (burnable nodes starts burning)

example:
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
minetest.override_item("default:lava_source", {
    groups = {lava = 3, liquid = 2, igniter = nil, hot = 3},--remove igniter from lava source
})

expected behaviour: Lava will not longer burn nodes.
real behaviour: Lava still sets nodes on fire
if you check
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
minetest.registered_nodes["default:lava_source"].groups

it shows what you expect:
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
{
   liquid = 2,
   lava = 3,
   hot = 3
}
(igniter is not aviable)

but the fire ABM
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
minetest.register_abm({
    nodenames = {"group:flammable"},
    neighbors = {"group:igniter"},

still gets executed

To reproduce this behaviour install test mod in attachment and place a burnable node near lava_source
Attachments
test.zip
Test mod to reproduce the bug
(696 Bytes) Downloaded 67 times
 

kahrl
Member
 
Posts: 236
Joined: Fri Sep 02, 2011 07:51

Re: ABM gets executed even if node(block) is not longer in g

by kahrl » Sun Jan 10, 2016 16:35

Yes, this is a bug / missing feature in CNodeDefManager::set() which is called when registering or overriding a node. There is a data structure that maps each group to a list of nodes in that group. CNodeDefManager::set() adds the node to each group it is in, but it doesn't remove it from groups it is no longer in.

This is even mentioned in a comment inside that method: "// FIXME: This should remove a node from groups it no longer belongs to when a node is re-registered."
 


Return to Minetest Problems

Who is online

Users browsing this forum: No registered users and 6 guests

cron