add drop-item model, new block functions

This commit is contained in:
MihailRis
2024-07-03 16:34:09 +03:00
parent 1c4e13dc67
commit 48b5be6bc9
11 changed files with 81 additions and 24 deletions
+14
View File
@@ -271,6 +271,19 @@ static int l_get_textures(lua::State* L) {
return 0;
}
static int l_get_model(lua::State* L) {
if (auto def = require_block(L)) {
switch (def->model) {
case BlockModel::block: return lua::pushstring(L, "block");
case BlockModel::aabb: return lua::pushstring(L, "aabb");
case BlockModel::xsprite: return lua::pushstring(L, "X");
case BlockModel::custom: return lua::pushstring(L, "custom");
case BlockModel::none: return lua::pushstring(L, "none");
}
return 0;
}
}
const luaL_Reg blocklib [] = {
{"index", lua::wrap<l_index>},
{"name", lua::wrap<l_name>},
@@ -295,5 +308,6 @@ const luaL_Reg blocklib [] = {
{"is_segment", lua::wrap<l_is_segment>},
{"seek_origin", lua::wrap<l_seek_origin>},
{"get_textures", lua::wrap<l_get_textures>},
{"get_model", lua::wrap<l_get_model>},
{NULL, NULL}
};