mirror of
https://github.com/rehlds/reapi.git
synced 2025-01-16 00:28:17 +03:00
Add hookchain and getter/setter for spawn protection
Add hookchain for IsPenetrableEntity
This commit is contained in:
parent
b0026f3c34
commit
8996519b6e
@ -1,3 +1,3 @@
|
||||
majorVersion=5
|
||||
minorVersion=5
|
||||
minorVersion=6
|
||||
maintenanceVersion=0
|
||||
|
@ -372,7 +372,14 @@ enum GamedllFunc
|
||||
* Return type: CGrenade * (Entity index of bomb)
|
||||
* Params: (const index, Float:vecStart[3], Float:vecVelocity[3])
|
||||
*/
|
||||
RG_PlantBomb
|
||||
RG_PlantBomb,
|
||||
|
||||
/*
|
||||
* Description: Called when a player hit to entity.
|
||||
* Return type: bool
|
||||
* Params: (Float:vecSrc[3], Float:vecEnd[3], index, entity)
|
||||
*/
|
||||
RG_IsPenetrableEntity,
|
||||
};
|
||||
|
||||
/**
|
||||
@ -724,6 +731,20 @@ enum GamedllFunc_CBasePlayer
|
||||
* Params: (const this, const grenade, Float:vecSrc[3], Float:vecThrow[3], Float:time, const usEvent)
|
||||
*/
|
||||
RG_CBasePlayer_ThrowGrenade,
|
||||
|
||||
/*
|
||||
* Description: Called when a player's set protection.
|
||||
* Return type: void
|
||||
* Params: (const this, Float:time)
|
||||
*/
|
||||
RG_CBasePlayer_SetSpawnProtection,
|
||||
|
||||
/*
|
||||
* Description: Called when a player's remove protection.
|
||||
* Return type: void
|
||||
* Params: (const this)
|
||||
*/
|
||||
RG_CBasePlayer_RemoveSpawnProtection,
|
||||
};
|
||||
|
||||
/**
|
||||
@ -4371,6 +4392,14 @@ enum CCSPlayer_Members
|
||||
* Set params: set_member(index, member, Float:value);
|
||||
*/
|
||||
m_flRespawnPending,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: float
|
||||
* Get params: Float:get_member(index, member);
|
||||
* Set params: set_member(index, member, Float:value);
|
||||
*/
|
||||
m_flSpawnProtectionEndTime,
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
class CCSPlayer: public CCSMonster {
|
||||
public:
|
||||
CCSPlayer() : m_bForceShowMenu(false), m_flRespawnPending(0)
|
||||
CCSPlayer() : m_bForceShowMenu(false), m_flRespawnPending(0), m_flSpawnProtectionEndTime(0)
|
||||
{
|
||||
m_szModel[0] = '\0';
|
||||
}
|
||||
@ -80,6 +80,8 @@ public:
|
||||
virtual void ResetSequenceInfo();
|
||||
virtual void StartDeathCam();
|
||||
virtual bool RemovePlayerItemEx(const char* pszItemName, bool bRemoveAmmo);
|
||||
virtual void SetSpawnProtection(float flProtectionTime);
|
||||
virtual void RemoveSpawnProtection();
|
||||
|
||||
CBasePlayer *BasePlayer() const;
|
||||
|
||||
@ -87,6 +89,7 @@ public:
|
||||
char m_szModel[32];
|
||||
bool m_bForceShowMenu;
|
||||
float m_flRespawnPending;
|
||||
float m_flSpawnProtectionEndTime;
|
||||
};
|
||||
|
||||
// Inlines
|
||||
|
@ -512,6 +512,26 @@ CGrenade *CBasePlayer_ThrowGrenade(IReGameHook_CBasePlayer_ThrowGrenade *chain,
|
||||
return getPrivate<CGrenade>(callForward<size_t>(RG_CBasePlayer_ThrowGrenade, original, indexOfEdict(pthis->pev), indexOfEdict(pWeapon->pev), getAmxVector(vecSrcCopy), getAmxVector(vecThrowCopy), time, usEvent));
|
||||
}
|
||||
|
||||
void CBasePlayer_SetSpawnProtection(IReGameHook_CBasePlayer_SetSpawnProtection *chain, CBasePlayer *pthis, float flProtectionTime)
|
||||
{
|
||||
auto original = [chain](int _pthis, float _flProtectionTime)
|
||||
{
|
||||
return chain->callNext(getPrivate<CBasePlayer>(_pthis), _flProtectionTime);
|
||||
};
|
||||
|
||||
callVoidForward(RG_CBasePlayer_SetSpawnProtection, original, indexOfEdict(pthis->pev), flProtectionTime);
|
||||
}
|
||||
|
||||
void CBasePlayer_RemoveSpawnProtection(IReGameHook_CBasePlayer_RemoveSpawnProtection *chain, CBasePlayer *pthis)
|
||||
{
|
||||
auto original = [chain](int _pthis)
|
||||
{
|
||||
return chain->callNext(getPrivate<CBasePlayer>(_pthis));
|
||||
};
|
||||
|
||||
callVoidForward(RG_CBasePlayer_RemoveSpawnProtection, original, indexOfEdict(pthis->pev));
|
||||
}
|
||||
|
||||
void CBaseAnimating_ResetSequenceInfo(IReGameHook_CBaseAnimating_ResetSequenceInfo *chain, CBaseAnimating *pthis)
|
||||
{
|
||||
auto original = [chain](int _pthis)
|
||||
@ -1004,6 +1024,18 @@ CGrenade *PlantBomb(IReGameHook_PlantBomb *chain, entvars_t *pevOwner, Vector &v
|
||||
return getPrivate<CGrenade>(callForward<size_t>(RG_PlantBomb, original, indexOfEdict(pevOwner), getAmxVector(vecStartCopy), getAmxVector(vecVelocityCopy)));
|
||||
}
|
||||
|
||||
bool IsPenetrableEntity(IReGameHook_IsPenetrableEntity *chain, Vector &vecSrc, Vector &vecEnd, entvars_t *pevAttacker, edict_t *pHit)
|
||||
{
|
||||
Vector vecSrcCopy(vecSrc), vecEndCopy(vecEnd);
|
||||
|
||||
auto original = [chain, &vecSrcCopy, &vecEndCopy](cell _vecSrc, cell _vecEnd, int _pevAttacker, int _pHit)
|
||||
{
|
||||
return chain->callNext(vecSrcCopy, vecEndCopy, PEV(_pevAttacker), edictByIndexAmx(_pHit));
|
||||
};
|
||||
|
||||
return callForward<bool>(RG_IsPenetrableEntity, original, getAmxVector(vecSrcCopy), getAmxVector(vecEndCopy), indexOfEdict(pevAttacker), indexOfEdict(pHit));
|
||||
}
|
||||
|
||||
int g_iClientStartSpeak, g_iClientStopSpeak;
|
||||
|
||||
void OnClientStartSpeak(size_t clientIndex)
|
||||
|
@ -330,6 +330,7 @@ CGrenade *ThrowHeGrenade(IReGameHook_ThrowHeGrenade *chain, entvars_t *pevOwner,
|
||||
CGrenade *ThrowFlashbang(IReGameHook_ThrowFlashbang *chain, entvars_t *pevOwner, Vector &vecStart, Vector &vecVelocity, float time);
|
||||
CGrenade *ThrowSmokeGrenade(IReGameHook_ThrowSmokeGrenade *chain, entvars_t *pevOwner, Vector &vecStart, Vector &vecVelocity, float time, unsigned short usEvent);
|
||||
CGrenade *PlantBomb(IReGameHook_PlantBomb *chain, entvars_t *pevOwner, Vector &vecStart, Vector &vecVelocity);
|
||||
bool IsPenetrableEntity(IReGameHook_IsPenetrableEntity *chain, Vector &vecSrc, Vector &vecEnd, entvars_t *pevAttacker, edict_t *pHit);
|
||||
|
||||
// regamedll functions - player
|
||||
void CBasePlayer_Spawn(IReGameHook_CBasePlayer_Spawn *chain, CBasePlayer *pthis);
|
||||
@ -377,6 +378,8 @@ void CBasePlayer_StartDeathCam(IReGameHook_CBasePlayer_StartDeathCam *chain, CBa
|
||||
void CBasePlayer_SwitchTeam(IReGameHook_CBasePlayer_SwitchTeam *chain, CBasePlayer *pthis);
|
||||
bool CBasePlayer_CanSwitchTeam(IReGameHook_CBasePlayer_CanSwitchTeam *chain, CBasePlayer *pthis, TeamName teamToSwap);
|
||||
CGrenade *CBasePlayer_ThrowGrenade(IReGameHook_CBasePlayer_ThrowGrenade *chain, CBasePlayer *pthis, CBasePlayerWeapon *pWeapon, Vector &vecSrc, Vector &vecThrow, float time, unsigned short usEvent);
|
||||
void CBasePlayer_SetSpawnProtection(IReGameHook_CBasePlayer_SetSpawnProtection *chain, CBasePlayer *pthis, float flProtectionTime);
|
||||
void CBasePlayer_RemoveSpawnProtection(IReGameHook_CBasePlayer_RemoveSpawnProtection *chain, CBasePlayer *pthis);
|
||||
|
||||
void CBaseAnimating_ResetSequenceInfo(IReGameHook_CBaseAnimating_ResetSequenceInfo *chain, CBaseAnimating *pthis);
|
||||
|
||||
|
@ -98,6 +98,7 @@ hook_t hooklist_gamedll[] = {
|
||||
DLL(ThrowFlashbang),
|
||||
DLL(ThrowSmokeGrenade),
|
||||
DLL(PlantBomb),
|
||||
DLL(IsPenetrableEntity),
|
||||
};
|
||||
|
||||
hook_t hooklist_animating[] = {
|
||||
@ -150,6 +151,8 @@ hook_t hooklist_player[] = {
|
||||
DLL(CBasePlayer_SwitchTeam),
|
||||
DLL(CBasePlayer_CanSwitchTeam),
|
||||
DLL(CBasePlayer_ThrowGrenade),
|
||||
DLL(CBasePlayer_SetSpawnProtection),
|
||||
DLL(CBasePlayer_RemoveSpawnProtection),
|
||||
};
|
||||
|
||||
hook_t hooklist_gamerules[] = {
|
||||
|
@ -111,7 +111,8 @@ enum GamedllFunc
|
||||
RG_ThrowHeGrenade,
|
||||
RG_ThrowFlashbang,
|
||||
RG_ThrowSmokeGrenade,
|
||||
RG_PlantBomb
|
||||
RG_PlantBomb,
|
||||
RG_IsPenetrableEntity,
|
||||
|
||||
// [...]
|
||||
};
|
||||
@ -172,6 +173,8 @@ enum GamedllFunc_CBasePlayer
|
||||
RG_CBasePlayer_SwitchTeam,
|
||||
RG_CBasePlayer_CanSwitchTeam,
|
||||
RG_CBasePlayer_ThrowGrenade,
|
||||
RG_CBasePlayer_SetSpawnProtection,
|
||||
RG_CBasePlayer_RemoveSpawnProtection,
|
||||
|
||||
// [...]
|
||||
};
|
||||
|
@ -727,6 +727,7 @@ member_t memberlist_csplayer[] = {
|
||||
CSPL_MEMBERS(m_szModel),
|
||||
CSPL_MEMBERS(m_bForceShowMenu),
|
||||
CSPL_MEMBERS(m_flRespawnPending),
|
||||
CSPL_MEMBERS(m_flSpawnProtectionEndTime),
|
||||
};
|
||||
|
||||
member_t memberlist_baseitem[] = {
|
||||
|
@ -735,6 +735,7 @@ enum CSPlayer_Members
|
||||
m_szModel = BEGIN_MEMBER_REGION(csplayer),
|
||||
m_bForceShowMenu,
|
||||
m_flRespawnPending,
|
||||
m_flSpawnProtectionEndTime,
|
||||
};
|
||||
|
||||
enum CBasePlayerItem_Members
|
||||
|
Loading…
x
Reference in New Issue
Block a user