make some more entities non-edicts
This commit is contained in:
parent
9d0dcb4f04
commit
783312ed75
@ -308,21 +308,52 @@ DETOUR_DECL_MEMBER1(DETOUR_InputTestActivator, void, inputdata_t *, inputdata)
|
||||
DETOUR_MEMBER_CALL(DETOUR_InputTestActivator)(inputdata);
|
||||
}
|
||||
|
||||
static constexpr int s_iNonEdicts = 12;
|
||||
|
||||
const char *pszNonEdicts[s_iNonEdicts] =
|
||||
{
|
||||
"ambient_generic",
|
||||
"game_score",
|
||||
"game_text",
|
||||
"game_ui",
|
||||
"logic_auto", // bruh
|
||||
"phys_thruster",
|
||||
"phys_keepupright",
|
||||
"player_speedmod",
|
||||
"player_weaponstrip",
|
||||
"point_clientcommand",
|
||||
"point_servercommand",
|
||||
"point_teleport",
|
||||
};
|
||||
|
||||
DETOUR_DECL_MEMBER1(DETOUR_PostConstructor, void, const char *, szClassname)
|
||||
{
|
||||
CBaseEntity *pEntity = (CBaseEntity *)this;
|
||||
|
||||
static datamap_t *pMap = gamehelpers->GetDataMap(pEntity);
|
||||
static typedescription_t *td = gamehelpers->FindInDataMap(pMap, "m_iEFlags");
|
||||
static uint32 offset = td->fieldOffset[TD_OFFSET_NORMAL];
|
||||
|
||||
if(strncasecmp(szClassname, "info_player_", 12) == 0)
|
||||
{
|
||||
CBaseEntity *pEntity = (CBaseEntity *)this;
|
||||
|
||||
datamap_t *pMap = gamehelpers->GetDataMap(pEntity);
|
||||
typedescription_t *td = gamehelpers->FindInDataMap(pMap, "m_iEFlags");
|
||||
|
||||
// Spawnpoints don't need edicts...
|
||||
*(uint32 *)((intptr_t)pEntity + td->fieldOffset[TD_OFFSET_NORMAL]) |= (1<<9); // EFL_SERVER_ONLY
|
||||
*(uint32 *)((intptr_t)pEntity + offset) |= (1<<9); // EFL_SERVER_ONLY
|
||||
|
||||
// Only CT spawnpoints
|
||||
if(strcasecmp(szClassname, "info_player_terrorist") == 0)
|
||||
szClassname = "info_player_counterterrorist";
|
||||
|
||||
DETOUR_MEMBER_CALL(DETOUR_PostConstructor)(szClassname);
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove edicts for a bunch of entities that REALLY don't need them
|
||||
for (int i = 0; i < s_iNonEdicts; i++)
|
||||
{
|
||||
if (!strcasecmp(szClassname, pszNonEdicts[i]))
|
||||
{
|
||||
*(uint32 *)((intptr_t)pEntity + offset) |= (1<<9); // EFL_SERVER_ONLY
|
||||
}
|
||||
}
|
||||
|
||||
DETOUR_MEMBER_CALL(DETOUR_PostConstructor)(szClassname);
|
||||
|
Loading…
Reference in New Issue
Block a user