void CGEGrenade::Spawn( void ) { Precache(); BaseClass::Spawn(); SetModel( "models/weapons/grenade/w_grenade.mdl" ); // So NPC's can "see" us AddFlag( FL_OBJECT ); m_takedamage = DAMAGE_YES; m_iHealth = 1; m_bHitSomething = false; m_bDroppedOnDeath = false; // Default Damages they should be modified by the thrower SetDamage( 320 ); SetDamageRadius( 260 ); SetSize( -Vector(4,4,4), Vector(4,4,4) ); SetCollisionGroup( COLLISION_GROUP_MINE ); // Init our physics definition VPhysicsInitNormal( SOLID_VPHYSICS, GetSolidFlags() | FSOLID_TRIGGER, false ); SetMoveType( MOVETYPE_VPHYSICS ); // Don't think until we have a time to think about! SetThink( NULL ); // Bounce if we hit something! SetTouch( &BaseClass::BounceTouch ); AddSolidFlags( FSOLID_NOT_STANDABLE ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CGrenadeObjectSapper::Spawn( void ) { SetMoveType( MOVETYPE_NONE ); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_SOLID ); SetGravity( 0.0 ); SetFriction( 1.0 ); SetModel( "models/sapper.mdl"); UTIL_SetSize(this, Vector( -8, -8, -8), Vector(8, 8, 8)); SetCollisionGroup( TFCOLLISION_GROUP_WEAPON ); m_takedamage = DAMAGE_NO; m_iHealth = 50.0; m_bSapping = false; // Set my damages to the cvar values SetDamage( weapon_objectsapper_damage.GetFloat() * 0.1 ); SetDamageRadius( 0 ); SetTouch( NULL ); SetThink( &CGrenadeObjectSapper::SapperThink ); SetNextThink( gpGlobals->curtime + 0.1f ); m_bArmed = true; }
void CGERocket::Spawn( void ) { Precache(); BaseClass::Spawn(); m_takedamage = DAMAGE_YES; m_iHealth = 1; m_bHitPlayer = false; // Default Damages they should be modified by the thrower SetDamage( 512 ); SetDamageRadius( 125 ); SetModel( "models/weapons/rocket_launcher/w_rocket.mdl" ); // Init our physics definition SetSolid( SOLID_VPHYSICS ); SetMoveType( MOVETYPE_FLY ); // So NPC's can "see" us AddFlag( FL_OBJECT ); // UTIL_SetSize( this, Vector(-10,-5,-5), Vector(10,5,5) ); SetCollisionGroup( COLLISION_GROUP_GRENADE ); SetThink( &CGERocket::IgniteThink ); SetNextThink( gpGlobals->curtime ); m_flSpawnTime = gpGlobals->curtime; // Explode if we hit anything solid SetTouch( &CGERocket::ExplodeTouch ); AddSolidFlags( FSOLID_NOT_STANDABLE ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFWeaponBaseGrenadeProj::InitGrenade( const Vector &velocity, const AngularImpulse &angVelocity, CBaseCombatCharacter *pOwner, const CTFWeaponInfo &weaponInfo ) { // We can't use OwnerEntity for grenades, because then the owner can't shoot them with his hitscan weapons (due to collide rules) // Thrower is used to store the person who threw the grenade, for damage purposes. SetOwnerEntity( NULL ); SetThrower( pOwner ); SetupInitialTransmittedGrenadeVelocity( velocity ); SetGravity( 0.4f/*BaseClass::GetGrenadeGravity()*/ ); SetFriction( 0.2f/*BaseClass::GetGrenadeFriction()*/ ); SetElasticity( 0.45f/*BaseClass::GetGrenadeElasticity()*/ ); SetDamage( weaponInfo.GetWeaponData( TF_WEAPON_PRIMARY_MODE ).m_nDamage ); SetDamageRadius( weaponInfo.m_flDamageRadius ); ChangeTeam( pOwner->GetTeamNumber() ); IPhysicsObject *pPhysicsObject = VPhysicsGetObject(); if ( pPhysicsObject ) { pPhysicsObject->AddVelocity( &velocity, &angVelocity ); } }