mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Make line_of_sight return blocking node position
This commit is contained in:
parent
33de69a173
commit
d9ef072305
4 changed files with 16 additions and 6 deletions
|
@ -354,7 +354,7 @@ ServerMap & ServerEnvironment::getServerMap()
|
|||
return *m_map;
|
||||
}
|
||||
|
||||
bool ServerEnvironment::line_of_sight(v3f pos1, v3f pos2, float stepsize)
|
||||
bool ServerEnvironment::line_of_sight(v3f pos1, v3f pos2, float stepsize, v3s16 *p)
|
||||
{
|
||||
float distance = pos1.getDistanceFrom(pos2);
|
||||
|
||||
|
@ -372,6 +372,9 @@ bool ServerEnvironment::line_of_sight(v3f pos1, v3f pos2, float stepsize)
|
|||
MapNode n = getMap().getNodeNoEx(pos);
|
||||
|
||||
if(n.param0 != CONTENT_AIR) {
|
||||
if (p) {
|
||||
*p = pos;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue