//=============================================================================================================================== // CRANE CABLE TIP //=============================================================================================================================== //----------------------------------------------------------------------------- // Purpose: To by usable by the constraint system, this needs to have a phys model. //----------------------------------------------------------------------------- void CCraneTip::Spawn( void ) { Precache(); SetModel( "models/props_junk/cardboard_box001a.mdl" ); AddEffects( EF_NODRAW ); // We don't want this to be solid, because we don't want it to collide with the hydra. SetSolid( SOLID_VPHYSICS ); AddSolidFlags( FSOLID_NOT_SOLID ); VPhysicsInitShadow( false, false ); // Disable movement on this sucker, we're going to move him manually SetMoveType( MOVETYPE_NONE ); BaseClass::Spawn(); m_pSpring = NULL; }
void CASW_Mine::Spawn( void ) { Precache( ); SetModel( ASW_MINE_MODEL ); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_SOLID || FSOLID_TRIGGER); SetMoveType( MOVETYPE_FLYGRAVITY ); m_takedamage = DAMAGE_NO; m_bPrimed = false; AddEffects( EF_NOSHADOW|EF_NORECEIVESHADOW ); m_fForcePrimeTime = gpGlobals->curtime + 5.0f; SetThink( &CASW_Mine::MineThink ); SetNextThink( gpGlobals->curtime + 0.1f ); SetTouch( &CASW_Mine::MineTouch ); }
void CPushable::Spawn( void ) { if ( HasSpawnFlags( SF_PUSH_BREAKABLE ) ) { BaseClass::Spawn(); } else { Precache(); SetSolid( SOLID_VPHYSICS ); SetMoveType( MOVETYPE_PUSH ); SetModel( STRING( GetModelName() ) ); CreateVPhysics(); } }
void CSDKPlayer::State_PreThink_DEATH_ANIM() { // If the anim is done playing, go to the next state (waiting for a keypress to // either respawn the guy or put him into observer mode). if ( GetFlags() & FL_ONGROUND ) { float flForward = GetAbsVelocity().Length() - 20; if (flForward <= 0) { SetAbsVelocity( vec3_origin ); } else { Vector vAbsVel = GetAbsVelocity(); VectorNormalize( vAbsVel ); vAbsVel *= flForward; SetAbsVelocity( vAbsVel ); } } if ( gpGlobals->curtime >= (m_flDeathTime + SDK_PLAYER_DEATH_TIME ) ) // let the death cam stay going up to min spawn time. { m_lifeState = LIFE_DEAD; StopAnimation(); AddEffects( EF_NOINTERP ); if ( GetMoveType() != MOVETYPE_NONE && (GetFlags() & FL_ONGROUND) ) SetMoveType( MOVETYPE_NONE ); } //Tony; if we're now dead, and not changing classes, spawn if ( m_lifeState == LIFE_DEAD ) { #if defined ( SDK_USE_PLAYERCLASSES ) //Tony; if the class menu is open, don't respawn them, wait till they're done. if (IsClassMenuOpen()) return; #endif State_Transition( STATE_ACTIVE ); } }
void CSquidSpit:: Spawn( void ) { Precache(); SetMoveType ( MOVETYPE_FLY ); SetClassname( "squidspit" ); SetSolid( SOLID_BBOX ); m_nRenderMode = kRenderTransAlpha; SetRenderColorA( 255 ); SetModel( "" ); SetSprite( CSprite::SpriteCreate( "sprites/bigspit.vmt", GetAbsOrigin(), true ) ); UTIL_SetSize( this, Vector( 0, 0, 0), Vector(0, 0, 0) ); SetCollisionGroup( HL2COLLISION_GROUP_SPIT ); }
//----------------------------------------------------------------------------- // Spawn //----------------------------------------------------------------------------- void CAmbientGenericFMOD::Spawn( void ) { char *szSoundFile = (char *)STRING( m_iszSound ); if ( !m_iszSound || strlen( szSoundFile ) < 1 ) { Warning( "Empty %s (%s) at %.2f, %.2f, %.2f\n", GetClassname(), GetDebugName(), GetAbsOrigin().x, GetAbsOrigin().y, GetAbsOrigin().z ); UTIL_Remove(this); return; } if ( m_iszSound == NULL_STRING ) { UTIL_Remove(this); return; } SetSolid( SOLID_NONE ); SetMoveType( MOVETYPE_NONE ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CFlare::Launch( const Vector &direction, float speed ) { // Make sure we're visible if ( m_spawnflags & SF_FLARE_INFINITE ) { Start( -1 ); } else { Start( 8.0f ); } SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE ); // Punch our velocity towards our facing SetAbsVelocity( direction * speed ); SetGravity( 1.0f ); }
void CTripmineGrenade::Spawn( void ) { Precache( ); // motor SetMoveType( MOVETYPE_FLY ); SetSolid( SOLID_BBOX ); SetModel( "models/Weapons/w_slam.mdl" ); IPhysicsObject *pObject = VPhysicsInitNormal( SOLID_BBOX, GetSolidFlags() | FSOLID_TRIGGER, true ); pObject->EnableMotion( false ); SetCollisionGroup( COLLISION_GROUP_WEAPON ); SetCycle( 0.0f ); m_nBody = 3; m_flDamage = sk_plr_dmg_tripmine.GetFloat(); m_DmgRadius = sk_tripmine_radius.GetFloat(); ResetSequenceInfo( ); m_flPlaybackRate = 0; UTIL_SetSize(this, Vector( -4, -4, -2), Vector(4, 4, 2)); m_flPowerUp = gpGlobals->curtime + 2.0; SetThink( &CTripmineGrenade::PowerupThink ); SetNextThink( gpGlobals->curtime + 0.2 ); m_takedamage = DAMAGE_YES; m_iHealth = 1; EmitSound( "TripmineGrenade.Place" ); SetDamage ( 200 ); // Tripmine sits at 90 on wall so rotate back to get m_vecDir QAngle angles = GetAbsAngles(); angles.x -= 90; AngleVectors( angles, &m_vecDir ); m_vecEnd = GetAbsOrigin() + m_vecDir * 2048; AddEffects( EF_NOSHADOW ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CGrenadeSpit::Spawn( void ) { Precache( ); SetSolid( SOLID_BBOX ); SetMoveType( MOVETYPE_FLYGRAVITY ); SetSolidFlags( FSOLID_NOT_STANDABLE ); SetModel( "models/spitball_large.mdl" ); UTIL_SetSize( this, vec3_origin, vec3_origin ); SetUse( &CBaseGrenade::DetonateUse ); SetTouch( &CGrenadeSpit::GrenadeSpitTouch ); SetNextThink( gpGlobals->curtime + 0.1f ); m_flDamage = sk_antlion_worker_spit_grenade_dmg.GetFloat(); m_DmgRadius = sk_antlion_worker_spit_grenade_radius.GetFloat(); m_takedamage = DAMAGE_NO; m_iHealth = 1; SetGravity( UTIL_ScaleForGravity( SPIT_GRAVITY ) ); SetFriction( 0.8f ); SetCollisionGroup( HL2COLLISION_GROUP_SPIT ); AddEFlags( EFL_FORCE_CHECK_TRANSMIT ); // We're self-illuminating, so we don't take or give shadows AddEffects( EF_NOSHADOW|EF_NORECEIVESHADOW ); // Create the dust effect in place m_hSpitEffect = (CParticleSystem *) CreateEntityByName( "info_particle_system" ); if ( m_hSpitEffect != NULL ) { // Setup our basic parameters m_hSpitEffect->KeyValue( "start_active", "1" ); m_hSpitEffect->KeyValue( "effect_name", "antlion_spit_trail" ); m_hSpitEffect->SetParent( this ); m_hSpitEffect->SetLocalOrigin( vec3_origin ); DispatchSpawn( m_hSpitEffect ); if ( gpGlobals->curtime > 0.5f ) m_hSpitEffect->Activate(); } }
//------------------------------------------------------------------------------ // Purpose : // Input : // Output : //------------------------------------------------------------------------------ void CGrenadeBeam::Spawn( void ) { Precache( ); SetSolid( SOLID_BBOX ); SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE ); //UNDONE/HACK: this model is never used but one is needed SetModel( "Models/weapons/flare.mdl" ); AddEffects( EF_NODRAW ); SetTouch( &CGrenadeBeam::GrenadeBeamTouch ); SetNextThink( gpGlobals->curtime ); m_takedamage = DAMAGE_NO; m_iHealth = 1; SetGravity( 0.0001 ); m_nNumHits = 0; UTIL_SetSize( this, vec3_origin, vec3_origin ); }
//--------------------------------------------------------- //--------------------------------------------------------- void CBlobElement::Spawn() { Precache(); SetSolid( SOLID_NONE ); SetMoveType( MOVETYPE_FLY ); AddSolidFlags( FSOLID_NOT_STANDABLE | FSOLID_NOT_SOLID ); SetModel( GetBlobModelName() ); UTIL_SetSize( this, vec3_origin, vec3_origin ); QAngle angles(0,0,0); angles.y = random->RandomFloat( 0, 180 ); SetAbsAngles( angles ); AddEffects( EF_NOSHADOW ); ReconfigureRandomParams(); }
void CASW_Laser_Mine::Spawn( void ) { Precache( ); SetModel( ASW_LASER_MINE_MODEL ); SetSolid( SOLID_NONE ); AddSolidFlags( FSOLID_NOT_SOLID ); SetMoveType( MOVETYPE_NONE ); m_takedamage = DAMAGE_NO; m_flDamageRadius = 256.0f; // TODO: grab from marine skill m_flDamage = 100.0f; // TODO: Grab from marine skill m_bMineActive = false; m_nSkin = 3; AddEffects( EF_NOSHADOW|EF_NORECEIVESHADOW ); SetThink( &CASW_Laser_Mine::LaserThink ); SetNextThink( gpGlobals->curtime + 0.1f ); }
//----------------------------------------------------------------------------- // 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 ); } }
void CStickyBomb::Spawn() { m_hOperator = GetOwnerEntity(); Precache(); SetModel( STICKY_BOMB_MODEL ); SetSolid( SOLID_BBOX ); SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_CUSTOM ); SetCollisionGroup( COLLISION_GROUP_NONE ); m_takedamage = DAMAGE_NO; SetNextThink( TICK_NEVER_THINK ); m_flAnimTime = gpGlobals->curtime; m_flPlaybackRate = 0.0; m_flCycle = 0; UTIL_SetSize( this, vec3_origin, vec3_origin ); Relink(); // no shadows, please. m_fEffects |= EF_NOSHADOW|EF_NORECEIVESHADOW; SetRenderColor( 255, 0, 0 ); }
void CNPC_AlienGrunt::Spawn() { Precache(); SetModel( "models/agrunt.mdl"); UTIL_SetSize( this, Vector( -32, -32, 0 ), Vector( 32, 32, 64 ) ); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); Vector vecSurroundingMins( -32, -32, 0 ); Vector vecSurroundingMaxs( 32, 32, 85 ); CollisionProp()->SetSurroundingBoundsType( USE_SPECIFIED_BOUNDS, &vecSurroundingMins, &vecSurroundingMaxs ); SetMoveType( MOVETYPE_STEP ); m_bloodColor = BLOOD_COLOR_GREEN; ClearEffects(); m_iHealth = sk_agrunt_health.GetFloat(); m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result ) m_NPCState = NPC_STATE_NONE; CapabilitiesClear(); CapabilitiesAdd ( bits_CAP_SQUAD | bits_CAP_MOVE_GROUND ); CapabilitiesAdd(bits_CAP_INNATE_RANGE_ATTACK1 ); // Innate range attack for kicking CapabilitiesAdd(bits_CAP_INNATE_MELEE_ATTACK1 ); m_HackedGunPos = Vector( 24, 64, 48 ); m_flNextSpeakTime = m_flNextWordTime = gpGlobals->curtime + 10 + random->RandomInt( 0, 10 ); SetHullType(HULL_WIDE_HUMAN); SetHullSizeNormal(); SetRenderColor( 255, 255, 255, 255 ); NPCInit(); BaseClass::Spawn(); }
//========================================================= // Spawn //========================================================= void CNPC_Gargantua::Spawn() { Precache( ); SetModel( "models/garg.mdl" ); SetNavType(NAV_GROUND); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_STEP ); Vector vecSurroundingMins( -80, -80, 0 ); Vector vecSurroundingMaxs( 80, 80, 214 ); CollisionProp()->SetSurroundingBoundsType( USE_SPECIFIED_BOUNDS, &vecSurroundingMins, &vecSurroundingMaxs ); m_bloodColor = BLOOD_COLOR_GREEN; m_iHealth = sk_gargantua_health.GetFloat(); SetViewOffset( Vector ( 0, 0, 96 ) );// taken from mdl file m_flFieldOfView = -0.2;// width of forward view cone ( as a dotproduct result ) m_NPCState = NPC_STATE_NONE; CapabilitiesAdd( bits_CAP_MOVE_GROUND ); CapabilitiesAdd( bits_CAP_INNATE_RANGE_ATTACK1 | bits_CAP_INNATE_MELEE_ATTACK1 | bits_CAP_INNATE_MELEE_ATTACK2 ); SetHullType( HULL_LARGE ); SetHullSizeNormal(); m_pEyeGlow = CSprite::SpriteCreate( GARG_EYE_SPRITE_NAME, GetAbsOrigin(), FALSE ); m_pEyeGlow->SetTransparency( kRenderGlow, 255, 255, 255, 0, kRenderFxNoDissipation ); m_pEyeGlow->SetAttachment( this, 1 ); EyeOff(); m_seeTime = gpGlobals->curtime + 5; m_flameTime = gpGlobals->curtime + 2; NPCInit(); BaseClass::Spawn(); // Give garg a healthy free knowledge. GetEnemies()->SetFreeKnowledgeDuration( 59.0f ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CNPC_Launcher::Spawn( void ) { Precache(); // This is a dummy model that is never used! SetModel( "models/player.mdl" ); UTIL_SetSize(this, vec3_origin, vec3_origin); m_takedamage = DAMAGE_NO; if (m_nHomingStrength > 100) { m_nHomingStrength = 100; Warning("WARNING: NPC_Launcher Homing Strength must be between 0 and 100\n"); } SetSolid( SOLID_NONE ); SetMoveType( MOVETYPE_NONE ); SetBloodColor( DONT_BLEED ); AddEffects( EF_NODRAW ); AddFlag( FL_NPC ); CapabilitiesAdd( bits_CAP_SQUAD ); InitRelationshipTable(); if (m_nStartOn) { LauncherTurnOn(); } // ------------------------------------------------------- // If I form squads add me to a squad // ------------------------------------------------------- // @TODO (toml 12-05-02): RECONCILE WITH SAVE/RESTORE if (!m_pSquad) { m_pSquad = g_AI_SquadManager.FindCreateSquad(this, m_SquadName); } }
//----------------------------------------------------------------------------- // Spawn //----------------------------------------------------------------------------- void CAmbientGeneric::Spawn( void ) { m_iSoundLevel = ComputeSoundlevel( m_radius, FBitSet( m_spawnflags, SF_AMBIENT_SOUND_EVERYWHERE )?true:false ); ComputeMaxAudibleDistance( ); char *szSoundFile = (char *)STRING( m_iszSound ); if ( !m_iszSound || strlen( szSoundFile ) < 1 ) { Warning( "Empty %s (%s) at %.2f, %.2f, %.2f\n", GetClassname(), GetDebugName(), GetAbsOrigin().x, GetAbsOrigin().y, GetAbsOrigin().z ); UTIL_Remove(this); return; } SetSolid( SOLID_NONE ); SetMoveType( MOVETYPE_NONE ); // Set up think function for dynamic modification // of ambient sound's pitch or volume. Don't // start thinking yet. SetThink(&CAmbientGeneric::RampThink); SetNextThink( TICK_NEVER_THINK ); m_fActive = false; if ( FBitSet ( m_spawnflags, SF_AMBIENT_SOUND_NOT_LOOPING ) ) { m_fLooping = false; } else { m_fLooping = true; } m_hSoundSource = NULL; m_nSoundSourceEntIndex = -1; Precache( ); // init all dynamic modulation parms InitModulationParms(); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CGrenadeHopwire::CombatThink( void ) { // Stop the grenade from moving AddEFlags( EF_NODRAW ); AddFlag( FSOLID_NOT_SOLID ); VPhysicsDestroyObject(); SetAbsVelocity( vec3_origin ); SetMoveType( MOVETYPE_NONE ); // Do special behaviors if there are any striders in the area KillStriders(); // FIXME: Replace //EmitSound("NPC_Strider.Shoot"); //EmitSound("d3_citadel.weapon_zapper_beam_loop2"); // Quick screen flash CBasePlayer *pPlayer = ToBasePlayer( GetThrower() ); color32 white = { 255,255,255,255 }; UTIL_ScreenFade( pPlayer, white, 0.2f, 0.0f, FFADE_IN ); // Create the vortex controller to pull entities towards us if ( hopwire_vortex.GetBool() ) { m_hVortexController = CGravityVortexController::Create( GetAbsOrigin(), 512, 150, 3.0f ); // Start our client-side effect EntityMessageBegin( this, true ); WRITE_BYTE( 0 ); MessageEnd(); // Begin to stop in two seconds SetThink( &CGrenadeHopwire::EndThink ); SetNextThink( gpGlobals->curtime + 2.0f ); } else { // Remove us immediately SetThink( &CBaseEntity::SUB_Remove ); SetNextThink( gpGlobals->curtime + 0.1f ); } }
//----------------------------------------------------------------------------- // Spawn //----------------------------------------------------------------------------- void CNPC_Eli::Spawn() { // Eli is allowed to use multiple models, because he appears in the pod. // He defaults to his normal model. char *szModel = (char *)STRING( GetModelName() ); if (!szModel || !*szModel) { szModel = "models/eli.mdl"; SetModelName( AllocPooledString(szModel) ); } Precache(); SetModel( szModel ); BaseClass::Spawn(); SetHullType(HULL_HUMAN); SetHullSizeNormal(); // If Eli has a parent, he's currently inside a pod. Prevent him from moving. if ( GetMoveParent() ) { SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_NONE ); CapabilitiesAdd( bits_CAP_ANIMATEDFACE | bits_CAP_TURN_HEAD ); CapabilitiesAdd( bits_CAP_FRIENDLY_DMG_IMMUNE ); } else { SetupWithoutParent(); } AddEFlags( EFL_NO_DISSOLVE | EFL_NO_MEGAPHYSCANNON_RAGDOLL | EFL_NO_PHYSCANNON_INTERACTION ); SetBloodColor( BLOOD_COLOR_RED ); m_iHealth = 8; m_flFieldOfView = 0.5;// indicates the width of this NPC's forward view cone ( as a dotproduct result ) m_NPCState = NPC_STATE_NONE; NPCInit(); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CPointSpotlight::Spawn(void) { Precache(); UTIL_SetSize( this,vec3_origin,vec3_origin ); AddSolidFlags( FSOLID_NOT_SOLID ); SetMoveType( MOVETYPE_NONE ); m_bEfficientSpotlight = true; // Check for user error if (m_flSpotlightMaxLength <= 0) { DevMsg("%s (%s) has an invalid spotlight length <= 0, setting to 500\n", GetClassname(), GetDebugName() ); m_flSpotlightMaxLength = 500; } if (m_flSpotlightGoalWidth <= 0) { DevMsg("%s (%s) has an invalid spotlight width <= 0, setting to 10\n", GetClassname(), GetDebugName() ); m_flSpotlightGoalWidth = 10; } if (m_flSpotlightGoalWidth > MAX_BEAM_WIDTH ) { DevMsg("%s (%s) has an invalid spotlight width %.1f (max %.1f).\n", GetClassname(), GetDebugName(), m_flSpotlightGoalWidth, MAX_BEAM_WIDTH ); m_flSpotlightGoalWidth = MAX_BEAM_WIDTH; } // ------------------------------------ // Init all class vars // ------------------------------------ m_vSpotlightTargetPos = vec3_origin; m_vSpotlightCurrentPos = vec3_origin; m_hSpotlight = NULL; m_hSpotlightTarget = NULL; m_vSpotlightDir = vec3_origin; m_flSpotlightCurLength = m_flSpotlightMaxLength; m_bSpotlightOn = HasSpawnFlags( SF_SPOTLIGHT_START_LIGHT_ON ); SetThink( &CPointSpotlight::SpotlightThink ); SetNextThink( gpGlobals->curtime + 0.1f ); }
void CAirtank::Spawn() { Precache( ); // motor SetMoveType( MOVETYPE_FLY ); SetSolidType( SOLID_BBOX ); SetModel( "models/w_oxygen.mdl"); SetSize( Vector( -16, -16, 0), Vector(16, 16, 36) ); SetAbsOrigin( GetAbsOrigin() ); SetTouch( &CAirtank::TankTouch ); SetThink( &CAirtank::TankThink ); GetFlags() |= FL_MONSTER; SetTakeDamageMode( DAMAGE_YES ); SetHealth( 20 ); SetDamage( 50 ); m_bState = true; }
//------------------------------------------------------------------------------ // Purpose : //------------------------------------------------------------------------------ void CPlayer_Missile::Spawn( void ) { Precache(); SetMoveType( MOVETYPE_FLY ); SetFriction( 0.55 ); // deading the bounce a bit SetGravity(0.0); m_iMaxHealth = m_iHealth; m_iHealth = 0; SetSolid( SOLID_BBOX ); m_fEffects = EF_NODRAW; AddFlag( FL_OBJECT ); // So shows up in NPC Look() SetModel( "models/manhack_sphere.mdl" ); UTIL_SetSize(this, PMISSILE_HULL_MINS, PMISSILE_HULL_MAXS); m_bActive = false; m_vSpawnPos = GetLocalOrigin(); m_vSpawnAng = GetLocalAngles(); }
//------------------------------------------------------------------------------ // Purpose : // Input : // Output : //------------------------------------------------------------------------------ void CNPC_LightStalk::Spawn( void ) { Precache(); SetModel( LIGHTSTALK_MODEL ); SetMoveType( MOVETYPE_NONE ); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_TRIGGER ); UTIL_SetSize( this, Vector(-80,-80,0), Vector(80,80,32)); Relink(); SetActivity( ACT_IDLE ); SetNextThink( gpGlobals->curtime + 0.1f ); m_pGlow = CSprite::SpriteCreate( LIGHTSTALK_GLOW_SPRITE, GetLocalOrigin() + Vector(0,0,(WorldAlignMins().z+WorldAlignMaxs().z)*0.5), false ); m_pGlow->SetTransparency( kRenderGlow, m_clrRender->r, m_clrRender->g, m_clrRender->b, m_clrRender->a, kRenderFxGlowShell ); m_pGlow->SetScale( 1.0 ); m_pGlow->SetAttachment( this, 1 ); LightRise(); }
void CTripwireHook::EndTouch( CBaseEntity *pOther ) { //<<CHECK>>do instead by clearing touch function if (!m_bAttached) { m_bAttached = true; SetVelocity(vec3_origin, vec3_origin); SetMoveType( MOVETYPE_NONE ); EmitSound( "TripwireGrenade.Hook" ); // Let the tripwire grenade know that I've attached CTripwireGrenade* pGrenade = dynamic_cast<CTripwireGrenade*>((CBaseEntity*)m_hGrenade); if (pGrenade) { pGrenade->Attach(); } } }
void CASW_Target_Dummy::Spawn() { BaseClass::Spawn(); //SetModelName( AllocPooledString( ASW_TARGET_DUMMY_MODEL ) ); Precache(); SetModel( ASW_TARGET_DUMMY_MODEL ); SetMoveType( MOVETYPE_NONE ); SetSolid( SOLID_VPHYSICS ); SetCollisionGroup( COLLISION_GROUP_NONE ); //COLLISION_GROUP_DEBRIS ); m_takedamage = DAMAGE_YES; m_iHealth = 100; m_iMaxHealth = m_iHealth; AddFlag( FL_STATICPROP ); VPhysicsInitStatic(); ResetThink(); }
void CCycler::Spawn( ) { InitBoneControllers(); SetSolid( SOLID_BBOX ); if ( m_spawnflags & FCYCLER_NOTSOLID ) { AddSolidFlags( FSOLID_NOT_SOLID ); } else { AddSolidFlags( FSOLID_NOT_STANDABLE ); } SetMoveType( MOVETYPE_NONE ); m_takedamage = DAMAGE_YES; m_iHealth = 80000;// no cycler should die GetMotor()->SetIdealYaw( GetLocalAngles().y ); GetMotor()->SnapYaw(); m_flPlaybackRate = 1.0; m_flGroundSpeed = 0; SetNextThink( gpGlobals->curtime + 1.0f ); ResetSequenceInfo( ); if (GetSequence() != 0 || m_flCycle != 0) { #ifdef TF2_DLL m_animate = 1; #else m_animate = 0; m_flPlaybackRate = 0; #endif } else { m_animate = 1; } }
//========================================================= // Spawn //========================================================= void CNPC_BigMomma::Spawn() { Precache( ); SetModel( "models/big_mom.mdl" ); UTIL_SetSize( this, Vector( -32, -32, 0 ), Vector( 32, 32, 64 ) ); Vector vecSurroundingMins( -95, -95, 0 ); Vector vecSurroundingMaxs( 95, 95, 190 ); CollisionProp()->SetSurroundingBoundsType( USE_SPECIFIED_BOUNDS, &vecSurroundingMins, &vecSurroundingMaxs ); SetNavType( NAV_GROUND ); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_STEP ); m_bloodColor = BLOOD_COLOR_GREEN; m_iHealth = 150 * sk_bigmomma_health_factor.GetFloat(); SetHullType( HULL_WIDE_HUMAN ); SetHullSizeNormal(); CapabilitiesAdd( bits_CAP_MOVE_GROUND ); CapabilitiesAdd( bits_CAP_INNATE_RANGE_ATTACK1 | bits_CAP_INNATE_MELEE_ATTACK1 | bits_CAP_INNATE_MELEE_ATTACK2 ); // pev->view_ofs = Vector ( 0, 0, 128 );// position of the eyes relative to monster's origin. m_flFieldOfView = 0.3;// indicates the width of this monster's forward view cone ( as a dotproduct result ) m_NPCState = NPC_STATE_NONE; SetRenderColor( 255, 255, 255, 255 ); m_bDoneWithPath = false; m_nodeTime = 0.0f; m_iszTarget = m_iszNetName; NPCInit(); BaseClass::Spawn(); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFBaseRocket::Spawn( void ) { // Precache. Precache(); // Client specific. #ifdef CLIENT_DLL m_flSpawnTime = gpGlobals->curtime; BaseClass::Spawn(); // Server specific. #else //Derived classes must have set model. Assert( GetModel() ); SetSolid( SOLID_BBOX ); SetMoveType( MOVETYPE_FLY, MOVECOLLIDE_FLY_CUSTOM ); AddEFlags( EFL_NO_WATER_VELOCITY_CHANGE ); AddEffects( EF_NOSHADOW ); SetCollisionGroup( TFCOLLISION_GROUP_ROCKETS ); UTIL_SetSize( this, -Vector( 0, 0, 0 ), Vector( 0, 0, 0 ) ); // Setup attributes. m_takedamage = DAMAGE_NO; SetGravity( 0.0f ); // Setup the touch and think functions. SetTouch( &CTFBaseRocket::RocketTouch ); SetThink( &CTFBaseRocket::FlyThink ); SetNextThink( gpGlobals->curtime ); // Don't collide with players on the owner's team for the first bit of our life m_flCollideWithTeammatesTime = gpGlobals->curtime + 0.25; m_bCollideWithTeammates = TFGameRules()->IsDeathmatch() ? true : false; #endif }
//----------------------------------------------------------------------------- // Spawn //----------------------------------------------------------------------------- void CNPC_Dog::Spawn( void ) { m_bBoneFollowersActive = true; Precache(); BaseClass::Spawn(); SetModel( "models/dog.mdl" ); SetHullType( HULL_WIDE_HUMAN ); SetHullSizeNormal(); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_STEP ); SetBloodColor( BLOOD_COLOR_MECH ); m_iHealth = 999; m_flFieldOfView = 0.5;// indicates the width of this NPC's forward view cone ( as a dotproduct result ) m_NPCState = NPC_STATE_NONE; m_takedamage = DAMAGE_NO; CapabilitiesAdd( bits_CAP_MOVE_GROUND | bits_CAP_OPEN_DOORS | bits_CAP_TURN_HEAD | bits_CAP_ANIMATEDFACE ); CapabilitiesAdd( bits_CAP_FRIENDLY_DMG_IMMUNE ); NPCInit(); m_iPhysGunAttachment = LookupAttachment( DOG_PHYSGUN_ATTACHMENT_NAME ); m_bDoCatchThrowBehavior = false; m_bDoWaitforObjectBehavior = false; m_bHasObject = false; m_bBeamEffects = true; m_flThrowArcModifier = 1.0f; m_flNextSwat = gpGlobals->curtime; m_flNextRouteTime = gpGlobals->curtime; }