Page 1 of 1

minetest.line_of_sight wierdness

PostPosted: Sun Nov 24, 2013 17:50
by stu
https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L1305
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.line_of_sight(pos1,pos2,stepsize) ->true/false
^ checkif there is a direct line of sight between pos1 and pos2


For some reason when I call this function it only ever returns the given stepsize or nil.
This seems strange since the only reference to it I can find is in environment.cpp

https://github.com/minetest/minetest/blob/master/src/environment.cpp#L357

This looks like it should indeed return true or false.

PostPosted: Sun Nov 24, 2013 17:53
by PilzAdam
What Minetest version do you use?

PostPosted: Sun Nov 24, 2013 19:22
by stu
PilzAdam wrote:What Minetest version do you use?

It's a fairly recent build compiled just after kaeza's changes to player.lua model handling.
Will update to 0.4.8 soon but I don't see any changes to line_of_sight in environment.cpp

PostPosted: Sun Nov 24, 2013 19:26
by PilzAdam
stu wrote:
PilzAdam wrote:What Minetest version do you use?

It's a fairly recent build compiled just after kaeza's changes to player.lua model handling.
Will update to 0.4.8 soon but I don't see any changes to line_of_sight in environment.cpp

I remember that line_of_sight() was broken and got fixed, it also seems to work for me now.

PostPosted: Sun Nov 24, 2013 19:47
by stu
PilzAdam wrote:
stu wrote:
PilzAdam wrote:What Minetest version do you use?

It's a fairly recent build compiled just after kaeza's changes to player.lua model handling.
Will update to 0.4.8 soon but I don't see any changes to line_of_sight in environment.cpp

I remember that line_of_sight() was broken and got fixed, it also seems to work for me now.


line_of_sight() works for me, only the return value is not what is documented. I will update now and see if that changes anything.

Thanks.

PostPosted: Sun Nov 24, 2013 22:59
by PilzAdam
It was sapier!

PostPosted: Mon Nov 25, 2013 00:55
by Iqualfragile