VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
Teleport.hpp
Go to the documentation of this file.
1#pragma once
2
10
11namespace VoltMod
12{
13
14/**
15 * @brief Report player pawn moves through CBaseEntity::Teleport.
16 *
17 * The hook installs on the first subscription and covers every pawn sharing the CCSPlayerPawn
18 * vtable, including respawns. Spawning raises the event as well, so consumers interested only in
19 * mid-life teleports must filter spawn events.
20 *
21 * The service keeps no teleport history. Consumers decide how long a teleport remains relevant and
22 * which clock to use.
23 *
24 * @code
25 * _teleports = runtime.Teleport.Before += [this](int slot) { _lastTeleport[slot] = _clock.Time(); };
26 * @endcode
27 */
29{
30public:
31 /** @p entities resolves the teleported pawn's slot and @p bindings supplies the Teleport slot
32 * and class vtable. Both must outlive it; the Runtime declares them above. */
34 Teleport(const Teleport&) = delete;
35 Teleport& operator=(const Teleport&) = delete;
36
37private:
38 LazyHook _hook;
39
40public:
41 /** A player's pawn is about to be teleported. */
43
44 /** Why teleports cannot be tracked: the CBaseEntity::Teleport slot did not bind. */
45 Status Available() const;
46
47private:
48 EntitySystem& _entities;
49 const Bindings& _bindings;
50};
51
52} // namespace VoltMod
runtime.Entities: finds and creates entities. Everything it returns is valid for this frame only; see...
A multicast signal with a fixed handler signature: the one way to subscribe in VoltMod.
Definition Event.hpp:54
An engine hook that exists only while one of its events has handlers.
Definition LazyHook.hpp:30
Report player pawn moves through CBaseEntity::Teleport.
Definition Teleport.hpp:29
Event< int > Before
Definition Teleport.hpp:42
Teleport & operator=(const Teleport &)=delete
Status Available() const
Definition Teleport.cpp:31
Teleport(const Teleport &)=delete
static std::string ReadFile(const std::filesystem::path &path)
Definition Loader.cpp:56
std::expected< void, Error > Status
Definition Result.hpp:67