1
0
Fork 0
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:
grorp 2024-03-01 17:12:13 +01:00 committed by GitHub
parent aac616fcc5
commit e40417f687
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 55 additions and 11 deletions

View file

@ -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);