Merge branch 'dev' into generated-pcm-stream

This commit is contained in:
MihailRis
2025-11-10 12:44:49 +03:00
56 changed files with 609 additions and 242 deletions
@@ -1,6 +1,7 @@
#include "audio/audio.hpp"
#include "assets/Assets.hpp"
#include "engine/Engine.hpp"
#include "engine/EnginePaths.hpp"
#include "api_lua.hpp"
inline const char* DEFAULT_CHANNEL = "regular";
+11 -2
View File
@@ -8,7 +8,7 @@
#include "content/Content.hpp"
#include "content/ContentControl.hpp"
#include "engine/Engine.hpp"
#include "io/engine_paths.hpp"
#include "engine/EnginePaths.hpp"
#include "io/io.hpp"
#include "io/settings_io.hpp"
#include "frontend/menu.hpp"
@@ -43,7 +43,16 @@ static int l_reset_content(lua::State* L) {
if (level != nullptr) {
throw std::runtime_error("world must be closed before");
}
content_control->resetContent();
std::vector<std::string> nonResetPacks;
if (lua::istable(L, 1)) {
int len = lua::objlen(L, 1);
for (int i = 0; i < len; i++) {
lua::rawgeti(L, i + 1, 1);
nonResetPacks.emplace_back(lua::require_lstring(L, -1));
lua::pop(L);
}
}
content_control->resetContent(std::move(nonResetPacks));
return 0;
}
@@ -2,6 +2,7 @@
#include "content/Content.hpp"
#include "engine/Engine.hpp"
#include "engine/EnginePaths.hpp"
#include "objects/Entities.hpp"
#include "objects/EntityDef.hpp"
#include "objects/Entity.hpp"
+1 -1
View File
@@ -3,7 +3,7 @@
#include "coders/gzip.hpp"
#include "engine/Engine.hpp"
#include "io/engine_paths.hpp"
#include "engine/EnginePaths.hpp"
#include "io/io.hpp"
#include "io/devices/ZipFileDevice.hpp"
#include "util/stringutil.hpp"
@@ -9,6 +9,7 @@
#include "content/Content.hpp"
#include "content/ContentControl.hpp"
#include "engine/Engine.hpp"
#include "engine/EnginePaths.hpp"
#include "../usertypes/lua_type_voxelfragment.hpp"
using namespace scripting;
+6
View File
@@ -189,6 +189,11 @@ static int l_reload_script(lua::State* L) {
return 0;
}
static int l_is_open(lua::State* L) {
auto layoutid = lua::require_string(L, 1);
return lua::pushboolean(L, hud->isOpen(layoutid));
}
const luaL_Reg hudlib[] = {
{"open_inventory", wrap_hud<l_open_inventory>},
{"close_inventory", wrap_hud<l_close_inventory>},
@@ -208,5 +213,6 @@ const luaL_Reg hudlib[] = {
{"_set_debug_cheats", wrap_hud<l_set_debug_cheats>},
{"set_allow_pause", wrap_hud<l_set_allow_pause>},
{"reload_script", wrap_hud<l_reload_script>},
{"is_open", wrap_hud<l_is_open>},
{nullptr, nullptr}
};
+1 -1
View File
@@ -10,7 +10,7 @@
#include "graphics/ui/elements/Menu.hpp"
#include "frontend/locale.hpp"
#include "world/files/WorldFiles.hpp"
#include "io/engine_paths.hpp"
#include "engine/EnginePaths.hpp"
#include "world/Level.hpp"
#include "world/World.hpp"
#include "api_lua.hpp"
+1 -1
View File
@@ -10,7 +10,7 @@
#include "content/ContentControl.hpp"
#include "engine/Engine.hpp"
#include "world/files/WorldFiles.hpp"
#include "io/engine_paths.hpp"
#include "engine/EnginePaths.hpp"
#include "io/io.hpp"
#include "lighting/Lighting.hpp"
#include "voxels/Chunk.hpp"
+1 -1
View File
@@ -4,7 +4,7 @@
#include <iostream>
#include "io/io.hpp"
#include "io/engine_paths.hpp"
#include "engine/EnginePaths.hpp"
#include "debug/Logger.hpp"
#include "util/stringutil.hpp"
#include "libs/api_lua.hpp"
+16
View File
@@ -336,6 +336,22 @@ int lua::create_environment(State* L, int parent) {
return id;
}
int lua::restore_pack_environment(lua::State* L, const std::string& packid) {
if(!lua::getglobal(L, "__vc__pack_envs")) {
return -1;
}
int id = nextEnvironment++;
if (lua::getfield(L, packid)) {
// envname = env
setglobal(L, env_name(id));
lua::pop(L);
return id;
}
lua::pop(L);
return -1;
}
void lua::remove_environment(State* L, int id) {
if (id == 0) {
return;
+1
View File
@@ -613,6 +613,7 @@ namespace lua {
return 0;
}
int create_environment(lua::State*, int parent);
int restore_pack_environment(lua::State*, const std::string& packid);
void remove_environment(lua::State*, int id);
inline void close(lua::State* L) {
@@ -8,6 +8,7 @@
#include "graphics/core/ImageData.hpp"
#include "maths/Heightmap.hpp"
#include "engine/Engine.hpp"
#include "engine/EnginePaths.hpp"
#include "../lua_util.hpp"
#include "lua_type_heightmap.hpp"