add item.get_model
This commit is contained in:
parent
b2e5254037
commit
7c933f89c6
@ -21,4 +21,7 @@ item.icon(itemid: int) -> str
|
|||||||
|
|
||||||
-- Returns the integer id 'placing-block' or 0
|
-- Returns the integer id 'placing-block' or 0
|
||||||
item.get_placing_block(itemid: int) -> int
|
item.get_placing_block(itemid: int) -> int
|
||||||
|
|
||||||
|
-- Returns the value of the `model-name` property
|
||||||
|
item.get_model_name(itemid: int) -> str
|
||||||
```
|
```
|
||||||
|
|||||||
@ -21,6 +21,9 @@ item.icon(itemid: int) -> str
|
|||||||
|
|
||||||
-- Возвращает числовой id блока, назначенного как 'placing-block' или 0
|
-- Возвращает числовой id блока, назначенного как 'placing-block' или 0
|
||||||
item.get_placing_block(itemid: int) -> int
|
item.get_placing_block(itemid: int) -> int
|
||||||
|
|
||||||
|
-- Возвращает значение свойства `model-name`
|
||||||
|
item.get_model_name(itemid: int) -> str
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -61,6 +61,13 @@ static int l_get_placing_block(lua::State* L) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int l_get_model_name(lua::State* L) {
|
||||||
|
if (auto def = get_item_def(L, 1)) {
|
||||||
|
return lua::pushstring(L, def->modelName);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
const luaL_Reg itemlib[] = {
|
const luaL_Reg itemlib[] = {
|
||||||
{"index", lua::wrap<l_index>},
|
{"index", lua::wrap<l_index>},
|
||||||
{"name", lua::wrap<l_name>},
|
{"name", lua::wrap<l_name>},
|
||||||
@ -69,4 +76,5 @@ const luaL_Reg itemlib[] = {
|
|||||||
{"icon", lua::wrap<l_get_icon>},
|
{"icon", lua::wrap<l_get_icon>},
|
||||||
{"caption", lua::wrap<l_caption>},
|
{"caption", lua::wrap<l_caption>},
|
||||||
{"get_placing_block", lua::wrap<l_get_placing_block>},
|
{"get_placing_block", lua::wrap<l_get_placing_block>},
|
||||||
|
{"get_model_name", lua::wrap<l_get_model_name>},
|
||||||
{NULL, NULL}};
|
{NULL, NULL}};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user