diff --git a/reapi/extra/amxmodx/scripting/include/reapi_engine_const.inc b/reapi/extra/amxmodx/scripting/include/reapi_engine_const.inc index b40be50..3835e42 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_engine_const.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_engine_const.inc @@ -162,6 +162,13 @@ enum EngineFunc */ RH_SV_ClientPrintf, + /* + * Description: Called before adding an entity to the physents of a player. + * Return type: bool + * Params: (const entity, const client) + */ + RH_SV_AllowPhysent, + }; /** diff --git a/reapi/include/cssdk/engine/rehlds_api.h b/reapi/include/cssdk/engine/rehlds_api.h index a76ec9f..3e2b4ec 100644 --- a/reapi/include/cssdk/engine/rehlds_api.h +++ b/reapi/include/cssdk/engine/rehlds_api.h @@ -36,7 +36,7 @@ #include "pr_dlls.h" #define REHLDS_API_VERSION_MAJOR 3 -#define REHLDS_API_VERSION_MINOR 12 +#define REHLDS_API_VERSION_MINOR 13 //Steam_NotifyClientConnect hook typedef IHookChain IRehldsHook_Steam_NotifyClientConnect; @@ -254,6 +254,10 @@ typedef IVoidHookChainRegistry IRehldsHook_SV_ClientPrintf; typedef IVoidHookChainRegistry IRehldsHookRegistry_SV_ClientPrintf; +//SV_AllowPhysent hook +typedef IHookChain IRehldsHook_SV_AllowPhysent; +typedef IHookChainRegistry IRehldsHookRegistry_SV_AllowPhysent; + class IRehldsHookchains { public: virtual ~IRehldsHookchains() { } @@ -312,6 +316,7 @@ public: virtual IRehldsHookRegistry_EV_Precache* EV_Precache() = 0; virtual IRehldsHookRegistry_SV_AddResource* SV_AddResource() = 0; virtual IRehldsHookRegistry_SV_ClientPrintf* SV_ClientPrintf() = 0; + virtual IRehldsHookRegistry_SV_AllowPhysent* SV_AllowPhysent() = 0; }; struct RehldsFuncs_t { diff --git a/reapi/src/hook_callback.cpp b/reapi/src/hook_callback.cpp index 95847d6..e785b20 100644 --- a/reapi/src/hook_callback.cpp +++ b/reapi/src/hook_callback.cpp @@ -140,6 +140,16 @@ void ED_Free(IRehldsHook_ED_Free* chain, edict_t *entity) callVoidForward(RH_ED_Free, original, indexOfEdict(entity)); } +bool SV_AllowPhysent(IRehldsHook_SV_AllowPhysent* chain, edict_t* check, edict_t* sv_player) +{ + auto original = [chain](int _check, int _sv_player) + { + return chain->callNext(edictByIndexAmx(_check), edictByIndexAmx(_sv_player)); + }; + + return callForward(RH_SV_AllowPhysent, original, indexOfEdict(check), indexOfEdict(sv_player)); +} + int SV_CheckUserInfo(IRehldsHook_SV_CheckUserInfo *chain, netadr_t *adr, char *userinfo, qboolean bIsReconnecting, int iReconnectSlot, char *name) { auto original = [chain](netadr_t *_adr, char *_userinfo, qboolean _bIsReconnecting, int _iReconnectSlot, char *_name) diff --git a/reapi/src/hook_callback.h b/reapi/src/hook_callback.h index 3ebec5f..7e6d93b 100644 --- a/reapi/src/hook_callback.h +++ b/reapi/src/hook_callback.h @@ -378,6 +378,7 @@ void SV_AddResource(IRehldsHook_SV_AddResource *chain, resourcetype_t type, cons edict_t *ED_Alloc(IRehldsHook_ED_Alloc* chain); void ED_Free(IRehldsHook_ED_Free* chain, edict_t *entity); void SV_ClientPrintf(IRehldsHook_SV_ClientPrintf* chain, const char *string); +bool SV_AllowPhysent(IRehldsHook_SV_AllowPhysent* chain, edict_t* check, edict_t* sv_player); // regamedll functions int GetForceCamera(IReGameHook_GetForceCamera *chain, CBasePlayer *pObserver); diff --git a/reapi/src/hook_list.cpp b/reapi/src/hook_list.cpp index 32b7dc2..1d4bc7d 100644 --- a/reapi/src/hook_list.cpp +++ b/reapi/src/hook_list.cpp @@ -103,6 +103,7 @@ hook_t hooklist_engine[] = { ENG(EV_Precache, _AMXX), ENG(SV_AddResource), ENG(SV_ClientPrintf), + ENG(SV_AllowPhysent), }; diff --git a/reapi/src/hook_list.h b/reapi/src/hook_list.h index fad1da6..985af8a 100644 --- a/reapi/src/hook_list.h +++ b/reapi/src/hook_list.h @@ -112,6 +112,7 @@ enum EngineFunc RH_EV_Precache, RH_SV_AddResource, RH_SV_ClientPrintf, + RH_SV_AllowPhysent, // [...] }; diff --git a/reapi/version/version.h b/reapi/version/version.h index b65ba1a..554ac42 100644 --- a/reapi/version/version.h +++ b/reapi/version/version.h @@ -6,5 +6,5 @@ #pragma once #define VERSION_MAJOR 5 -#define VERSION_MINOR 22 +#define VERSION_MINOR 23 #define VERSION_MAINTENANCE 0