This commit is contained in:
2025-08-04 17:42:12 +06:00
parent 31ee024d2f
commit c1df4a21f3
4 changed files with 309 additions and 155 deletions

View File

@@ -14,6 +14,8 @@
#include <memory>
#include <queue>
#include <set>
#include <sol/forward.hpp>
#include <sol/state.hpp>
#include <thread>
#include <unordered_map>
#include "ContentEventController.hpp"
@@ -27,6 +29,22 @@
namespace LV::Server {
struct ModRequest {
std::string Id;
std::array<uint32_t, 4> MinVersion, MaxVersion;
};
struct ModInfo {
std::string Id, Name, Description, Author;
std::array<uint32_t, 4> Version;
std::vector<ModRequest> Dependencies, Optional;
float LoadPriority;
fs::path Path;
bool HasLiveReload;
std::string dump() const;
};
namespace fs = std::filesystem;
class GameServer : public AsyncObject {
@@ -263,6 +281,10 @@ class GameServer : public AsyncObject {
void run(int id);
} BackingAsyncLua;
sol::state LuaMainState;
std::vector<ModInfo> LoadedMods;
std::vector<std::pair<std::string, sol::table>> ModInstances;
public:
GameServer(asio::io_context &ioc, fs::path worldPath);
virtual ~GameServer();
@@ -296,15 +318,6 @@ private:
void prerun();
void run();
struct ModInfo {
std::string Id, Title, Description;
fs::path Path;
std::vector<std::string> Dependencies, OptionalDependencies;
};
std::vector<ModInfo> readModDataPath(const fs::path& modsDir);
/*
Подключение/отключение игроков
*/