lua: pack.get_folder(pack_name) + shader fix

This commit is contained in:
MihailRis
2024-01-17 23:10:06 +03:00
parent 7d35356f9d
commit d7f2771da4
5 changed files with 31 additions and 10 deletions
+5 -5
View File
@@ -11,19 +11,19 @@
#include "../../voxels/Block.h"
#include "../../items/ItemDef.h"
#include "../../logic/BlocksController.h"
#include "../../engine.h"
#include "api_lua.h"
using namespace scripting;
namespace scripting {
extern lua_State* L;
extern EnginePaths* paths;
}
Engine* scripting::engine = nullptr;
lua_State* scripting::L = nullptr;
Level* scripting::level = nullptr;
const Content* scripting::content = nullptr;
EnginePaths* scripting::paths = nullptr;
BlocksController* scripting::blocks = nullptr;
inline int lua_pushivec3(lua_State* L, int x, int y, int z) {
@@ -58,8 +58,8 @@ int call_func(lua_State* L, int argc, const std::string& name) {
return 1;
}
void scripting::initialize(EnginePaths* paths) {
scripting::paths = paths;
void scripting::initialize(Engine* engine) {
scripting::engine = engine;
L = luaL_newstate();
if (L == nullptr) {
@@ -87,7 +87,7 @@ void scripting::on_world_load(Level* level, BlocksController* blocks) {
scripting::level = level;
scripting::content = level->content;
scripting::blocks = blocks;
auto paths = scripting::engine->getPaths();
fs::path file = paths->getResources()/fs::path("scripts/world.lua");
std::string src = files::read_string(file);
luaL_loadbuffer(L, src.c_str(), src.length(), file.string().c_str());