Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TraceRay Lua Functions #1624

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion rts/Lua/LuaSyncedRead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8620,6 +8620,9 @@ int LuaSyncedRead::TraceRayFeatures(lua_State* L) //returns the list of features
* @number traceLength
* @bool[opt=false] ignoreWater
* @treturn nil|len
* @treturn number posX
* @treturn number posY
* @treturn number posZ
*/
int LuaSyncedRead::TraceRayGround(lua_State* L)
12345swordy marked this conversation as resolved.
Show resolved Hide resolved
{
Expand All @@ -8640,7 +8643,11 @@ int LuaSyncedRead::TraceRayGround(lua_State* L)
if (!ignoreWater)
traceLength = std::min(traceLength, waterRayLength);
lua_pushnumber(L, traceLength);
return 1;
auto result = pos + dir * traceLength;
12345swordy marked this conversation as resolved.
Show resolved Hide resolved
lua_pushnumber(L, result.x);
lua_pushnumber(L, result.y);
lua_pushnumber(L, result.z);
return 4;
}
/******************************************************************************
* Misc
Expand Down