- Added Lua scripts hud.open, inventory.create and inventory.remove - Window now resizes even if it is not focused
This commit is contained in:
@@ -109,6 +109,26 @@ static int l_inventory_unbind_block(lua::State* L) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_inventory_create(lua::State* L) {
|
||||
auto invsize = lua::tointeger(L, 1);
|
||||
auto inv = level->inventories->create(invsize);
|
||||
if (inv == nullptr) {
|
||||
return lua::pushinteger(L, 0);
|
||||
}
|
||||
return lua::pushinteger(L, inv->getId());
|
||||
}
|
||||
|
||||
static int l_inventory_remove(lua::State* L) {
|
||||
auto invid = lua::tointeger(L, 1);
|
||||
auto inv = get_inventory(invid);
|
||||
if (inv == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
level->inventories->remove(invid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_inventory_clone(lua::State* L) {
|
||||
auto id = lua::tointeger(L, 1);
|
||||
auto clone = level->inventories->clone(id);
|
||||
@@ -145,5 +165,7 @@ const luaL_Reg inventorylib[] = {
|
||||
{"get_block", lua::wrap<l_inventory_get_block>},
|
||||
{"bind_block", lua::wrap<l_inventory_bind_block>},
|
||||
{"unbind_block", lua::wrap<l_inventory_unbind_block>},
|
||||
{"create", lua::wrap<l_inventory_create>},
|
||||
{"remove", lua::wrap<l_inventory_remove>},
|
||||
{"clone", lua::wrap<l_inventory_clone>},
|
||||
{NULL, NULL}};
|
||||
|
||||
Reference in New Issue
Block a user