diff --git a/reapi/extra/amxmodx/scripting/include/reapi.inc b/reapi/extra/amxmodx/scripting/include/reapi.inc index fdfb9c8..ba2ad48 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi.inc @@ -80,7 +80,8 @@ enum members_tables_e mt_mapinfo, mt_csplayerweapon, mt_gib, - mt_netadr + mt_netadr, + mt_csentity }; #define ReAPIFunc {EngineFunc, GamedllFunc, GamedllFunc_CBaseAnimating, GamedllFunc_CBasePlayer, GamedllFunc_CSGameRules, GamedllFunc_CGrenade, GamedllFunc_CWeaponBox, ReCheckerFunc, GamedllFunc_CBasePlayerWeapon, GamedllFunc_CGib, GamedllFunc_CBaseEntity, GamedllFunc_CBotManager} diff --git a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc index 9749df4..124b8e6 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc @@ -6342,3 +6342,25 @@ enum CGib_Members */ m_Gib_lifeTime, }; + +/** +* CCSEntity API Members +*/ +enum CCSEntity_Members +{ + /* + * Description: Penetration level of the damage caused by the inflictor + * Member type: unsigned char + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_ucDmgPenetrationLevel = BEGIN_MEMBER_REGION(csplayerweapon), + + /* + * Description: Cached inflictor passed inside TakeDamage to retrieve in Killed + * Member type: entvars_t * + * Get params: get_member(index, member); + * Set params: set_member(index, member, value); + */ + m_pevLastInflictor, +}; diff --git a/reapi/include/cssdk/dlls/API/CSEntity.h b/reapi/include/cssdk/dlls/API/CSEntity.h index 4f32151..aa8de82 100644 --- a/reapi/include/cssdk/dlls/API/CSEntity.h +++ b/reapi/include/cssdk/dlls/API/CSEntity.h @@ -47,12 +47,13 @@ public: public: CBaseEntity *m_pContainingEntity; unsigned char m_ucDmgPenetrationLevel; // penetration level of the damage caused by the inflictor + entvars_t *m_pevLastInflictor; private: #if defined(_MSC_VER) #pragma region reserve_data_Region #endif - char CCSEntity_Reserve[0x3FFF]; + char CCSEntity_Reserve[0x3FF7]; virtual void func_reserve1() {}; virtual void func_reserve2() {}; diff --git a/reapi/src/member_list.cpp b/reapi/src/member_list.cpp index fb6ea88..bf3a90d 100644 --- a/reapi/src/member_list.cpp +++ b/reapi/src/member_list.cpp @@ -70,6 +70,7 @@ #define MAPINFO_MEMBERS(mx) CLASS_MEMBERS_PREF(CMapInfo, mx, m_MapInfo_##mx, m_) #define CSPLWPN_MEMBERS(mx) CLASS_MEMBERS_PREF(CCSPlayerWeapon, mx, m_Weapon_##mx, m_) #define GIB_MEMBERS(mx) CLASS_MEMBERS_PREF(CGib, mx, m_Gib_##mx, m_) +#define CSENT_MEMBERS(mx) CLASS_MEMBERS(CCSEntity, mx, mx) inline MType getMemberType(float*) { return MEMBER_FLOAT; } inline MType getMemberType(float) { return MEMBER_FLOAT; } @@ -1064,6 +1065,11 @@ member_t memberlist_netadr[] = { NETADR_MEMBERS(port) }; +member_t memberlist_csentity[] = { + CSENT_MEMBERS(m_ucDmgPenetrationLevel), + CSENT_MEMBERS(m_pevLastInflictor), +}; + #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // #ifdef __GNUC__ @@ -1128,6 +1134,7 @@ member_t *memberlist_t::operator[](size_t members) const CASE(csplayerweapon) CASE(gib) CASE(netadr) + CASE(csentity) } #undef CASE diff --git a/reapi/src/member_list.h b/reapi/src/member_list.h index 017dadc..5896933 100644 --- a/reapi/src/member_list.h +++ b/reapi/src/member_list.h @@ -83,7 +83,8 @@ struct memberlist_t mt_mapinfo, mt_csplayerweapon, mt_gib, - mt_netadr + mt_netadr, + mt_csentity }; }; @@ -1088,3 +1089,9 @@ enum CGib_Members m_Gib_material, m_Gib_lifeTime, }; + +enum CSEntity_Members +{ + m_ucDmgPenetrationLevel = BEGIN_MEMBER_REGION(csentity), + m_pevLastInflictor, +}; diff --git a/reapi/src/natives/natives_members.cpp b/reapi/src/natives/natives_members.cpp index 9c2daa1..54ba699 100644 --- a/reapi/src/natives/natives_members.cpp +++ b/reapi/src/natives/natives_members.cpp @@ -1122,6 +1122,7 @@ void *get_pdata_custom(CBaseEntity *pEntity, cell member) { const auto table = memberlist_t::members_tables_e(member / MAX_REGION_RANGE); switch (table) { + case memberlist_t::mt_csentity: case memberlist_t::mt_csplayer: case memberlist_t::mt_csplayerweapon: { if (unlikely(pEntity->m_pEntity == nullptr)) {