DynamicHook < DHookSetup

Last Updated2022-03-07
Created At2021-11-17

A DynamicHook allows to hook a virtual function on any C++ object. Currently CBaseEntity and CGameRules have a convenience API for easy entity hooking, but it's possible to provide a raw this-pointer to hook any object in memory too. Internally this intercepts function calls by replacing the function pointer in the virtual table of the object with our own function.

Methods6
SymbolDescription
DynamicHookCreates a vtable hook.
FromConfSetup a vtable hook for a function as described in a "Functions" section in gamedata. The "Functions" section is parsed once the gamedata file is loaded and cached globally.
HookEntityHook an entity. Entity hooks are auto-removed when the entity is destroyed. If you need to read the return value of the function, choose a post hook.
HookGamerulesHook gamerules object. Game rules hooks are auto-removed on map end. If you need to read the return value of the function, choose a post hook.
HookRawHook a raw this-pointer. If you need to read the return value of the function, choose a post hook.
RemoveHookRemove hook by hook id.