mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-04-04 23:06:08 +00:00
add event 'onPlayerRequestMods', restructure modloading
now every player has their own list of allowed client mods, this can be modified by lua upon joining and is later used as a whitelist to ensure only those files can be sent to each client
This commit is contained in:
@@ -1,21 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include "Common.h"
|
||||
#include <optional>
|
||||
|
||||
using ModMap = HashMap<std::string, size_t>;
|
||||
|
||||
class TResourceManager {
|
||||
public:
|
||||
TResourceManager();
|
||||
|
||||
[[nodiscard]] size_t MaxModSize() const { return mMaxModSize; }
|
||||
[[nodiscard]] std::string FileList() const { return mFileList; }
|
||||
[[nodiscard]] std::string TrimmedList() const { return mTrimmedList; }
|
||||
[[nodiscard]] std::string FileSizes() const { return mFileSizes; }
|
||||
[[nodiscard]] int ModsLoaded() const { return mModsLoaded; }
|
||||
[[nodiscard]] size_t TotalModsSize() const { return mTotalModSize; }
|
||||
[[nodiscard]] ModMap FileMap() const { return mMods; }
|
||||
[[nodiscard]] static std::string FormatForBackend(const ModMap& mods);
|
||||
[[nodiscard]] static std::string FormatForClient(const ModMap& mods);
|
||||
[[nodiscard]] static std::optional<std::string> IsModValid(std::string& pathString, const ModMap& mods);
|
||||
[[nodiscard]] int LoadedModCount() const { return mMods.size(); }
|
||||
|
||||
private:
|
||||
size_t mMaxModSize = 0;
|
||||
std::string mFileSizes;
|
||||
std::string mFileList;
|
||||
std::string mTrimmedList;
|
||||
int mModsLoaded = 0;
|
||||
size_t mTotalModSize = 0; // size of all mods
|
||||
ModMap mMods; // map of mod names
|
||||
};
|
||||
Reference in New Issue
Block a user