mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2024-12-26 22:55:41 +03:00
func_breakable: Remove m_iszSpawnObject on restart round (#476)
func_breakable: Remove m_iszSpawnObject on restart round
This commit is contained in:
parent
a7443e9e1e
commit
315d0d06f5
@ -157,6 +157,22 @@ void CBreakable::Restart()
|
||||
{
|
||||
pev->flags |= FL_WORLDBRUSH;
|
||||
}
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (m_iszSpawnObject)
|
||||
{
|
||||
CBaseEntity *pEntity = nullptr;
|
||||
|
||||
while ((pEntity = UTIL_FindEntityByClassname(pEntity, STRING(m_iszSpawnObject))))
|
||||
{
|
||||
if (!FNullEnt(pEntity->pev->owner) && FClassnameIs(pEntity->pev->owner, "func_breakable"))
|
||||
{
|
||||
pEntity->SetThink(&CBaseEntity::SUB_Remove);
|
||||
pEntity->pev->nextthink = gpGlobals->time + 0.1f;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void CBreakable::KeyValue(KeyValueData *pkvd)
|
||||
@ -821,12 +837,9 @@ void CBreakable::Die()
|
||||
auto pItem = CBaseEntity::Create((char *)STRING(m_iszSpawnObject), VecBModelOrigin(pev), pev->angles, edict());
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
// FIX: entity leak!
|
||||
if (pItem)
|
||||
{
|
||||
pItem->pev->spawnflags |= SF_NORESPAWN;
|
||||
pItem->SetThink(&CBaseEntity::SUB_Remove);
|
||||
pItem->pev->nextthink = gpGlobals->time + CGameRules::GetItemKillDelay();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user