Start rewrite of lua, rename all print functions

This commit is contained in:
Lion Kortlepel
2021-09-16 01:04:01 +02:00
parent d082620525
commit dd4e4c4467
20 changed files with 215 additions and 136 deletions

View File

@@ -0,0 +1,44 @@
#include "TLuaEngine.h"
#include "CustomAssert.h"
TLuaEngine::TLuaEngine(TServer& Server, TNetwork& Network)
: mNetwork(Network)
, mServer(Server) {
if (!fs::exists(Application::Settings.Resource)) {
fs::create_directory(Application::Settings.Resource);
}
fs::path Path = fs::path(Application::Settings.Resource) / "Server";
if (!fs::exists(Path)) {
fs::create_directory(Path);
}
mResourceServerPath = Path;
Application::RegisterShutdownHandler([&] {
mShutdown = true;
if (mThread.joinable()) {
mThread.join();
}
});
}
void TLuaEngine::operator()() {
RegisterThread("LuaEngine");
// lua engine main thread
CollectPlugins();
}
void TLuaEngine::CollectPlugins() {
for (const auto& dir : fs::directory_iterator(mResourceServerPath)) {
auto path = dir.path();
path = fs::relative(path);
if (!dir.is_directory()) {
beammp_error("\"" + dir.path().string() + "\" is not a directory, skipping");
} else {
beammp_debug("found plugin directory: " + path.string());
}
}
}
void TLuaEngine::InitializePlugin(const fs::path& folder) {
Assert(fs::exists(folder));
Assert(fs::is_directory(folder));
}