mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-04-11 02:06:26 +00:00
Start rewrite of lua, rename all print functions
This commit is contained in:
@@ -122,11 +122,11 @@ void RegisterThread(const std::string str);
|
||||
|
||||
#endif // defined(DEBUG)
|
||||
|
||||
#define warn(x) Application::Console().Write(_this_location + std::string("[WARN] ") + (x))
|
||||
#define info(x) Application::Console().Write(_this_location + std::string("[INFO] ") + (x))
|
||||
#define error(x) Application::Console().Write(_this_location + std::string("[ERROR] ") + (x))
|
||||
#define beammp_warn(x) Application::Console().Write(_this_location + std::string("[WARN] ") + (x))
|
||||
#define beammp_info(x) Application::Console().Write(_this_location + std::string("[INFO] ") + (x))
|
||||
#define beammp_error(x) Application::Console().Write(_this_location + std::string("[ERROR] ") + (x))
|
||||
#define luaprint(x) Application::Console().Write(_this_location + std::string("[LUA] ") + (x))
|
||||
#define debug(x) \
|
||||
#define beammp_debug(x) \
|
||||
do { \
|
||||
if (Application::Settings.DebugModeEnabled) { \
|
||||
Application::Console().Write(_this_location + std::string("[DEBUG] ") + (x)); \
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "TLuaFile.h"
|
||||
#include <atomic>
|
||||
#include <fstream>
|
||||
#include "commandline.h"
|
||||
@@ -11,9 +10,9 @@ public:
|
||||
|
||||
void Write(const std::string& str);
|
||||
void WriteRaw(const std::string& str);
|
||||
void InitializeLuaConsole(TLuaEngine& Engine);
|
||||
// BROKEN void InitializeLuaConsole(TLuaEngine& Engine);
|
||||
|
||||
private:
|
||||
std::unique_ptr<TLuaFile> mLuaConsole { nullptr };
|
||||
// BROKEN std::unique_ptr<TLuaFile> mLuaConsole { nullptr };
|
||||
Commandline mCommandline;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include "TNetwork.h"
|
||||
#include "TServer.h"
|
||||
#include <filesystem>
|
||||
#include <sol/sol.hpp>
|
||||
#include <toml11/toml.hpp>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
class TLuaPlugin;
|
||||
|
||||
class TLuaEngine : IThreaded {
|
||||
public:
|
||||
TLuaEngine(TServer& Server, TNetwork& Network);
|
||||
|
||||
void operator()() override;
|
||||
|
||||
private:
|
||||
void CollectPlugins();
|
||||
void InitializePlugin(const fs::path& folder);
|
||||
|
||||
TNetwork& mNetwork;
|
||||
TServer& mServer;
|
||||
sol::state mL;
|
||||
std::atomic_bool mShutdown { false };
|
||||
fs::path mResourceServerPath;
|
||||
std::vector<TLuaPlugin> mLuaPlugins;
|
||||
std::unordered_map<std::string, sol::state> mLuaStates;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user