//----------------------------------------------------------------------------- // Purpose: Spawn //----------------------------------------------------------------------------- void CGrappleHook::Spawn(void) { Precache(); SetModel(HOOK_MODEL); SetMoveType(MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_CUSTOM); UTIL_SetSize(this, -Vector(1, 1, 1), Vector(1, 1, 1)); SetSolid(SOLID_BBOX); SetGravity(0.05f); // The rock is invisible, the crossbow bolt is the visual representation AddEffects(EF_NODRAW); // Make sure we're updated if we're underwater UpdateWaterState(); SetTouch(&CGrappleHook::HookTouch); SetThink(&CGrappleHook::FlyThink); SetNextThink(gpGlobals->curtime + 0.1f); //m_pSpring = NULL; m_fSpringLength = 0.0f; m_bPlayerWasStanding = false; // Create bolt model and parent it CBaseEntity *pBolt = CBaseEntity::CreateNoSpawn("prop_dynamic", GetAbsOrigin(), GetAbsAngles(), this); pBolt->SetModelName(MAKE_STRING(BOLT_MODEL)); pBolt->SetModel(BOLT_MODEL); DispatchSpawn(pBolt); pBolt->SetParent(this); }
//----------------------------------------------------------------------------- // Purpose: Spawn //----------------------------------------------------------------------------- void CGrappleHook::Spawn( void ) { Precache( ); SetModel( HOOK_MODEL ); SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_CUSTOM ); UTIL_SetSize( this, -Vector(1,1,1), Vector(1,1,1) ); SetSolid( SOLID_BBOX ); SetGravity( 0.05f ); // The rock is invisible, the crossbow bolt is the visual representation AddEffects( EF_NODRAW ); // Make sure we're updated if we're underwater UpdateWaterState(); SetTouch( &CGrappleHook::HookTouch ); SetThink( &CGrappleHook::FlyThink ); SetNextThink( gpGlobals->curtime + 0.1f ); m_pSpring = NULL; m_fSpringLength = 0.0f; m_bPlayerWasStanding = false; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CFlechette::Spawn( void ) { Precache( ); SetModel( BOLT_MODEL ); SetMoveType( MOVETYPE_FLY, MOVECOLLIDE_FLY_CUSTOM ); UTIL_SetSize( this, -Vector(1,1,1), Vector(1,1,1) ); SetSolid( SOLID_BBOX ); // Make sure we're updated if we're underwater UpdateWaterState(); SetTouch( &CFlechette::BoltTouch ); SetThink( &CFlechette::BubbleThink ); SetNextThink( gpGlobals->curtime + 0.1f ); CBasePlayer *pPlayer = ToBasePlayer(GetOwnerEntity()); if(pPlayer != NULL && HL2MPRules()->IsTeamplay()) { if(pPlayer->GetTeamNumber() == TEAM_PINK) m_nSkin = 1; else if(pPlayer->GetTeamNumber() == TEAM_GREEN) m_nSkin = 2; else m_nSkin = 0; } m_pGlowTrail = CSpriteTrail::SpriteTrailCreate( "sprites/grenade/grenade_laser.vmt", GetLocalOrigin(), false ); if ( m_pGlowTrail != NULL ) { m_pGlowTrail->FollowEntity( this ); if(m_nSkin == 1) m_pGlowTrail->SetTransparency( kRenderTransAdd, 255, 50, 255, 70, kRenderFxNone ); else if(m_nSkin == 2) m_pGlowTrail->SetTransparency( kRenderTransAdd, 0, 255, 0, 70, kRenderFxNone ); else m_pGlowTrail->SetTransparency( kRenderTransAdd, 255, 255, 255, 70, kRenderFxNone ); m_pGlowTrail->SetStartWidth( 3.0f ); m_pGlowTrail->SetEndWidth( 0.5f ); m_pGlowTrail->SetLifeTime( 0.4f ); } }
//----------------------------------------------------------------------------- // Purpose: Draws a beam // Input : &startPos - where the beam should begin // &endPos - where the beam should end // width - what the diameter of the beam should be (units?) //----------------------------------------------------------------------------- void CWeaponGrapple::DrawBeam( const Vector &startPos, const Vector &endPos, float width ) { #ifndef CLIENT_DLL //Tracer down the middle (NOT NEEDED, IT WILL FIRE A TRACER) //UTIL_Tracer( startPos, endPos, 0, TRACER_DONT_USE_ATTACHMENT, 6500, false, "GaussTracer" ); trace_t tr; //Draw the main beam shaft pBeam = CBeam::BeamCreate( "sprites/physbeam.vmt", 15.5 ); // It starts at startPos pBeam->SetStartPos( startPos ); // This sets up some things that the beam uses to figure out where // it should start and end pBeam->PointEntInit( endPos, this ); // This makes it so that the beam appears to come from the muzzle of the pistol pBeam->SetEndAttachment( LookupAttachment("Muzzle") ); pBeam->SetWidth( width ); // pBeam->SetEndWidth( 0.05f ); // Higher brightness means less transparent pBeam->SetBrightness( 255 ); //pBeam->SetColor( 255, 185+random->RandomInt( -16, 16 ), 40 ); pBeam->RelinkBeam(); //Sets scrollrate of the beam sprite float scrollOffset = gpGlobals->curtime + 5.5; pBeam->SetScrollRate(scrollOffset); // The beam should only exist for a very short time //pBeam->LiveForTime( 0.1f ); UpdateWaterState(); SetTouch( &CGrappleHook::HookTouch ); SetThink( &CGrappleHook::FlyThink ); SetNextThink( gpGlobals->curtime + 0.1f ); #endif }
void CFlowerBolt::Spawn( void ) { Precache( ); SetModel( "models/crossbow_bolt.mdl" ); SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_CUSTOM ); UTIL_SetSize( this, -Vector(1,1,1), Vector(1,1,1) ); SetSolid( SOLID_BBOX ); SetGravity( sv_gravity.GetFloat() / 800 ); // Make sure we're updated if we're underwater UpdateWaterState(); SetTouch( &CFlowerBolt::BoltTouch ); SetThink( &CFlowerBolt::BubbleThink ); SetNextThink( gpGlobals->curtime + 0.1f ); // Make us glow until we've hit the wall m_nSkin = BOLT_SKIN_GLOW; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CCrossbowBolt::Spawn() { Precache( ); SetModel( "models/crossbow_bolt.mdl" ); SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_CUSTOM ); UTIL_SetSize( this, -Vector(0.3f,0.3f,0.3f), Vector(0.3f,0.3f,0.3f) ); SetSolid( SOLID_BBOX ); SetGravity( 0.05f ); // Make sure we're updated if we're underwater UpdateWaterState(); SetTouch( &CCrossbowBolt::BoltTouch ); SetThink( &CCrossbowBolt::BubbleThink ); SetNextThink( gpGlobals->curtime + 0.1f ); CreateSprites(); // Make us glow until we've hit the wall m_nSkin = BOLT_SKIN_GLOW; }