Browse Source

Fix possible shockroach stuck

opforfixed
Roman Chistokhodov 7 years ago
parent
commit
d4c0fea778
  1. 14
      dlls/gearbox/shockroach.cpp
  2. 3
      dlls/gearbox/shockroach.h

14
dlls/gearbox/shockroach.cpp

@ -31,7 +31,8 @@ LINK_ENTITY_TO_CLASS(monster_shockroach, CShockRoach);
TYPEDESCRIPTION CShockRoach::m_SaveData[] = TYPEDESCRIPTION CShockRoach::m_SaveData[] =
{ {
DEFINE_FIELD(CShockRoach, m_flDie, FIELD_TIME), DEFINE_FIELD(CShockRoach, m_flBirthTime, FIELD_TIME),
DEFINE_FIELD(CShockRoach, m_fRoachSolid, FIELD_BOOLEAN),
}; };
IMPLEMENT_SAVERESTORE(CShockRoach, CHeadCrab); IMPLEMENT_SAVERESTORE(CShockRoach, CHeadCrab);
@ -75,7 +76,6 @@ void CShockRoach::Spawn()
Precache(); Precache();
SET_MODEL(ENT(pev), "models/w_shock_rifle.mdl"); SET_MODEL(ENT(pev), "models/w_shock_rifle.mdl");
UTIL_SetSize(pev, Vector(-12, -12, 0), Vector(12, 12, 24));
pev->solid = SOLID_SLIDEBOX; pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_STEP; pev->movetype = MOVETYPE_STEP;
@ -87,7 +87,8 @@ void CShockRoach::Spawn()
m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result ) m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_MonsterState = MONSTERSTATE_NONE; m_MonsterState = MONSTERSTATE_NONE;
m_flDie = gpGlobals->time + RANDOM_LONG(10, 15); m_fRoachSolid = 0;
m_flBirthTime = gpGlobals->time;
MonsterInit(); MonsterInit();
} }
@ -152,7 +153,12 @@ void CShockRoach::LeapTouch(CBaseEntity *pOther)
void CShockRoach::PrescheduleThink(void) void CShockRoach::PrescheduleThink(void)
{ {
// explode when ready // explode when ready
if (gpGlobals->time >= m_flDie) if (!m_fRoachSolid && m_flBirthTime + 0.2 >= gpGlobals->time) {
m_fRoachSolid = TRUE;
UTIL_SetSize(pev, Vector(-12, -12, 0), Vector(12, 12, 24));
}
// explode when ready
if (gpGlobals->time >= m_flBirthTime + gSkillData.sroachLifespan)
{ {
pev->health = -1; pev->health = -1;
Killed(pev, 0); Killed(pev, 0);

3
dlls/gearbox/shockroach.h

@ -44,7 +44,8 @@ public:
static const char *pDeathSounds[]; static const char *pDeathSounds[];
static const char *pBiteSounds[]; static const char *pBiteSounds[];
float m_flDie; float m_flBirthTime;
BOOL m_fRoachSolid;
}; };

Loading…
Cancel
Save