Page 1 of 1

A function to detect if a node is inside the active block radius?

Posted: Fri May 08, 2020 18:13
by Hume2
Is there any such function to do this? Of course that I can iterate over all players and check the distance ... but ... there should be a better option. Minetest should somehow know which chunks are active and which aren't so I shouldn't need to calculate it myself.

Re: A function to detect if a node is inside the active block radius?

Posted: Fri May 08, 2020 18:30
by CalebJ
You can use an Active Block Modifier? Maybe I'm misunderstanding.

Re: A function to detect if a node is inside the active block radius?

Posted: Fri May 08, 2020 18:31
by Hume2
No, I have a postion and I want to check if the node at the position is active, regardless of what kind of node it is.

Re: A function to detect if a node is inside the active block radius?

Posted: Fri May 08, 2020 18:50
by CalebJ
Ah, to check if it is *inside* the active block range. Not sure there :/

Re: A function to detect if a node is inside the active block radius?

Posted: Mon May 11, 2020 19:33
by sorcerykid
It might be best to just check minetest.get_node_or_nil(). That won't tell if the mapblock is in the active block radius, but it will at least tell if the mapblock is loaded which is usually the same thing iirc.

Re: A function to detect if a node is inside the active block radius?

Posted: Tue May 12, 2020 04:53
by Hume2
It's not quite the same. The default radius of loaded chunks is 10 while the radius of active chunks is 3.

Re: A function to detect if a node is inside the active block radius?

Posted: Tue May 12, 2020 11:16
by Termos
You could iterate over connected players and return true on the first found within 3 block radius.

Re: A function to detect if a node is inside the active block radius?

Posted: Tue May 12, 2020 12:19
by Hume2
That's what I wrote in the OP. I'm asking if there is a better solution because Minetest somehow has to know that anyway so I see no point of calculating it myself.