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

Hume2
Member
Posts: 630
Joined: Tue Jun 19, 2018 08:24
GitHub: Hume2
In-game: Hume2
Location: Czech Republic

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

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.
If you lack the reality, go on a trip or find a job.

CalebJ
Member
Posts: 338
Joined: Sat Dec 29, 2018 19:21
GitHub: KaylebJay
IRC: KaylebJay
In-game: CalebJ
Location: Tunnelers' Abyss

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

You can use an Active Block Modifier? Maybe I'm misunderstanding.
If you want realism, you're in the wrong place. Get off your mobile.

Hume2
Member
Posts: 630
Joined: Tue Jun 19, 2018 08:24
GitHub: Hume2
In-game: Hume2
Location: Czech Republic

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

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.
If you lack the reality, go on a trip or find a job.

CalebJ
Member
Posts: 338
Joined: Sat Dec 29, 2018 19:21
GitHub: KaylebJay
IRC: KaylebJay
In-game: CalebJ
Location: Tunnelers' Abyss

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

Ah, to check if it is *inside* the active block range. Not sure there :/
If you want realism, you're in the wrong place. Get off your mobile.

sorcerykid
Member
Posts: 1502
Joined: Fri Aug 26, 2016 15:36
GitHub: sorcerykid
In-game: Nemo
Location: Illinois, USA

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

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.

Hume2
Member
Posts: 630
Joined: Tue Jun 19, 2018 08:24
GitHub: Hume2
In-game: Hume2
Location: Czech Republic

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

It's not quite the same. The default radius of loaded chunks is 10 while the radius of active chunks is 3.
If you lack the reality, go on a trip or find a job.

Termos
Member
Posts: 374
Joined: Sun Dec 16, 2018 12:50

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

You could iterate over connected players and return true on the first found within 3 block radius.

Hume2
Member
Posts: 630
Joined: Tue Jun 19, 2018 08:24
GitHub: Hume2
In-game: Hume2
Location: Czech Republic

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

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.
If you lack the reality, go on a trip or find a job.

### Who is online

Users browsing this forum: cuthbertdoublebarrel and 1 guest