//----------------------------------------------------------------------------- // Purpose: // Input : state - //----------------------------------------------------------------------------- // This is ONLY used by the node graph to test movement through a door void CRotDoor::SetToggleState( int state ) { if ( state == TS_AT_TOP ) SetLocalAngles( m_vecAngle2 ); else SetLocalAngles( m_vecAngle1 ); }
void CMomentaryRotButton :: UpdateSelf( float value, bool bPlaySound ) { // set our move clock to 0.1 seconds in the future so we stop spinning unless we are // used again before then. SetMoveDoneTime( 0.1 ); if( m_direction > 0 && value >= 1.0 ) { // if we hit the end, zero our avelocity and snap to the end angles. SetLocalAvelocity( g_vecZero ); SetLocalAngles( m_end ); m_iState = STATE_ON; return; } else if( m_direction < 0 && value <= 0 ) { // if we returned to the start, zero our avelocity and snap to the start angles. SetLocalAvelocity( g_vecZero ); SetLocalAngles( m_start ); m_iState = STATE_OFF; return; } // i'm "in use" player turn me :-) m_iState = STATE_IN_USE; if( bPlaySound ) PlaySound(); SetLocalAvelocity(( m_direction * pev->speed ) * pev->movedir ); SetMoveDone( &CMomentaryRotButton::UseMoveDone ); }
void CRotDoor :: SetToggleState( int state ) { if( (STATE)state == STATE_ON ) SetLocalAngles( m_vecAngle2 ); else SetLocalAngles( m_vecAngle1 ); RelinkEntity( TRUE ); }
// // Sticky gib puts blood on the wall and stays put. // void CGib::StickyGibTouch ( CBaseEntity *pOther ) { Vector vecSpot; trace_t tr; SetThink ( &CGib::SUB_Remove ); SetNextThink( gpGlobals->curtime + 10 ); if ( !FClassnameIs( pOther, "worldspawn" ) ) { SetNextThink( gpGlobals->curtime ); return; } UTIL_TraceLine ( GetAbsOrigin(), GetAbsOrigin() + GetAbsVelocity() * 32, MASK_SOLID_BRUSHONLY, this, COLLISION_GROUP_NONE, &tr); UTIL_BloodDecalTrace( &tr, m_bloodColor ); Vector vecForward = tr.plane.normal * -1; QAngle angles; VectorAngles( vecForward, angles ); SetLocalAngles( angles ); SetAbsVelocity( vec3_origin ); SetLocalAngularVelocity( vec3_angle ); SetMoveType( MOVETYPE_NONE ); }
void CRopeKeyframe::Init() { SetLocalAngles( vec3_angle ); RecalculateLength(); m_nSegments = clamp( m_nSegments, 2, ROPE_MAX_SEGMENTS ); UpdateBBox( true ); m_bStartPointValid = (m_hStartPoint.Get() != NULL); m_bEndPointValid = (m_hEndPoint.Get() != NULL); // Sanity-check the rope texture scale before it goes over the wire if ( m_TextureScale < 0.1f ) { Vector origin = GetAbsOrigin(); GetEndPointPos( 0, origin ); DevMsg( "move_rope has TextureScale less than 0.1 at (%2.2f, %2.2f, %2.2f)\n", origin.x, origin.y, origin.z ); m_TextureScale = 0.1f; } else if ( m_TextureScale > 10.0f ) { Vector origin = GetAbsOrigin(); GetEndPointPos( 0, origin ); DevMsg( "move_rope has TextureScale greater than 10 at (%2.2f, %2.2f, %2.2f)\n", origin.x, origin.y, origin.z ); m_TextureScale = 10.0f; } }
void CGEBloodScreenVM::CalcViewModelView( CBasePlayer *owner, const Vector& eyePosition, const QAngle& eyeAngles ) { #if defined( CLIENT_DLL ) SetLocalOrigin( eyePosition ); SetLocalAngles( eyeAngles ); #endif }
//----------------------------------------------------------------------------- // Purpose: MoveDone function for rotating back to the start position. //----------------------------------------------------------------------------- void CMomentaryRotButton::ReturnMoveDone( void ) { float value = GetPos( GetLocalAngles() ); if ( value <= 0 ) { // // Got back to the start, stop spinning. // SetLocalAngularVelocity( vec3_angle ); SetLocalAngles( m_start ); UpdateTarget( 0, NULL ); SetMoveDoneTime( -1 ); SetMoveDone( NULL ); SetNextThink( TICK_NEVER_THINK ); SetThink( NULL ); } else { SetLocalAngularVelocity( -m_returnSpeed * m_vecMoveAng ); SetMoveDoneTime( 0.1f ); SetThink( &CMomentaryRotButton::UpdateThink ); SetNextThink( gpGlobals->curtime + 0.01f ); } }
//------------------------------------------------------------------------------ // Purpose: MoveDone function for the SetPosition input handler. Tracks our // progress toward a movement goal and updates our outputs. //------------------------------------------------------------------------------ void CMomentaryRotButton::SetPositionMoveDone(void) { float flCurPos = GetPos( GetLocalAngles() ); if ((( flCurPos >= m_IdealYaw ) && ( m_direction == 1 )) || (( flCurPos <= m_IdealYaw ) && ( m_direction == -1 ))) { // // We reached or surpassed our movement goal. // SetLocalAngularVelocity( vec3_angle ); // BUGBUG: Won't this get the player stuck? SetLocalAngles( m_start + m_vecMoveAng * ( m_IdealYaw * m_flMoveDistance ) ); SetNextThink( TICK_NEVER_THINK ); SetMoveDoneTime( -1 ); UpdateTarget( m_IdealYaw, this ); OutputMovementComplete(); return; } // TODO: change this to use a Think function like ReturnThink. QAngle vecNewAngles = m_start + m_vecMoveAng * ( m_IdealYaw * m_flMoveDistance ); float flAngleDelta = fabs( AxisDelta( m_spawnflags, vecNewAngles, GetLocalAngles() )); float dt = flAngleDelta / m_flSpeed; if ( dt < TICK_INTERVAL ) { dt = TICK_INTERVAL; float speed = flAngleDelta / TICK_INTERVAL; SetLocalAngularVelocity( speed * m_vecMoveAng * m_direction ); } dt = clamp( dt, TICK_INTERVAL, TICK_INTERVAL * 6); SetMoveDoneTime( dt ); }
void CBaseGrenadeContact::Spawn( void ) { // point sized, solid, bouncing SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE ); SetSolid( SOLID_BBOX ); SetCollisionGroup( COLLISION_GROUP_PROJECTILE ); SetModel( "models/weapons/w_grenade.mdl" ); // BUG: wrong model UTIL_SetSize(this, vec3_origin, vec3_origin); // contact grenades arc lower SetGravity( UTIL_ScaleForGravity( 400 ) ); // use a lower gravity for grenades to make them easier to see QAngle angles; VectorAngles(GetAbsVelocity(), angles); SetLocalAngles( angles ); // make NPCs afaid of it while in the air SetThink( &CBaseGrenadeContact::DangerSoundThink ); SetNextThink( gpGlobals->curtime ); // Tumble in air QAngle vecAngVelocity( random->RandomFloat ( -100, -500 ), 0, 0 ); SetLocalAngularVelocity( vecAngVelocity ); // Explode on contact SetTouch( &CBaseGrenadeContact::ExplodeTouch ); m_flDamage = 100; // BOXBOX was sk_plr_dmg_grenade.GetFloat(); // Allow player to blow this puppy up in the air m_takedamage = DAMAGE_YES; m_iszBounceSound = NULL_STRING; }
void CShower::Spawn( void ) { Vector vecForward; AngleVectors( GetLocalAngles(), &vecForward ); Vector vecNewVelocity; vecNewVelocity = random->RandomFloat( 200, 300 ) * vecForward; vecNewVelocity.x += random->RandomFloat(-100.f,100.f); vecNewVelocity.y += random->RandomFloat(-100.f,100.f); if ( vecNewVelocity.z >= 0 ) vecNewVelocity.z += 200; else vecNewVelocity.z -= 200; SetAbsVelocity( vecNewVelocity ); SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE ); SetGravity( UTIL_ScaleForGravity( 400 ) ); // fall a bit more slowly than normal SetNextThink( gpGlobals->curtime + 0.1f ); SetSolid( SOLID_NONE ); UTIL_SetSize(this, vec3_origin, vec3_origin ); AddEffects( EF_NODRAW ); m_flSpeed = random->RandomFloat( 0.5, 1.5 ); SetLocalAngles( vec3_angle ); }
void CFuncClock :: Think( void ) { float seconds, ang, pos; seconds = gpGlobals->time + m_flCurTime; pos = seconds / m_iClockType; pos = pos - floor( pos ); ang = 360 * pos; SetLocalAngles( pev->movedir * ang ); if( m_iClockType == SECODNS_PER_DAY ) { int hours = GetLocalAngles().Length() / 30; if( m_iHoursCount != hours ) { // member new hour m_iHoursCount = hours; if( hours == 0 ) hours = 12; // merge for 0.00.00 // send hours info UTIL_FireTargets( pev->netname, this, this, USE_SET, hours ); UTIL_FireTargets( pev->netname, this, this, USE_ON ); } } RelinkEntity( FALSE ); // set clock resolution SetNextThink( 1.0f ); }
void CRotDoor :: OnChangeParent( void ) { matrix4x4 iparent = GetParentToWorldTransform().Invert(); matrix4x4 angle1 = iparent.ConcatTransforms( matrix4x4( g_vecZero, m_vecAngle1 )); angle1.GetAngles( m_vecAngle1 ); // just recalc angle2 without transforms m_vecAngle2 = m_vecAngle1 + pev->movedir * m_flMoveDistance; // update angles if needed if( GetState() == STATE_ON ) SetLocalAngles( m_vecAngle2 ); else if( GetState() == STATE_OFF ) SetLocalAngles( m_vecAngle1 ); }
//----------------------------------------------------------------------------- // Purpose: Turns a npc towards its ideal yaw. // Input : yawSpeed - Yaw speed in degrees per 1/10th of a second. // flInterval - Time interval to turn, -1 uses time since last think. // Output : Returns the number of degrees turned. //----------------------------------------------------------------------------- void CAI_Motor::UpdateYaw( int yawSpeed ) { // Don't do this if our yaw is locked if ( IsYawLocked() ) return; GetOuter()->SetUpdatedYaw(); float ideal, current, newYaw; if ( yawSpeed == -1 ) yawSpeed = GetYawSpeed(); // NOTE: GetIdealYaw() will never exactly be reached because UTIL_AngleMod // also truncates the angle to 16 bits of resolution. So lets truncate it here. current = UTIL_AngleMod( GetLocalAngles().y ); ideal = UTIL_AngleMod( GetIdealYaw() ); // FIXME: this needs a proper interval float dt = MIN( 0.2, gpGlobals->curtime - GetLastThink() ); newYaw = AI_ClampYaw( (float)yawSpeed * 10.0, current, ideal, dt ); if (newYaw != current) { QAngle angles = GetLocalAngles(); angles.y = newYaw; SetLocalAngles( angles ); } }
void CBaseTrainDoor :: Spawn( void ) { Precache(); pev->movetype = MOVETYPE_PUSH; pev->solid = SOLID_BSP; SET_MODEL( edict(), GetModel( )); // is mapper forget set angles? if( pev->movedir == g_vecZero ) { pev->movedir = Vector( 1, 0, 0 ); SetLocalAngles( g_vecZero ); } // save initial angles m_vecOldAngles = GetLocalAngles(); // ??? m_vecPosition1 = GetLocalOrigin(); // member the initial position if( !pev->speed ) pev->speed = 100; m_pUserData = WorldPhysic->CreateKinematicBodyFromEntity( this ); door_state = TD_CLOSED; SetTouch( NULL ); SetThink( &CBaseTrainDoor :: FindTrain ); SetNextThink( 0.1 ); }
//----------------------------------------------------------------------------- // Purpose: Try and turn towards the target point //----------------------------------------------------------------------------- void CGrenadeRocket::FollowThink( void ) { if ( m_hLockTarget == NULL ) return; // Weave slightly drunkenly to target Vector vecTarget = m_hLockTarget->GetAbsOrigin() - GetLocalOrigin(); VectorNormalize( vecTarget ); QAngle angles; VectorAngles( vecTarget, angles ); SetLocalAngles( angles ); Vector vecVelocity = GetAbsVelocity(); float flSpeed = vecVelocity.Length(); vecVelocity = vecVelocity * 0.2 + vecTarget * flSpeed * 1.2; // Clip to maxspeed if ( vecVelocity.Length() > ROCKET_VELOCITY ) { VectorNormalize( vecVelocity ); vecVelocity *= ROCKET_VELOCITY; } SetAbsVelocity( vecVelocity ); SetNextThink( gpGlobals->curtime + 0.1f ); }
//----------------------------------------------------------------------------- // Purpose: Attaches the flame to an entity and moves with it // Input : pTarget - target entity to attach to //----------------------------------------------------------------------------- void CEntityDissolve::AttachToEntity( CBaseEntity *pTarget ) { // So our dissolver follows the entity around on the server. SetParent( pTarget ); SetLocalOrigin( vec3_origin ); SetLocalAngles( vec3_angle ); }
//----------------------------------------------------------------------------- // Purpose: Hack to zero out player's pitch, use value from poseparameter instead // Input : flags - // Output : int //----------------------------------------------------------------------------- int C_BaseHLPlayer::DrawModel( int flags ) { // Not pitch for player QAngle saveAngles = GetLocalAngles(); QAngle useAngles = saveAngles; useAngles[ PITCH ] = 0.0f; SetLocalAngles( useAngles ); int iret = BaseClass::DrawModel( flags ); SetLocalAngles( saveAngles ); return iret; }
void C_MSS_Player::PreThink( void ) { QAngle vTempAngles = GetLocalAngles(); if ( GetLocalPlayer() == this ) { vTempAngles[PITCH] = EyeAngles()[PITCH]; } else { vTempAngles[PITCH] = m_angEyeAngles[PITCH]; } if ( vTempAngles[YAW] < 0.0f ) { vTempAngles[YAW] += 360.0f; } SetLocalAngles( vTempAngles ); BaseClass::PreThink(); HandleSpeedChanges(); if ( m_HL2Local.m_flSuitPower <= 0.0f ) { if( IsSprinting() ) { StopSprinting(); } } }
void CFuncIllusionary::Spawn( void ) { SetLocalAngles( vec3_angle ); SetMoveType( MOVETYPE_NONE ); SetSolid( SOLID_NONE ); SetModel( STRING( GetModelName() ) ); }
void CMomentaryRotButton :: ReturnMoveDone( void ) { float value = GetPos( GetLocalAngles() ); SetUse( &CMomentaryRotButton::ButtonUse ); if( value <= 0 ) { // Got back to the start, stop spinning. SetLocalAvelocity( g_vecZero ); SetLocalAngles( m_start ); m_iState = STATE_OFF; UpdateTarget( 0 ); SetMoveDoneTime( -1 ); SetMoveDone( NULL ); SetNextThink( -1 ); SetThink( NULL ); } else { m_iState = STATE_TURN_OFF; SetLocalAvelocity( -m_returnSpeed * pev->movedir ); SetMoveDoneTime( 0.1f ); SetThink( &CMomentaryRotButton::UpdateThink ); SetNextThink( 0.01f ); } }
//----------------------------------------------------------------------------- // Purpose: Think function. Called while rotating at a constant angular velocity. //----------------------------------------------------------------------------- void CFuncRotating::RotateMove( void ) { SetMoveDoneTime( 10 ); if ( m_bStopAtStartPos ) { SetMoveDoneTime( GetNextMoveInterval() ); int checkAxis = 2; // See if we got close to the starting orientation if ( m_vecMoveAng[0] != 0 ) { checkAxis = 0; } else if ( m_vecMoveAng[1] != 0 ) { checkAxis = 1; } float angDelta = anglemod( GetLocalAngles()[ checkAxis ] - m_angStart[ checkAxis ] ); if ( angDelta > 180.0f ) angDelta -= 360.0f; QAngle avel = GetLocalAngularVelocity(); // Delta per tick QAngle avelpertick = avel * TICK_INTERVAL; if ( fabs( angDelta ) < fabs( avelpertick[ checkAxis ] ) ) { SetTargetSpeed( 0 ); SetLocalAngles( m_angStart ); m_bStopAtStartPos = false; } } }
void CInfoIntermission::Spawn( void ) { SetSolid( SOLID_NONE ); AddEffects( EF_NODRAW ); SetLocalAngles( vec3_angle ); SetNextThink( gpGlobals->curtime + 2 );// let targets spawn ! }
//----------------------------------------------------------------------------- // Step iteratively toward a destination position //----------------------------------------------------------------------------- AIMotorMoveResult_t CAI_Motor::MoveGroundStep( const Vector &newPos, CBaseEntity *pMoveTarget, float yaw, bool bAsFarAsCan, AIMoveTrace_t *pTraceResult ) { // By definition, this will produce different results than GroundMoveLimit() // because there's no guarantee that it will step exactly one step // See how far toward the new position we can step... // But don't actually test for ground geometric validity; // if it isn't valid, there's not much we can do about it AIMoveTrace_t moveTrace; GetMoveProbe()->TestGroundMove( GetLocalOrigin(), newPos, MASK_NPCSOLID, AITGM_IGNORE_FLOOR, &moveTrace ); if ( pTraceResult ) { *pTraceResult = moveTrace; } bool bHitTarget = (moveTrace.pObstruction && (pMoveTarget == moveTrace.pObstruction )); // Move forward either if there was no obstruction or if we're told to // move as far as we can, regardless bool bIsBlocked = IsMoveBlocked(moveTrace.fStatus); if ( !bIsBlocked || bAsFarAsCan || bHitTarget ) { // The true argument here causes it to touch all triggers // in the volume swept from the previous position to the current position UTIL_SetOrigin(GetOuter(), moveTrace.vEndPosition, true); // skip tiny steps, but notify the shadow object of any large steps if ( moveTrace.flStepUpDistance > 0.1f ) { float height = clamp( moveTrace.flStepUpDistance, 0, StepHeight() ); IPhysicsObject *pPhysicsObject = GetOuter()->VPhysicsGetObject(); if ( pPhysicsObject ) { IPhysicsShadowController *pShadow = pPhysicsObject->GetShadowController(); if ( pShadow ) { pShadow->StepUp( height ); } } } if ( yaw != -1 ) { QAngle angles = GetLocalAngles(); angles.y = yaw; SetLocalAngles( angles ); } if ( bHitTarget ) return AIM_PARTIAL_HIT_TARGET; if ( !bIsBlocked ) return AIM_SUCCESS; if ( moveTrace.fStatus == AIMR_BLOCKED_NPC ) return AIM_PARTIAL_HIT_NPC; return AIM_PARTIAL_HIT_WORLD; } return AIM_FAILED; }
void CHL2MP_Player::PostThink( void ) { BaseClass::PostThink(); if ( GetFlags() & FL_DUCKING ) { SetCollisionBounds( VEC_CROUCH_TRACE_MIN, VEC_CROUCH_TRACE_MAX ); } m_PlayerAnimState.Update(); // Store the eye angles pitch so the client can compute its animation state correctly. m_angEyeAngles = EyeAngles(); QAngle angles = GetLocalAngles(); angles[PITCH] = 0; SetLocalAngles( angles ); if (!IsDead()) { if (m_afButtonReleased & IN_KICK && m_flNextKickAttack < gpGlobals->curtime /* && m_flNextKickAttack < gpGlobals->curtime && !m_bIsKicking*/) { KickAttack(); m_bIsKicking = true; } } CBaseCombatWeapon *pWeapon = this->GetActiveWeapon(); if (pWeapon != NULL) { if (m_afButtonPressed & IN_IRONSIGHT) { pWeapon->EnableIronsights(); } else if (m_afButtonReleased & IN_IRONSIGHT) { pWeapon->DisableIronsights(); } } if (!IsDead()) { if (m_flNextKickAttack < gpGlobals->curtime) { m_bIsKicking = false; CBaseViewModel *vm = GetViewModel(1); if (vm) { int idealSequence = vm->SelectWeightedSequence(ACT_VM_IDLE); if (idealSequence >= 0) { vm->SendViewModelMatchingSequence(idealSequence); } } } } }
void CPendulum :: Stop( void ) { SetLocalAngles( m_start ); pev->speed = 0; // dead stop SetThink( NULL ); SetLocalAvelocity( g_vecZero ); m_iState = STATE_OFF; }
void CBaseViewModel::CalcViewModelView( CBasePlayer *owner, const Vector& eyePosition, const QAngle& eyeAngles ) { // UNDONE: Calc this on the server? Disabled for now as it seems unnecessary to have this info on the server #if defined( CLIENT_DLL ) QAngle vmangoriginal = eyeAngles; QAngle vmangles = eyeAngles; Vector vmorigin = eyePosition; Vector vecRight; Vector vecUp; Vector vecForward; AngleVectors( vmangoriginal, &vecForward, &vecRight, &vecUp ); //Vector vecOffset = Vector( viewmodel_offset_x.GetFloat(), viewmodel_offset_y.GetFloat(), viewmodel_offset_z.GetFloat() ); vmorigin += (vecForward * viewmodel_offset_y.GetFloat()) + (vecUp * viewmodel_offset_z.GetFloat()) + (vecRight * viewmodel_offset_x.GetFloat()); // TrackIR if ( IsHeadTrackingEnabled() ) { vmorigin = owner->EyePosition(); VectorAngles( owner->GetAutoaimVector( AUTOAIM_5DEGREES ), vmangoriginal ); vmangles = vmangoriginal; } // TrackIR CBaseCombatWeapon *pWeapon = m_hWeapon.Get(); //Allow weapon lagging if ( pWeapon != NULL ) { #if defined( CLIENT_DLL ) if ( !prediction->InPrediction() ) #endif { // add weapon-specific bob pWeapon->AddViewmodelBob( this, vmorigin, vmangles ); } } // Add model-specific bob even if no weapon associated (for head bob for off hand models) AddViewModelBob( owner, vmorigin, vmangles ); // Add lag CalcViewModelLag( vmorigin, vmangles, vmangoriginal ); #if defined( CLIENT_DLL ) if ( !prediction->InPrediction() ) { // Let the viewmodel shake at about 10% of the amplitude of the player's view ACTIVE_SPLITSCREEN_PLAYER_GUARD_ENT( GetOwner() ); GetViewEffects()->ApplyShake( vmorigin, vmangles, 0.1 ); } #endif CalcIronsights( vmorigin, vmangles ); SetLocalOrigin( vmorigin ); SetLocalAngles( vmangles ); #endif }
//----------------------------------------------------------------------------- // Purpose: Breaks the breakable if it can be broken. // Input : pBreaker - The entity that caused us to break, either via an input, // by shooting us, or by touching us. //----------------------------------------------------------------------------- void CBreakable::Break( CBaseEntity *pBreaker ) { if ( IsBreakable() ) { QAngle angles = GetLocalAngles(); angles.y = m_angle; SetLocalAngles( angles ); m_hBreaker = pBreaker; Die(); } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CBreakable::Spawn( void ) { // Initialize damage modifiers. Must be done before baseclass spawn. m_flDmgModBullet = func_breakdmg_bullet.GetFloat(); m_flDmgModClub = func_breakdmg_club.GetFloat(); m_flDmgModExplosive = func_breakdmg_explosive.GetFloat(); ParsePropData(); Precache( ); if ( !m_iHealth || FBitSet( m_spawnflags, SF_BREAK_TRIGGER_ONLY ) ) { // This allows people to shoot at the glass (since it's penetrable) if ( m_Material == matGlass ) { m_iHealth = 1; } m_takedamage = DAMAGE_NO; } else { m_takedamage = DAMAGE_YES; } m_iMaxHealth = ( m_iHealth > 0 ) ? m_iHealth : 1; SetSolid( SOLID_BSP ); SetMoveType( MOVETYPE_PUSH ); // this is a hack to shoot the gibs in a specific yaw/direction m_angle = GetLocalAngles().y; SetLocalAngles( vec3_angle ); SetModel( STRING( GetModelName() ) );//set size and link into world. SetTouch( &CBreakable::BreakTouch ); if ( FBitSet( m_spawnflags, SF_BREAK_TRIGGER_ONLY ) ) // Only break on trigger { SetTouch( NULL ); } // Flag unbreakable glass as "worldbrush" so it will block ALL tracelines if ( !IsBreakable() && m_nRenderMode != kRenderNormal ) AddFlag( FL_WORLDBRUSH ); if ( m_impactEnergyScale == 0 ) { m_impactEnergyScale = 1.0; } CreateVPhysics(); }
void CASW_Parasite::InfestColonist(CASW_Colonist* pColonist) { if (m_bDefanged || !pColonist) // no infesting if we've been defanged return; if (!IsOnFire()) // don't actually infest if we're on fire, since we'll die very shortly pColonist->BecomeInfested(this); // attach int attachment = pColonist->LookupAttachment( "chest" ); if ( attachment ) { //SetAbsAngles( GetOwnerEntity()->GetAbsAngles() ); SetSolid( SOLID_NONE ); SetMoveType( MOVETYPE_NONE ); QAngle current(0,0,0); Vector diff = pColonist->GetAbsOrigin() - GetAbsOrigin(); float angle = UTIL_VecToYaw(diff); angle -= pColonist->GetAbsAngles()[YAW]; // get the diff between our angle from the marine and the marine's facing; current = GetAbsAngles(); SetParent( pColonist, attachment ); Vector vecPosition; float fRaise = random->RandomFloat(0,20); SetLocalOrigin( Vector( -fRaise * 0.2f, 0, fRaise ) ); SetLocalAngles( QAngle( 0, angle + asw_infest_angle.GetFloat(), 0 ) ); // play our infesting anim if ( asw_parasite_inside.GetBool() ) { SetActivity(ACT_RANGE_ATTACK2); } else { int iInfestAttack = LookupSequence("Infest_attack"); if (GetSequence() != iInfestAttack) { ResetSequence(iInfestAttack); } } // don't do anymore thinking - need to think still to animate? AddFlag( FL_NOTARGET ); SetThink( &CASW_Parasite::InfestThink ); SetTouch( NULL ); m_bInfesting = true; } else { FinishedInfesting(); } }
void CFuncWall::Spawn( void ) { SetLocalAngles( vec3_angle ); SetMoveType( MOVETYPE_PUSH ); // so it doesn't get pushed by anything SetModel( STRING( GetModelName() ) ); // If it can't move/go away, it's really part of the world AddFlag( FL_WORLDBRUSH ); // set manual mode CreateVPhysics(); }