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

Post Reply
User avatar
Hume2
Member
Posts: 621
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?

by Hume2 » Post

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: 329
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?

by CalebJ » Post

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.

User avatar
Hume2
Member
Posts: 621
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?

by Hume2 » Post

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: 329
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?

by CalebJ » Post

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.

User avatar
sorcerykid
Member
Posts: 1462
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?

by sorcerykid » Post

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.

User avatar
Hume2
Member
Posts: 621
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?

by Hume2 » Post

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: 335
Joined: Sun Dec 16, 2018 12:50

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

by Termos » Post

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

User avatar
Hume2
Member
Posts: 621
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?

by Hume2 » Post

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests