mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Allow giving "pointabilities" to Lua raycasts (#14390)
This commit is contained in:
parent
aac616fcc5
commit
e40417f687
4 changed files with 55 additions and 11 deletions
|
@ -177,6 +177,7 @@ int LuaRaycast::create_object(lua_State *L)
|
|||
|
||||
bool objects = true;
|
||||
bool liquids = false;
|
||||
std::optional<Pointabilities> pointabilities = std::nullopt;
|
||||
|
||||
v3f pos1 = checkFloatPos(L, 1);
|
||||
v3f pos2 = checkFloatPos(L, 2);
|
||||
|
@ -186,9 +187,12 @@ int LuaRaycast::create_object(lua_State *L)
|
|||
if (lua_isboolean(L, 4)) {
|
||||
liquids = readParam<bool>(L, 4);
|
||||
}
|
||||
if (lua_istable(L, 5)) {
|
||||
pointabilities = read_pointabilities(L, 5);
|
||||
}
|
||||
|
||||
LuaRaycast *o = new LuaRaycast(core::line3d<f32>(pos1, pos2),
|
||||
objects, liquids, std::nullopt);
|
||||
objects, liquids, pointabilities);
|
||||
|
||||
*(void **) (lua_newuserdata(L, sizeof(void *))) = o;
|
||||
luaL_getmetatable(L, className);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue