From e457e3da390d4adc6f847c6135a14c611dc7a362 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Tue, 23 Jan 2024 23:52:42 +0300 Subject: [PATCH] lua: 'core' prefix support + minor refactor --- src/graphics/TextureAnimation.cpp | 5 ++--- src/logic/scripting/api_lua.cpp | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/graphics/TextureAnimation.cpp b/src/graphics/TextureAnimation.cpp index ce6add01..b158a6f9 100644 --- a/src/graphics/TextureAnimation.cpp +++ b/src/graphics/TextureAnimation.cpp @@ -52,10 +52,9 @@ void TextureAnimator::update(float delta) { glBlitFramebuffer(frame.srcPos.x, srcPosY, frame.srcPos.x + frame.size.x, srcPosY + frame.size.y, frame.dstPos.x, frame.dstPos.y, frame.dstPos.x + frame.size.x, frame.dstPos.y + frame.size.y, GL_COLOR_BUFFER_BIT, GL_NEAREST); - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); - glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); - } + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); } glBindFramebuffer(GL_FRAMEBUFFER, 0); for (auto& elem : changedTextures) { diff --git a/src/logic/scripting/api_lua.cpp b/src/logic/scripting/api_lua.cpp index 74a799c4..45375af8 100644 --- a/src/logic/scripting/api_lua.cpp +++ b/src/logic/scripting/api_lua.cpp @@ -43,6 +43,12 @@ static const luaL_Reg timelib [] = { /* == pack library == */ static int l_pack_get_folder(lua_State* L) { std::string packName = lua_tostring(L, 1); + if (packName == "core") { + auto folder = scripting::engine->getPaths() + ->getResources().u8string()+"/"; + lua_pushstring(L, folder.c_str()); + return 1; + } for (auto& pack : scripting::engine->getContentPacks()) { if (pack.id == packName) { lua_pushstring(L, (pack.folder.u8string()+"/").c_str());