pev->effects = 0;
pev->health = gSkillData.sroachHealth;
pev->view_ofs = Vector(0, 0, 20);// position of the eyes relative to monster's origin.
pev->yaw_speed = 5;//!!! should we put this in the monster's changeanim function since turn rates may vary with state/anim?
m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_MonsterState = MONSTERSTATE_NONE;
//=========================================================
// Precache - precaches all resources this monster needs
//=========================================================
void CShockRoach::Precache()
{
PRECACHE_SOUND_ARRAY(pIdleSounds);
PRECACHE_SOUND_ARRAY(pAlertSounds);
PRECACHE_SOUND_ARRAY(pPainSounds);
PRECACHE_SOUND_ARRAY(pAttackSounds);
PRECACHE_SOUND_ARRAY(pDeathSounds);
PRECACHE_SOUND_ARRAY(pBiteSounds);
PRECACHE_SOUND("shockroach/shock_walk.wav");
PRECACHE_MODEL("models/w_shock_rifle.mdl");
}
//=========================================================
// LeapTouch - this is the headcrab's touch function when it
// is in the air
//=========================================================
void CShockRoach::LeapTouch(CBaseEntity *pOther)
{
if (!pOther->pev->takedamage)
{
return;
}
if (pOther->Classify() == Classify())
{
return;
}
// Don't hit if back on ground
if (!FBitSet(pev->flags, FL_ONGROUND))
{
EMIT_SOUND_DYN(edict(), CHAN_WEAPON, RANDOM_SOUND_ARRAY(pBiteSounds), GetSoundVolume(), ATTN_IDLE, 0, GetVoicePitch());
// Give the shockrifle weapon to the player, if not already in possession.
if (pOther->IsPlayer() && pOther->IsAlive() && !(pOther->pev->weapons & (1 << WEAPON_SHOCKRIFLE))) {
CBasePlayer* pPlayer = (CBasePlayer*)(pOther);
pPlayer->GiveNamedItem("weapon_shockrifle");
pPlayer->pev->weapons |= (1 << WEAPON_SHOCKRIFLE);
UTIL_Remove(this);
return;
}