rename item.get_model_name and item.get_placing_block
This commit is contained in:
parent
e217476e84
commit
e0624b11d0
@ -20,8 +20,8 @@ item.defs_count() -> int
|
|||||||
item.icon(itemid: int) -> str
|
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.placing_block(itemid: int) -> int
|
||||||
|
|
||||||
-- Returns the value of the `model-name` property
|
-- Returns the value of the `model-name` property
|
||||||
item.get_model_name(itemid: int) -> str
|
item.model_name(itemid: int) -> str
|
||||||
```
|
```
|
||||||
|
|||||||
@ -20,10 +20,10 @@ item.defs_count() -> int
|
|||||||
item.icon(itemid: int) -> str
|
item.icon(itemid: int) -> str
|
||||||
|
|
||||||
-- Возвращает числовой id блока, назначенного как 'placing-block' или 0
|
-- Возвращает числовой id блока, назначенного как 'placing-block' или 0
|
||||||
item.get_placing_block(itemid: int) -> int
|
item.placing_block(itemid: int) -> int
|
||||||
|
|
||||||
-- Возвращает значение свойства `model-name`
|
-- Возвращает значение свойства `model-name`
|
||||||
item.get_model_name(itemid: int) -> str
|
item.model_name(itemid: int) -> str
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@ end
|
|||||||
|
|
||||||
do -- setup visuals
|
do -- setup visuals
|
||||||
local matrix = mat4.idt()
|
local matrix = mat4.idt()
|
||||||
rig:set_model(0, item.get_model_name(dropitem.id))
|
rig:set_model(0, item.model_name(dropitem.id))
|
||||||
local bodysize = math.min(scale[1], scale[2], scale[3]) * DROP_SCALE
|
local bodysize = math.min(scale[1], scale[2], scale[3]) * DROP_SCALE
|
||||||
body:set_size({scale[1] * DROP_SCALE, bodysize, scale[3] * DROP_SCALE})
|
body:set_size({scale[1] * DROP_SCALE, bodysize, scale[3] * DROP_SCALE})
|
||||||
mat4.mul(matrix, rotation, matrix)
|
mat4.mul(matrix, rotation, matrix)
|
||||||
|
|||||||
@ -7,7 +7,7 @@ local itemIndex = rig:index("item")
|
|||||||
|
|
||||||
local function refresh_model(id)
|
local function refresh_model(id)
|
||||||
itemid = id
|
itemid = id
|
||||||
rig:set_model(itemIndex, item.get_model_name(itemid))
|
rig:set_model(itemIndex, item.model_name(itemid))
|
||||||
rig:set_matrix(itemIndex, mat4.rotate({0, 1, 0}, -80))
|
rig:set_matrix(itemIndex, mat4.rotate({0, 1, 0}, -80))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -54,14 +54,14 @@ static int l_caption(lua::State* L) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int l_get_placing_block(lua::State* L) {
|
static int l_placing_block(lua::State* L) {
|
||||||
if (auto def = get_item_def(L, 1)) {
|
if (auto def = get_item_def(L, 1)) {
|
||||||
return lua::pushinteger(L, def->rt.placingBlock);
|
return lua::pushinteger(L, def->rt.placingBlock);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int l_get_model_name(lua::State* L) {
|
static int l_model_name(lua::State* L) {
|
||||||
if (auto def = get_item_def(L, 1)) {
|
if (auto def = get_item_def(L, 1)) {
|
||||||
return lua::pushstring(L, def->modelName);
|
return lua::pushstring(L, def->modelName);
|
||||||
}
|
}
|
||||||
@ -75,6 +75,6 @@ const luaL_Reg itemlib[] = {
|
|||||||
{"defs_count", lua::wrap<l_defs_count>},
|
{"defs_count", lua::wrap<l_defs_count>},
|
||||||
{"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>},
|
{"placing_block", lua::wrap<l_placing_block>},
|
||||||
{"get_model_name", lua::wrap<l_get_model_name>},
|
{"model_name", lua::wrap<l_model_name>},
|
||||||
{NULL, NULL}};
|
{NULL, NULL}};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user