VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
BoneFollow.hpp
Go to the documentation of this file.
1#pragma once
2
7#include <cstdint>
8
9namespace VoltMod
10{
11
12/**
13 * @brief Has one pawn copy another entity's bones while traces, bullets included, keep hitting it,
14 * and gives that pawn alone its collision back on detach, so a respawn is never written to. Keep
15 * one per player.
16 */
18{
19public:
20 /** Parent @p pawn to @p parent with its bones taking the parent's pose by name. Does nothing
21 * when a pawn already follows, or when either is gone. */
22 void Attach(const Pawn& pawn, const Entity& parent);
23
24 /** Clear @p pawn's parent and give back its collision if it is the one following, then forget it. */
25 void Detach(const Pawn& pawn);
26
27 /** Whether a pawn is following. */
28 explicit operator bool() const noexcept { return static_cast<bool>(_pawn); }
29
30private:
31 EntityRef _pawn;
32 uint8_t _mask = 0;
34};
35
36} // namespace VoltMod
Has one pawn copy another entity's bones while traces, bullets included, keep hitting it,...
void Detach(const Pawn &pawn)
void Attach(const Pawn &pawn, const Entity &parent)
Definition BoneFollow.cpp:6
A live entity, valid for this frame only.
Definition Entity.hpp:40
A player's body: health, armor, movement, aim, weapons. The engine replaces it on every spawn; the Co...
Definition Pawn.hpp:35