Merge branch 'dev' into more-about-projects
This commit is contained in:
@@ -54,7 +54,7 @@ static int l_get_gravity_scale(lua::State* L) {
|
||||
|
||||
static int l_set_gravity_scale(lua::State* L) {
|
||||
if (auto entity = get_entity(L, 1)) {
|
||||
entity->getRigidbody().hitbox.gravityScale = lua::tonumber(L, 2);
|
||||
entity->getRigidbody().hitbox.gravityScale = lua::tovec3(L, 2).y;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -101,12 +101,9 @@ static int l_set(lua::State* L) {
|
||||
if (static_cast<size_t>(id) >= indices->blocks.count()) {
|
||||
return 0;
|
||||
}
|
||||
int cx = floordiv<CHUNK_W>(x);
|
||||
int cz = floordiv<CHUNK_D>(z);
|
||||
if (!blocks_agent::get_chunk(*level->chunks, cx, cz)) {
|
||||
if (!blocks_agent::set(*level->chunks, x, y, z, id, int2blockstate(state))) {
|
||||
return 0;
|
||||
}
|
||||
blocks_agent::set(*level->chunks, x, y, z, id, int2blockstate(state));
|
||||
|
||||
auto chunksController = controller->getChunksController();
|
||||
if (chunksController == nullptr) {
|
||||
@@ -364,6 +361,19 @@ static int l_get_textures(lua::State* L) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int l_model_name(lua::State* L) {
|
||||
if (auto def = require_block(L)) {
|
||||
// TODO: variant argument
|
||||
const auto& modelName = def->defaults.model.name;
|
||||
if (modelName.empty()) {
|
||||
return lua::pushlstring(L, def->name + ".model");
|
||||
}
|
||||
return lua::pushlstring(L, modelName);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_get_model(lua::State* L) {
|
||||
if (auto def = require_block(L)) {
|
||||
// TODO: variant argument
|
||||
@@ -713,6 +723,7 @@ const luaL_Reg blocklib[] = {
|
||||
{"get_size", lua::wrap<l_get_size>},
|
||||
{"is_segment", lua::wrap<l_is_segment>},
|
||||
{"seek_origin", lua::wrap<l_seek_origin>},
|
||||
{"model_name", lua::wrap<l_model_name>},
|
||||
{"get_textures", lua::wrap<l_get_textures>},
|
||||
{"get_model", lua::wrap<l_get_model>},
|
||||
{"get_hitbox", lua::wrap<l_get_hitbox>},
|
||||
|
||||
@@ -46,7 +46,7 @@ static int l_open(lua::State* L) {
|
||||
}
|
||||
return lua::pushinteger(L, hud->openInventory(
|
||||
layout,
|
||||
level->inventories->get(invid),
|
||||
lua::isnoneornil(L, 3) ? nullptr : level->inventories->get(invid),
|
||||
playerInventory
|
||||
)->getId());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user