add inventory.get_uses, inventory.use, item.uses & update base:bazalt_breaker

This commit is contained in:
MihailRis
2025-02-17 04:40:18 +03:00
parent 231fc7e0d0
commit bbfc0dbf17
5 changed files with 40 additions and 4 deletions
+10 -1
View File
@@ -80,6 +80,13 @@ static int l_emission(lua::State* L) {
return 0;
}
static int l_uses(lua::State* L) {
if (auto def = get_item_def(L, 1)) {
return lua::pushinteger(L, def->uses);
}
return 0;
}
const luaL_Reg itemlib[] = {
{"index", lua::wrap<l_index>},
{"name", lua::wrap<l_name>},
@@ -90,4 +97,6 @@ const luaL_Reg itemlib[] = {
{"placing_block", lua::wrap<l_placing_block>},
{"model_name", lua::wrap<l_model_name>},
{"emission", lua::wrap<l_emission>},
{NULL, NULL}};
{"uses", lua::wrap<l_uses>},
{NULL, NULL}
};