diff options
Diffstat (limited to 'src/script/lua_api')
-rw-r--r-- | src/script/lua_api/l_env.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp index 4a8150396..d01889401 100644 --- a/src/script/lua_api/l_env.cpp +++ b/src/script/lua_api/l_env.cpp @@ -648,7 +648,7 @@ int ModApiEnvMod::l_clear_objects(lua_State *L) return 0; } -// minetest.line_of_sight(pos1, pos2, stepsize) -> true/false +// minetest.line_of_sight(pos1, pos2, stepsize) -> true/false, pos int ModApiEnvMod::l_line_of_sight(lua_State *L) { float stepsize = 1.0; @@ -663,7 +663,13 @@ int ModApiEnvMod::l_line_of_sight(lua_State *L) { stepsize = lua_tonumber(L, 3); } - lua_pushboolean(L, env->line_of_sight(pos1,pos2,stepsize)); + v3s16 p; + bool success = env->line_of_sight(pos1, pos2, stepsize, &p); + lua_pushboolean(L, success); + if (!success) { + push_v3s16(L, p); + return 2; + } return 1; } |