VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
MovementFreeze.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
VoltMod/Engine/EntityRef.hpp
>
4
#include <
VoltMod/Entities/Pawn.hpp
>
5
6
namespace
VoltMod
7
{
8
9
/**
10
* @brief Holds one pawn still and gives its move type back to that pawn only, so a player who
11
* respawns while held never inherits the dead body's. Keep one per player.
12
*/
13
class
MovementFreeze
14
{
15
public
:
16
/** Freeze @p pawn. Does nothing when a pawn is already held, or when @p pawn cannot be. */
17
void
Hold
(
const
Pawn
&
pawn
);
18
19
/** Give @p pawn its move type back if it is the one being held, then forget it. */
20
void
Release
(
const
Pawn
&
pawn
);
21
22
/** Carry the hold across a respawn: forget a replaced pawn without writing to it, then hold
23
* @p pawn. */
24
void
Sync
(
const
Pawn
&
pawn
);
25
26
/** Whether a pawn is being held. */
27
explicit
operator
bool
()
const
noexcept
{
return
static_cast<
bool
>
(_pawn); }
28
29
private
:
30
EntityRef
_pawn;
31
Schema::MoveType_t
_prev =
Schema::MoveType_t::MOVETYPE_WALK
;
32
};
33
34
}
// namespace VoltMod
EntityRef.hpp
Pawn.hpp
VoltMod::MovementFreeze
Holds one pawn still and gives its move type back to that pawn only, so a player who respawns while h...
Definition
MovementFreeze.hpp:14
VoltMod::MovementFreeze::Sync
void Sync(const Pawn &pawn)
Definition
MovementFreeze.cpp:33
VoltMod::MovementFreeze::Hold
void Hold(const Pawn &pawn)
Definition
MovementFreeze.cpp:6
VoltMod::MovementFreeze::Release
void Release(const Pawn &pawn)
Definition
MovementFreeze.cpp:19
VoltMod::Pawn
A player's body: health, armor, movement, aim, weapons. The engine replaces it on every spawn; the Co...
Definition
Pawn.hpp:19
VoltMod::Schema::MoveType_t
MoveType_t
Definition
Enums.hpp:12
VoltMod::Schema::MoveType_t::MOVETYPE_WALK
@ MOVETYPE_WALK
VoltMod
Definition
Options.hpp:13
VoltMod::ReadFile
static std::string ReadFile(const std::filesystem::path &path)
Definition
Loader.cpp:56
VoltMod::EntityRef
Definition
EntityRef.hpp:11
include
VoltMod
Entities
MovementFreeze.hpp
Generated by
1.9.8