VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
Map.hpp
Go to the documentation of this file.
1#pragma once
2
6#include <cstdint>
7#include <string>
8#include <string_view>
9#include <utility>
10
11namespace VoltMod
12{
13
14/** Map validation and level changes through IVEngineServer2. */
15class Map
16{
17public:
18 /** Both dependencies must outlive this service. */
20
21 /** A map started, with its name. Raised after the framework's own services have refreshed. */
23
24 /** Whether the engine can load a mounted, non-workshop map. */
25 bool IsValid(std::string_view name) const;
26
27 /** Validate and queue a non-workshop map change. */
28 bool ChangeLevel(std::string_view name);
29
30 /** Queue `host_workshop_map`. Returns false for zero or when queuing fails. */
32
33 /** The map being played: the StartupServer name, or the engine globals' `mapname` after a late
34 * load. Empty when neither is available. */
35 std::string Current() const;
36
37 /** Framework hook entry point. Plugins read @ref Current. */
38 void SetCurrent(std::string name) { _current = std::move(name); }
39
40private:
41 Interfaces& _interfaces;
42 ConVars& _conVars;
43 std::string _current;
44};
45
46} // namespace VoltMod
A multicast signal with a fixed handler signature: the one way to subscribe in VoltMod.
Definition Event.hpp:54
std::string Current() const
Definition Map.cpp:57
bool IsValid(std::string_view name) const
Definition Map.cpp:15
bool ChangeToWorkshop(uint64_t workshopId)
Definition Map.cpp:45
Event< std::string_view > Started
Definition Map.hpp:22
void SetCurrent(std::string name)
Definition Map.hpp:38
bool ChangeLevel(std::string_view name)
Definition Map.cpp:32
static std::string ReadFile(const std::filesystem::path &path)
Definition Loader.cpp:56
Centralized holder for all HL2SDK interface pointers.