VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
VoltMod::Map Class Reference

#include <Map.hpp>

Public Member Functions

 Map (Interfaces &interfaces, ConVars &conVars)
 
bool IsValid (std::string_view name) const
 
bool ChangeLevel (std::string_view name)
 
bool ChangeToWorkshop (uint64_t workshopId)
 
std::string Current () const
 
void SetCurrent (std::string name)
 

Public Attributes

Event< std::string_view > Started
 

Detailed Description

Map validation and level changes through IVEngineServer2.

Definition at line 15 of file Map.hpp.

Constructor & Destructor Documentation

◆ Map()

VoltMod::Map::Map ( Interfaces &  interfaces,
ConVars &  conVars 
)

Both dependencies must outlive this service.

Definition at line 13 of file Map.cpp.

Member Function Documentation

◆ ChangeLevel()

bool VoltMod::Map::ChangeLevel ( std::string_view  name)

Validate and queue a non-workshop map change.

Definition at line 32 of file Map.cpp.

References VoltMod::Interfaces::Engine, IsValid(), VoltMod::ReadFile(), and VoltMod::Log::Warn().

◆ ChangeToWorkshop()

bool VoltMod::Map::ChangeToWorkshop ( uint64_t  workshopId)

Queue host_workshop_map. Returns false for zero or when queuing fails.

Definition at line 45 of file Map.cpp.

References VoltMod::ConVars::ExecuteServerCommand(), VoltMod::ReadFile(), and VoltMod::Log::Warn().

◆ Current()

std::string VoltMod::Map::Current ( ) const

The map being played: the StartupServer name, or the engine globals' mapname after a late load. Empty when neither is available.

Definition at line 57 of file Map.cpp.

References VoltMod::Interfaces::Engine.

◆ IsValid()

bool VoltMod::Map::IsValid ( std::string_view  name) const

Whether the engine can load a mounted, non-workshop map.

Definition at line 15 of file Map.cpp.

References VoltMod::Interfaces::Engine, VoltMod::ReadFile(), and VoltMod::Log::Warn().

Referenced by ChangeLevel().

◆ SetCurrent()

void VoltMod::Map::SetCurrent ( std::string  name)
inline

Framework hook entry point. Plugins read Current.

Definition at line 38 of file Map.hpp.

Member Data Documentation

◆ Started

Event<std::string_view> VoltMod::Map::Started

A map started, with its name. Raised after the framework's own services have refreshed.

Definition at line 22 of file Map.hpp.


The documentation for this class was generated from the following files: