mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 21:41:50 +00:00
commit
513b96ea4d
3 changed files with 19 additions and 0 deletions
|
|
@ -24,4 +24,7 @@ item.placing_block(itemid: int) -> int
|
||||||
|
|
||||||
-- Returns the value of the `model-name` property
|
-- Returns the value of the `model-name` property
|
||||||
item.model_name(itemid: int) -> str
|
item.model_name(itemid: int) -> str
|
||||||
|
|
||||||
|
-- Returns item emission property value
|
||||||
|
item.emission(itemid: int) -> str
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,9 @@ item.placing_block(itemid: int) -> int
|
||||||
|
|
||||||
-- Возвращает значение свойства `model-name`
|
-- Возвращает значение свойства `model-name`
|
||||||
item.model_name(itemid: int) -> str
|
item.model_name(itemid: int) -> str
|
||||||
|
|
||||||
|
-- Возвращает emission параметр у предмета
|
||||||
|
item.emission(itemid: int) -> str
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,18 @@ static int l_model_name(lua::State* L) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int l_emission(lua::State* L) {
|
||||||
|
if (auto def = get_item_def(L, 1)) {
|
||||||
|
lua::createtable(L, 4, 0);
|
||||||
|
for (int i = 0; i < 4; ++i) {
|
||||||
|
lua::pushinteger(L, def->emission[i]);
|
||||||
|
lua::rawseti(L, i+1);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
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>},
|
||||||
|
|
@ -77,4 +89,5 @@ const luaL_Reg itemlib[] = {
|
||||||
{"caption", lua::wrap<l_caption>},
|
{"caption", lua::wrap<l_caption>},
|
||||||
{"placing_block", lua::wrap<l_placing_block>},
|
{"placing_block", lua::wrap<l_placing_block>},
|
||||||
{"model_name", lua::wrap<l_model_name>},
|
{"model_name", lua::wrap<l_model_name>},
|
||||||
|
{"emission", lua::wrap<l_emission>},
|
||||||
{NULL, NULL}};
|
{NULL, NULL}};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue