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

A player's own weapon drops, from CCSPlayer_WeaponServices::DropWeapon. More...

#include <WeaponDrop.hpp>

Public Member Functions

 WeaponDrop (EntitySystem &entities, const Bindings &bindings)
 
 WeaponDrop (const WeaponDrop &)=delete
 
WeaponDrop & operator= (const WeaponDrop &)=delete
 
Status Available () const
 

Public Attributes

Event< WeaponDropRequest & > Before
 

Detailed Description

A player's own weapon drops, from CCSPlayer_WeaponServices::DropWeapon.

The drop key (G) reaches the server here, not as a drop command. The hook runs before the game's own checks, so it sees the key even while mp_death_drop_gun 0 or mp_drop_knife_enable 0 keep the weapon in hand. It installs on the first Before subscription.

_drops = runtime.WeaponDrop.Before += [this](VoltMod::WeaponDropRequest& drop) {
if (!drop.Swapping)
{
drop.Blocked = true;
OpenShop(drop.Slot);
}
};
static std::string ReadFile(const std::filesystem::path &path)
Definition Loader.cpp:56

Game-thread only.

Definition at line 43 of file WeaponDrop.hpp.

Constructor & Destructor Documentation

◆ WeaponDrop() [1/2]

VoltMod::WeaponDrop::WeaponDrop ( EntitySystem &  entities,
const Bindings &  bindings 
)

entities resolves the dropping player and bindings supplies the drop function. Both must outlive this service; the Runtime declares them above.

Definition at line 11 of file WeaponDrop.cpp.

◆ WeaponDrop() [2/2]

VoltMod::WeaponDrop::WeaponDrop ( const WeaponDrop &  )
delete

Member Function Documentation

◆ Available()

Status VoltMod::WeaponDrop::Available ( ) const

Why drops cannot be hooked: the drop signature did not bind.

Definition at line 39 of file WeaponDrop.cpp.

◆ operator=()

WeaponDrop & VoltMod::WeaponDrop::operator= ( const WeaponDrop &  )
delete

Member Data Documentation

◆ Before

Event<WeaponDropRequest&> VoltMod::WeaponDrop::Before

Raised before the game handles a player's drop.

Definition at line 57 of file WeaponDrop.hpp.


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