// creates a batch of aliens at the mouse cursor void asw_alien_batch_f( const CCommand& args ) { MDLCACHE_CRITICAL_SECTION(); bool allowPrecache = CBaseEntity::IsPrecacheAllowed(); CBaseEntity::SetAllowPrecache( true ); // find spawn point CASW_Player* pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (!pPlayer) return; CASW_Marine *pMarine = pPlayer->GetMarine(); if (!pMarine) return; trace_t tr; Vector forward; AngleVectors( pMarine->EyeAngles(), &forward ); UTIL_TraceLine(pMarine->EyePosition(), pMarine->EyePosition() + forward * 300.0f,MASK_SOLID, pMarine, COLLISION_GROUP_NONE, &tr ); if ( tr.fraction != 0.0 ) { // trace to the floor from this spot Vector vecSrc = tr.endpos; tr.endpos.z += 12; UTIL_TraceLine( vecSrc + Vector(0, 0, 12), vecSrc - Vector( 0, 0, 512 ) ,MASK_SOLID, pMarine, COLLISION_GROUP_NONE, &tr ); ASWSpawnManager()->SpawnAlienBatch( "asw_parasite", 25, tr.endpos, vec3_angle ); } CBaseEntity::SetAllowPrecache( allowPrecache ); }
void CASW_Weapon_Freeze_Grenades::DelayedAttack( void ) { m_bShotDelayed = false; CASW_Player *pPlayer = GetCommander(); if ( !pPlayer ) return; CASW_Marine *pMarine = GetMarine(); if ( !pMarine || pMarine->GetWaterLevel() == 3 ) return; #ifndef CLIENT_DLL Vector vecSrc = pMarine->GetOffhandThrowSource(); Vector vecDest = pPlayer->GetCrosshairTracePos(); Vector newVel = UTIL_LaunchVector( vecSrc, vecDest, GetThrowGravity() ) * 28.0f; float fGrenadeRadius = GetBoomRadius( pMarine ); if (asw_debug_marine_damage.GetBool()) { Msg( "Freeze grenade radius = %f \n", fGrenadeRadius ); } pMarine->GetMarineSpeech()->Chatter( CHATTER_GRENADE ); // freeze aliens completely, plus the freeze duration float flFreezeAmount = 1.0f + MarineSkills()->GetSkillBasedValueByMarine(pMarine, ASW_MARINE_SKILL_GRENADES, ASW_MARINE_SUBSKILL_GRENADE_FREEZE_DURATION); if (ASWGameRules()) ASWGameRules()->m_fLastFireTime = gpGlobals->curtime; CASW_Grenade_Freeze *pGrenade = CASW_Grenade_Freeze::Freeze_Grenade_Create( 1.0f, flFreezeAmount, fGrenadeRadius, 0, vecSrc, pMarine->EyeAngles(), newVel, AngularImpulse(0,0,0), pMarine, this ); if ( pGrenade ) { pGrenade->SetGravity( GetThrowGravity() ); pGrenade->SetExplodeOnWorldContact( true ); } #endif // decrement ammo m_iClip1 -= 1; #ifndef CLIENT_DLL DestroyIfEmpty( true ); #endif m_flSoonestPrimaryAttack = gpGlobals->curtime + ASW_FLARES_FASTEST_REFIRE_TIME; if (m_iClip1 > 0) // only force the fire wait time if we have ammo for another shot m_flNextPrimaryAttack = gpGlobals->curtime + GetFireRate(); else m_flNextPrimaryAttack = gpGlobals->curtime; }