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
3
#include <
VoltMod/Engine/EntityRef.hpp
>
4
#include <
VoltMod/Entities/Entity.hpp
>
5
#include <
VoltMod/Entities/Pawn.hpp
>
6
#include <
VoltMod/Schema/Generated/Enums.hpp
>
7
#include <cstdint>
8
9
namespace
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
*/
17
class
BoneFollow
18
{
19
public
:
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
30
private
:
31
EntityRef
_pawn;
32
uint8_t _mask = 0;
33
Schema::SurroundingBoundsType_t
_surround{};
34
};
35
36
}
// namespace VoltMod
EntityRef.hpp
Entity.hpp
Enums.hpp
Pawn.hpp
VoltMod::BoneFollow
Has one pawn copy another entity's bones while traces, bullets included, keep hitting it,...
Definition
BoneFollow.hpp:18
VoltMod::BoneFollow::Detach
void Detach(const Pawn &pawn)
Definition
BoneFollow.cpp:23
VoltMod::BoneFollow::Attach
void Attach(const Pawn &pawn, const Entity &parent)
Definition
BoneFollow.cpp:6
VoltMod::Entity
A live entity, valid for this frame only.
Definition
Entity.hpp:40
VoltMod::Pawn
A player's body: health, armor, movement, aim, weapons. The engine replaces it on every spawn; the Co...
Definition
Pawn.hpp:35
VoltMod::Schema::SurroundingBoundsType_t
SurroundingBoundsType_t
Definition
Enums.hpp:58
VoltMod
Definition
Options.hpp:13
VoltMod::EntityRef
Definition
EntityRef.hpp:11
include
VoltMod
Entities
BoneFollow.hpp
Generated by
1.15.0