12 : _hook(
"WeaponDrop", [this] {
return Install(); }),
13 Before(_hook.MakeLifecycle()),
20 const auto onDrop = [
this](EngineWeaponServices& services, CEntityInstance*,
bool swapping) {
21 return OnDrop(services, swapping);
23 return HookFunction(
"WeaponDrop", _bindings.DropWeapon, onDrop);
28 CEntityInstance* pawn = Schema::CPlayer_WeaponServices{&services}.OwnerEntity();
29 WeaponDropRequest drop{.Slot = pawn ? Pawn{_entities, pawn}.Slot() : -1, .Swapping = swapping};
41 if (!_bindings.DropWeapon)
43 return std::unexpected(
Error::Unsupported(
"the CCSPlayer_WeaponServices::DropWeapon signature did not bind"));
runtime.Entities: finds and creates entities. Everything it returns is valid for this frame only; see...
A hook before-handler's verdict.
static HookResult Block(Ret value)
WeaponDrop(EntitySystem &entities, const Bindings &bindings)
Event< WeaponDropRequest & > Before
Result< Subscription > HookFunction(std::string_view name, const Fn< Ret(Object *, Args...)> &function, Before &&before, After &&after=nullptr)
Hook a signature-bound function at its entry.
std::expected< void, Error > Status
std::expected< T, Error > Result
constexpr bool IsValidSlot(int slot)
static Error Unsupported(std::string detail)