void CASW_Parasite::Spawn( void ) { SetHullType(HULL_TINY); BaseClass::Spawn(); SetModel( SWARM_PARASITE_MODEL); if (FClassnameIs(this, "asw_parasite_defanged")) { m_bDefanged = true; m_iHealth = ASWGameRules()->ModifyAlienHealthBySkillLevel(10); SetBodygroup( 0, 1 ); m_fSuicideTime = gpGlobals->curtime + 60; } else { m_bDefanged = false; m_iHealth = ASWGameRules()->ModifyAlienHealthBySkillLevel(25); SetBodygroup( 0, 0 ); m_fSuicideTime = 0; } SetMoveType( MOVETYPE_STEP ); SetHullType(HULL_TINY); SetCollisionGroup( ASW_COLLISION_GROUP_PARASITE ); SetViewOffset( Vector(6, 0, 11) ) ; // Position of the eyes relative to NPC's origin. m_NPCState = NPC_STATE_NONE; CapabilitiesAdd( bits_CAP_MOVE_GROUND | bits_CAP_INNATE_RANGE_ATTACK1 ); m_bInfesting = false; }
void CZombie::MonsterThink( void ) { pev->nextthink = gpGlobals->time + 0.1; if (m_fNextIgnite && gpGlobals->time >= m_fNextIgnite) { if (m_iIgniteCounter >= 7)//burn for 7 seconds { IgniteEnd(); } else { RealTakeDamage(pev, pev, 10, DMG_GENERIC|DMG_NEVERGIB); m_iIgniteCounter++; m_fNextIgnite = gpGlobals->time + 1; } if (pev->health <= 0) { SetBodygroup(BODYGROUP_HEAD, SUBMDL_HEAD_NO); if (m_iInjuryType & DAMAGE_BLOW_HEAD) SetBodygroup(BODYGROUP_BODY, SUBMDL_BODY_SKELETON_NOSKULL); else SetBodygroup(BODYGROUP_BODY, SUBMDL_BODY_SKELETON); m_iInjuryType |= DAMAGE_DESTROY_FLESH; } } if (!m_fEndfrozen) CBaseMonster::MonsterThink();//Do not run AI else if (gpGlobals->time >= m_fEndfrozen) FrozenEnd(); }
//------------------------------------------------------------------------------ // Purpose : // Input : // Output : //------------------------------------------------------------------------------ void CNPC_MissileDefense::Gib(void) { // Sparks for (int i = 0; i < 4; i++) { Vector sparkPos = GetAbsOrigin(); sparkPos.x += random->RandomFloat(-12,12); sparkPos.y += random->RandomFloat(-12,12); sparkPos.z += random->RandomFloat(-12,12); g_pEffects->Sparks(sparkPos); } // Smoke UTIL_Smoke(GetAbsOrigin(), random->RandomInt(10, 15), 10); // Light CBroadcastRecipientFilter filter; te->DynamicLight( filter, 0.0, &GetAbsOrigin(), 255, 180, 100, 0, 100, 0.1, 0 ); // Remove top parts SetBodygroup( 1, 0 ); SetBodygroup( 2, 0 ); SetBodygroup( 3, 0 ); SetBodygroup( 4, 0 ); m_takedamage = 0; SetThink(NULL); // Throw manhackgibs CGib::SpawnSpecificGibs( this, MD_GIB_COUNT, 300, 500, MD_GIB_MODEL); }
void CHoundeye :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { CSquadMonster :: TraceAttack( pevAttacker, flDamage, vecDir, ptr, bitsDamageType); //demembrage if ( gMultiDamage.pEntity != this ) return; if ( ( pev->health - ( gMultiDamage.amount ) <= 0 ) && IsAlive() && m_iHasGibbed == 0 ) { switch ( ptr->iHitgroup ) { case HITGROUP_RIGHTLEG: SetBodygroup( LEG_R_GROUP, NO_MEMBRE); MakeGib ( 0, pevAttacker ); break; case HITGROUP_LEFTLEG: SetBodygroup( LEG_L_GROUP, NO_MEMBRE); MakeGib ( 0, pevAttacker ); break; case HITGROUP_HEAD: SetBodygroup( EYE_GROUP, NO_MEMBRE); break; case HITGROUP_MIDLEG: SetBodygroup( LEG_M_GROUP, NO_MEMBRE); MakeGib ( 0, pevAttacker ); break; } } }
void CZombie :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { if (!pev->takedamage) return; if (ptr->iHitgroup == HITGROUP_HEAD && !(m_iInjuryType & DAMAGE_BLOW_HEAD) && !m_fEndfrozen) { flDamage *= 2; if (flDamage >= pev->health) { if (m_iInjuryType & DAMAGE_DESTROY_FLESH) { SetBodygroup(BODYGROUP_HEAD, SUBMDL_HEAD_NO); SetBodygroup(BODYGROUP_BODY, SUBMDL_BODY_SKELETON_NOSKULL); } else { SetBodygroup(BODYGROUP_HEAD, SUBMDL_HEAD_BLOWN); } FX_PlrGib( ptr->vecEndPos, GIBBED_HEAD ); pev->health = 0; m_iInjuryType |= DAMAGE_BLOW_HEAD; Killed(pevAttacker, 0); FrozenEnd(); IgniteEnd(); return; } } CBaseMonster::TraceAttack(pevAttacker, flDamage, vecDir, ptr, bitsDamageType); }
//----------------------------------------------------------------------------- // Purpose: // Input : origin - // angles - // event - // *options - //----------------------------------------------------------------------------- void C_BaseObject::FireEvent( const Vector& origin, const QAngle& angles, int event, const char *options ) { switch ( event ) { default: { BaseClass::FireEvent( origin, angles, event, options ); } break; case TF_OBJ_PLAYBUILDSOUND: { EmitSound( options ); } break; case TF_OBJ_ENABLEBODYGROUP: { int index = FindBodygroupByName( options ); if ( index >= 0 ) { SetBodygroup( index, TF_OBJ_BODYGROUPTURNON ); } } break; case TF_OBJ_DISABLEBODYGROUP: { int index = FindBodygroupByName( options ); if ( index >= 0 ) { SetBodygroup( index, TF_OBJ_BODYGROUPTURNOFF ); } } break; case TF_OBJ_ENABLEALLBODYGROUPS: case TF_OBJ_DISABLEALLBODYGROUPS: { // Start at 1, because body 0 is the main .mdl body... // Is this the way we want to do this? int count = GetNumBodyGroups(); for ( int i = 1; i < count; i++ ) { int subpartcount = GetBodygroupCount( i ); if ( subpartcount == 2 ) { SetBodygroup( i, ( event == TF_OBJ_ENABLEALLBODYGROUPS ) ? TF_OBJ_BODYGROUPTURNON : TF_OBJ_BODYGROUPTURNOFF ); } else { DevMsg( "TF_OBJ_ENABLE/DISABLEBODY GROUP: %s has a group with %i subparts, should be exactly 2\n", GetClassname(), subpartcount ); } } } break; } }
//--------------------------------------------------------- // Zombie model //--------------------------------------------------------- void CNPC_Infected::SetZombieModel( void ) { SetModel( "models/infected/common_male01.mdl" ); SetHullType( HULL_HUMAN ); SetBodygroup ( 0, RandomInt (0, 3 ) ); // Head SetBodygroup ( 1, RandomInt (0, 5 ) ); // Upper body SetBodygroup ( 2, RandomInt (0, 3 ) ); // Lower body, changes the number of legs cut off (kaitek666: was commented out. Why?) m_nSkin = random->RandomInt( 0, INFECTED_SKIN_COUNT-1 ); }
void CWeaponPortalgun::Think( void ) { //Allow descended classes a chance to do something before the think function if ( PreThink() ) return; SetNextThink( gpGlobals->curtime + 0.1f ); CPortal_Player *pPlayer = ToPortalPlayer( GetOwner() ); if ( !pPlayer || pPlayer->GetActiveWeapon() != this ) { m_fCanPlacePortal1OnThisSurface = 1.0f; m_fCanPlacePortal2OnThisSurface = 1.0f; return; } // Test portal placement m_fCanPlacePortal1OnThisSurface = ( ( m_bCanFirePortal1 ) ? ( FirePortal( false, 0, 1 ) ) : ( 0.0f ) ); m_fCanPlacePortal2OnThisSurface = ( ( m_bCanFirePortal2 ) ? ( FirePortal( true, 0, 2 ) ) : ( 0.0f ) ); // Draw obtained portal color chips int iSlot1State = ( ( m_bCanFirePortal1 ) ? ( 0 ) : ( 1 ) ); // FIXME: Portal gun might have only red but not blue; int iSlot2State = ( ( m_bCanFirePortal2 ) ? ( 0 ) : ( 1 ) ); SetBodygroup( 1, iSlot1State ); SetBodygroup( 2, iSlot2State ); if ( pPlayer->GetViewModel() ) { pPlayer->GetViewModel()->SetBodygroup( 1, iSlot1State ); pPlayer->GetViewModel()->SetBodygroup( 2, iSlot2State ); } // HACK HACK! Used to make the gun visually change when going through a cleanser! if ( m_fEffectsMaxSize1 > 4.0f ) { m_fEffectsMaxSize1 -= gpGlobals->frametime * 400.0f; if ( m_fEffectsMaxSize1 < 4.0f ) m_fEffectsMaxSize1 = 4.0f; } if ( m_fEffectsMaxSize2 > 4.0f ) { m_fEffectsMaxSize2 -= gpGlobals->frametime * 400.0f; if ( m_fEffectsMaxSize2 < 4.0f ) m_fEffectsMaxSize2 = 4.0f; } }
void CObjectTeleporter::ShowDirectionArrow( bool bShow ) { if ( bShow != m_bShowDirectionArrow ) { if ( m_iDirectionBodygroup >= 0 ) { SetBodygroup( m_iDirectionBodygroup, bShow ? 1 : 0 ); } m_bShowDirectionArrow = bShow; if ( bShow ) { CObjectTeleporter *pMatch = GetMatchingTeleporter(); Assert( pMatch ); Vector vecToOwner = pMatch->GetAbsOrigin() - GetAbsOrigin(); QAngle angleToExit; VectorAngles( vecToOwner, Vector(0,0,1), angleToExit ); angleToExit -= GetAbsAngles(); // pose param is flipped and backwards, adjust. //m_flYawToExit = anglemod( -angleToExit.y + 180.0 ); m_flYawToExit = AngleNormalize( -angleToExit.y + 180.0 ); // For whatever reason the original code normalizes angle 0 to 360 while pose param // takes angle from -180 to 180. I have no idea how did this work properly // in official TF2 all this time. (Nicknine) } } }
void StudioModel::scaleMeshes (float scale) { CStudioHdr *pStudioHdr = GetStudioHdr(); if (!pStudioHdr) return; int i, j, k; // manadatory to access correct verts SetCurrentModel(); // scale verts int tmp = m_bodynum; for (i = 0; i < pStudioHdr->numbodyparts(); i++) { mstudiobodyparts_t *pbodypart = pStudioHdr->pBodypart( i ); for (j = 0; j < pbodypart->nummodels; j++) { SetBodygroup (i, j); SetupModel (i); const mstudio_modelvertexdata_t *vertData = m_pmodel->GetVertexData(); for (k = 0; k < m_pmodel->numvertices; k++) { *vertData->Position(k) *= scale; } } } m_bodynum = tmp; // scale complex hitboxes int hitboxset = g_MDLViewer->GetCurrentHitboxSet(); mstudiobbox_t *pbboxes = pStudioHdr->pHitbox( 0, hitboxset ); for (i = 0; i < pStudioHdr->iHitboxCount( hitboxset ); i++) { VectorScale (pbboxes[i].bbmin, scale, pbboxes[i].bbmin); VectorScale (pbboxes[i].bbmax, scale, pbboxes[i].bbmax); } // scale bounding boxes for (i = 0; i < pStudioHdr->GetNumSeq(); i++) { mstudioseqdesc_t &seqdesc = pStudioHdr->pSeqdesc( i ); Vector tmp; tmp = seqdesc.bbmin; VectorScale( tmp, scale, tmp ); seqdesc.bbmin = tmp; tmp = seqdesc.bbmax; VectorScale( tmp, scale, tmp ); seqdesc.bbmax = tmp; } // maybe scale exeposition, pivots, attachments }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void Dota_Resupply::Spawn( void ) { Precache(); BaseClass::Spawn(); SetModel( STRING( GetModelName() ) ); SetMoveType( MOVETYPE_NONE ); SetSolid( SOLID_VPHYSICS ); CreateVPhysics(); ResetSequence( LookupSequence( "Idle" ) ); SetBodygroup( 1, true ); m_flCloseTime = gpGlobals->curtime; m_flAnimTime = gpGlobals->curtime; m_flPlaybackRate = 0.0; SetCycle( 0 ); m_takedamage = DAMAGE_EVENTS_ONLY; // Issue #28: JMS - 2013-10-12 - ammobox needs to fire a new modevent letting all clients know that one is spawned IGameEvent *pEvent = gameeventmanager->CreateEvent( "ammobox_spawn" ); if ( pEvent ) { pEvent->SetInt( "entindex", entindex() ); gameeventmanager->FireEvent( pEvent ); } }
//----------------------------------------------------------------------------- // Here's where we deal with weapons, ladders, etc. //----------------------------------------------------------------------------- void CVehicleTeleportStation::OnItemPostFrame( CBaseTFPlayer *pDriver ) { // I can't do anything if I'm not active if ( !ShouldBeActive() ) return; if ( GetPassengerRole( pDriver ) != VEHICLE_DRIVER ) return; if ( !IsDeployed() && ( pDriver->m_afButtonPressed & IN_ATTACK ) ) { if ( ValidDeployPosition() ) { Deploy(); } } else if ( IsDeployed() && ( pDriver->m_afButtonPressed & IN_ATTACK ) ) { UnDeploy(); SetControlPanelsActive( false ); SetBodygroup( 1, true ); RemoveCornerSprites(); SetContextThink( NULL, 0, TELEPORT_STATION_THINK_CONTEXT ); } }
//========================================================= // StartMonster //========================================================= void CSquadMonster :: StartMonster( void ) { CBaseMonster :: StartMonster(); if ( ( m_afCapability & bits_CAP_SQUAD ) && !InSquad() ) { if ( !FStringNull( pev->netname ) ) { // if I have a groupname, I can only recruit if I'm flagged as leader if ( !( pev->spawnflags & SF_SQUADMONSTER_LEADER ) ) { return; } } // try to form squads now. int iSquadSize = SquadRecruit( 1024, 4 ); if ( iSquadSize ) { ALERT ( at_aiconsole, "Squad of %d %s formed\n", iSquadSize, STRING( pev->classname ) ); } if ( IsLeader() && FClassnameIs ( pev, "monster_human_grunt" ) ) { SetBodygroup( 1, 1 ); // UNDONE: truly ugly hack pev->skin = 0; } } }
void CObjectTeleporter::ShowDirectionArrow( bool bShow ) { if ( bShow != m_bShowDirectionArrow ) { if ( m_iDirectionBodygroup >= 0 ) { SetBodygroup( m_iDirectionBodygroup, bShow ? 1 : 0 ); } m_bShowDirectionArrow = bShow; if ( bShow ) { CObjectTeleporter *pMatch = GetMatchingTeleporter(); Assert( pMatch ); Vector vecToOwner = pMatch->GetAbsOrigin() - GetAbsOrigin(); QAngle angleToExit; VectorAngles( vecToOwner, Vector(0,0,1), angleToExit ); angleToExit -= GetAbsAngles(); // pose param is flipped and backwards, adjust. m_flYawToExit = anglemod( -angleToExit.y + 180 ); } } }
//========================================================= // Spawn //========================================================= void CNPC_HL1Barney::Spawn() { Precache( ); SetModel( "models/hl1bar.mdl"); SetRenderColor( 255, 255, 255, 255 ); SetHullType(HULL_HUMAN); SetHullSizeNormal(); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_STEP ); m_bloodColor = BLOOD_COLOR_RED; m_iHealth = sk_barneyhl1_health.GetFloat(); SetViewOffset( Vector ( 0, 0, 100 ) );// position of the eyes relative to monster's origin. m_flFieldOfView = VIEW_FIELD_WIDE; // NOTE: we need a wide field of view so npc will notice player and say hello m_NPCState = NPC_STATE_NONE; SetBodygroup( 1, 0 ); m_fGunDrawn = false; CapabilitiesClear(); CapabilitiesAdd( bits_CAP_MOVE_GROUND | bits_CAP_OPEN_DOORS | bits_CAP_AUTO_DOORS | bits_CAP_USE | bits_CAP_DOORS_GROUP); CapabilitiesAdd( bits_CAP_INNATE_RANGE_ATTACK1 | bits_CAP_TURN_HEAD | bits_CAP_ANIMATEDFACE ); NPCInit(); SetUse( &CNPC_HL1Barney::FollowerUse ); }
void CNPC_HL1Barney::Event_Killed( const CTakeDamageInfo &info ) { if ( m_nBody < BARNEY_BODY_GUNGONE ) { // drop the gun! Vector vecGunPos; QAngle angGunAngles; CBaseEntity *pGun = NULL; SetBodygroup( 1, BARNEY_BODY_GUNGONE); GetAttachment( "0", vecGunPos, angGunAngles ); angGunAngles.y += 180; pGun = DropItem( "weapon_glock", vecGunPos, angGunAngles ); } SetUse( NULL ); BaseClass::Event_Killed( info ); if ( UTIL_IsLowViolence() ) { SUB_StartLVFadeOut( 0.0f ); } }
//--------------------------------------------------------- //--------------------------------------------------------- void CZombie::SetZombieModel( void ) { Hull_t lastHull = GetHullType(); if ( m_fIsTorso ) { SetModel( "models/zombie/classic_torso.mdl" ); SetHullType( HULL_TINY ); } else { SetModel( "models/zombie/classic.mdl" ); SetHullType( HULL_HUMAN ); } SetBodygroup( ZOMBIE_BODYGROUP_HEADCRAB, !m_fIsHeadless ); SetHullSizeNormal( true ); SetDefaultEyeOffset(); SetActivity( ACT_IDLE ); // hull changed size, notify vphysics // UNDONE: Solve this generally, systematically so other // NPCs can change size if ( lastHull != GetHullType() ) { if ( VPhysicsGetObject() ) { SetupVPhysicsHull(); } } }
//--------------------------------------------------------- //--------------------------------------------------------- void CRebelZombie::SetZombieModel( void ) { //if ( m_iZombieSex == 1 ) // Male //{ SetModel( "models/zombie/classic.mdl" ); /*} else // Female { SetModel( "models/zombie/classic_female.mdl" ); }*/ SetHullType( HULL_HUMAN ); m_nSkin = m_iRebelZombieSkin; SetBodygroup( ZOMBIE_BODYGROUP_HEADCRAB, !m_fIsHeadless ); SetHullSizeNormal( true ); SetDefaultEyeOffset(); SetActivity( ACT_IDLE ); // hull changed size, notify vphysics // UNDONE: Solve this generally, systematically so other // NPCs can change size if ( VPhysicsGetObject() ) { SetupVPhysicsHull(); } }
//========================================================= // StartMonster //========================================================= void CSquadMonster :: StartMonster( void ) { CBaseMonster :: StartMonster(); if ( ( m_afCapability & bits_CAP_SQUAD ) && !InSquad() ) { if ( HasNetName() ) { // if I have a groupname, I can only recruit if I'm flagged as leader if ( !GetSpawnFlags().Any( SF_SQUADMONSTER_LEADER ) ) { return; } } // try to form squads now. int iSquadSize = SquadRecruit( 1024, 4 ); if ( iSquadSize ) { ALERT ( at_aiconsole, "Squad of %d %s formed\n", iSquadSize, GetClassname() ); } if ( IsLeader() && ClassnameIs( "monster_human_grunt" ) ) { SetBodygroup( 1, 1 ); // UNDONE: truly ugly hack SetSkin( 0 ); } } }
//----------------------------------------------------------------------------- // Purpose: Override so only reload one shell at a time // Input : // Output : //----------------------------------------------------------------------------- bool CWeaponShotgun::StartReload( void ) { if ( m_bNeedPump ) return false; CBaseCombatCharacter *pOwner = GetOwner(); if ( pOwner == NULL ) return false; if (pOwner->GetAmmoCount(m_iPrimaryAmmoType) <= 0) return false; if (m_iClip1 >= GetMaxClip1()) return false; int j = MIN(1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); if (j <= 0) return false; SendWeaponAnim( ACT_SHOTGUN_RELOAD_START ); // Make shotgun shell visible SetBodygroup(1,0); pOwner->m_flNextAttack = gpGlobals->curtime; m_flNextPrimaryAttack = gpGlobals->curtime + SequenceDuration(); m_bInReload = true; return true; }
bool StudioModel::PostLoadModel( const char *modelname ) { MDLCACHE_CRITICAL_SECTION_( g_pMDLCache ); CStudioHdr *pStudioHdr = GetStudioHdr(); if (pStudioHdr == NULL) return false; SetSequence (0); SetController (0, 0.0f); SetController (1, 0.0f); SetController (2, 0.0f); SetController (3, 0.0f); SetBlendTime( DEFAULT_BLEND_TIME ); // SetHeadTurn( 1.0f ); // FIXME:!!! int n; for (n = 0; n < pStudioHdr->numbodyparts(); n++) { SetBodygroup (n, 0); } SetSkin (0); /* Vector mins, maxs; ExtractBbox (mins, maxs); if (mins[2] < 5.0f) m_origin[2] = -mins[2]; */ return true; }
void CNPC_Cremator::Spawn() { Precache(); SetModel( "models/cremator_test2.mdl" ); // a model with a bit of a tesselation (tesselated head and collar) SetHullType(HULL_HUMAN); // отключено, т.к. это новый введенный тип хулла, и вряд ли есть смысл возиться с его введением. //SetHullType( HULL_MEDIUM_TALL ); // данный стандартный тип подходит для большинства ситуаций, однако крематор не сможет проходить в двери, если они ненамного выше его /*that hull type is made special for a cremator since HULL_MEDIUM is not high enough but HULL_LARGE is too big and a cremator cannot fit in Borealis maps with it. The hull type is enumarated in ai_hull.h under the HULL_MEDIUM_TALL and then MUST be enumeraten in Hull_Bits_t, again, UNDER HULL_MEDIUM_TALL with the adress of 0x00000400, so that the definitions in ai_hull.cpp will then find the corresponding hull type.*/ SetHullSizeNormal(); SetBodygroup( 1, 0 ); // the gun SetBodygroup( 2, 0 ); // the head SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_STEP ); m_bloodColor = DONT_BLEED;//BLOOD_COLOR_YELLOW; m_iHealth = sk_cremator_health.GetFloat(); m_flFieldOfView = VIEW_FIELD_WIDE;// indicates the width of this NPC's forward view cone ( as a dotproduct result ) m_NPCState = NPC_STATE_NONE; m_nSkin = CREMATOR_SKIN_ALERT; // original yellow-eyes skin // Если надо спаунить крематора с иным цветом глаз, подставь значение из npc_cremator_h. m_iAmmo = m_iMaxAmmo = 54; NPCInit(); m_flDistTooFar = 6000.0; GetSenses()->SetDistLook( 6000.0 -1 ); m_flNextIdleSoundTime = gpGlobals->curtime; // + random->RandomFloat( 14.0f, 28.0f ); m_flNextRangeAttack2Time = gpGlobals->curtime; // + random->RandomFloat( 10.0f, 20.0f ); m_MuzzleAttachment = LookupAttachment( "muzzle" ); m_HeadAttachment = LookupAttachment( "headattachment" ); CapabilitiesAdd( bits_CAP_MOVE_GROUND | bits_CAP_TURN_HEAD ); CapabilitiesAdd( bits_CAP_INNATE_RANGE_ATTACK1 ); // flamethrower CapabilitiesAdd( bits_CAP_INNATE_RANGE_ATTACK2 ); CapabilitiesAdd( bits_CAP_MOVE_SHOOT ); // TODO: Melee? }
//========================================================= // Spawn //========================================================= void COtis :: Spawn() { Precache( ); SET_MODEL(ENT(pev), "models/otis.mdl"); UTIL_SetSize(pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX); pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_STEP; m_bloodColor = BLOOD_COLOR_RED; if ( !m_fHostile ) pev->health = gSkillData.otisHealth; else pev->health = gSkillData.otisHealth - 10; pev->view_ofs = Vector ( 0, 0, 50 );// position of the eyes relative to monster's origin. m_flFieldOfView = VIEW_FIELD_WIDE; // NOTE: we need a wide field of view so npc will notice player and say hello m_MonsterState = MONSTERSTATE_NONE; if ( !m_fHostile ) { SetBodygroup( OT_GUN_GROUP, OT_GUN_HOLSTER ); m_fGunDrawn = FALSE; } else { SetBodygroup( OT_GUN_GROUP, OT_GUN_DRAWN ); m_fGunDrawn = TRUE; } if ( m_iHead == 0 ) SetBodygroup( OT_HEAD_GROUP, OT_HEAD_NORMAL ); if ( m_iHead == 1 ) SetBodygroup( OT_HEAD_GROUP, OT_HEAD_BALD ); m_afCapability = bits_CAP_HEAR | bits_CAP_TURN_HEAD | bits_CAP_DOORS_GROUP; MonsterInit(); if ( !m_fHostile ) SetUse( &CTalkMonster::FollowerUse ); }
void CNPC_Zombine::SetZombieModel( void ) { SetModel( "models/zombie/zombie_soldier.mdl" ); SetHullType( HULL_HUMAN ); SetBodygroup( ZOMBIE_BODYGROUP_HEADCRAB, !m_fIsHeadless ); SetHullSizeNormal( true ); SetDefaultEyeOffset(); SetActivity( ACT_IDLE ); }
//========================================================= // ********** DeadHGrunt SPAWN ********** //========================================================= void CDeadHGrunt::Spawn( void ) { PRECACHE_MODEL( "models/hgrunt.mdl" ); SetModel( "models/hgrunt.mdl" ); pev->effects = 0; pev->yaw_speed = 8; pev->sequence = 0; m_bloodColor = BLOOD_COLOR_RED; pev->sequence = LookupSequence( m_szPoses[ m_iPose ] ); if( pev->sequence == -1 ) { ALERT( at_console, "Dead hgrunt with bad pose\n" ); } // Corpses have less health pev->health = 8; // map old bodies onto new bodies switch( pev->body ) { case 0: // Grunt with Gun pev->body = 0; pev->skin = 0; SetBodygroup( HEAD_GROUP, HEAD_GRUNT ); SetBodygroup( GUN_GROUP, GUN_MP5 ); break; case 1: // Commander with Gun pev->body = 0; pev->skin = 0; SetBodygroup( HEAD_GROUP, HEAD_COMMANDER ); SetBodygroup( GUN_GROUP, GUN_MP5 ); break; case 2: // Grunt no Gun pev->body = 0; pev->skin = 0; SetBodygroup( HEAD_GROUP, HEAD_GRUNT ); SetBodygroup( GUN_GROUP, GUN_NONE ); break; case 3: // Commander no Gun pev->body = 0; pev->skin = 0; SetBodygroup( HEAD_GROUP, HEAD_COMMANDER ); SetBodygroup( GUN_GROUP, GUN_NONE ); break; } MonsterInitDead(); }
//----------------------------------------------------------------------------- // Purpose: // // //----------------------------------------------------------------------------- void CNPC_Assassin::Spawn( void ) { Precache(); SetModel( "models/fassassin.mdl" ); SetHullType(HULL_HUMAN); SetHullSizeNormal(); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_STEP ); SetBloodColor( BLOOD_COLOR_RED ); m_iHealth = sk_assassin_health.GetFloat(); m_flFieldOfView = 0.1; m_NPCState = NPC_STATE_NONE; CapabilitiesClear(); CapabilitiesAdd( bits_CAP_MOVE_CLIMB | bits_CAP_MOVE_GROUND | bits_CAP_MOVE_JUMP ); CapabilitiesAdd( bits_CAP_SQUAD | bits_CAP_USE_WEAPONS | bits_CAP_AIM_GUN | bits_CAP_INNATE_RANGE_ATTACK1 | bits_CAP_INNATE_RANGE_ATTACK2 | bits_CAP_INNATE_MELEE_ATTACK1 ); //Turn on our guns SetBodygroup( 1, 1 ); int attachment = LookupAttachment( "Eye" ); // Start up the eye glow m_pEyeSprite = CSprite::SpriteCreate( "sprites/redglow1.vmt", GetLocalOrigin(), false ); if ( m_pEyeSprite != NULL ) { m_pEyeSprite->SetAttachment( this, attachment ); m_pEyeSprite->SetTransparency( kRenderTransAdd, 255, 255, 255, 200, kRenderFxNone ); m_pEyeSprite->SetScale( 0.25f ); } // Start up the eye trail m_pEyeTrail = CSpriteTrail::SpriteTrailCreate( "sprites/bluelaser1.vmt", GetLocalOrigin(), false ); if ( m_pEyeTrail != NULL ) { m_pEyeTrail->SetAttachment( this, attachment ); m_pEyeTrail->SetTransparency( kRenderTransAdd, 255, 0, 0, 200, kRenderFxNone ); m_pEyeTrail->SetStartWidth( 8.0f ); m_pEyeTrail->SetLifeTime( 0.75f ); } NPCInit(); m_bEvade = false; m_bAggressive = false; }
//----------------------------------------------------------------------------- // Purpose: // Input : &info - //----------------------------------------------------------------------------- void CNPC_Assassin::Event_Killed( const CTakeDamageInfo &info ) { BaseClass::Event_Killed( info ); // Turn off the eye SetEyeState( ASSASSIN_EYE_DEAD ); // Turn off the pistols SetBodygroup( 1, 0 ); // Spawn her guns }
//----------------------------------------------------------------------------- // Purpose: Override so only reload one shell at a time // Input : // Output : //----------------------------------------------------------------------------- bool CWeapon870AE::StartReload( void ) { CBaseCombatCharacter *pOwner = GetOwner(); if ( pOwner == NULL ) return false; if (m_iItemID == 0) { if (pOwner->GetAmmoCount(m_iPrimaryAmmoType) <= 0) return false; if (m_iClip1 >= GetMaxClip1()) return false; // If shotgun totally emptied then a pump animation is needed //NOTENOTE: This is kinda lame because the player doesn't get strong feedback on when the reload has finished, // without the pump. Technically, it's incorrect, but it's good for feedback... int j = MIN(1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); if (j <= 0) return false; } else { CBasePlayer *pPlayer = ToBasePlayer(GetOwner()); if (pPlayer) { if (pPlayer->Inventory_CountAllObjectContentsOfID(GetPrimaryAmmoID()) <= 0) return false; if (m_iClip1 >= GetMaxClip1()) return false; int j = MIN(1, pPlayer->Inventory_CountAllObjectContentsOfID(GetPrimaryAmmoID())); if (j <= 0) return false; } } SendWeaponAnim( ACT_SHOTGUN_RELOAD_START ); // Make shotgun shell visible SetBodygroup(1,0); pOwner->m_flNextAttack = gpGlobals->curtime; m_flNextPrimaryAttack = gpGlobals->curtime + SequenceDuration(); m_bInReload = true; return true; }
//------------------------------------------------ // Spawn //------------------------------------------------ void CASW_PropJeep::Spawn( void ) { // Setup vehicle as a real-wheels car. SetVehicleType( VEHICLE_TYPE_CAR_WHEELS ); BaseClass::Spawn(); m_flHandbrakeTime = gpGlobals->curtime + 0.1; m_bInitialHandbrake = false; m_flMinimumSpeedToEnterExit = LOCK_SPEED; m_nBulletType = GetAmmoDef()->Index("GaussEnergy"); if ( m_bHasGun ) { SetBodygroup( 1, true ); } else { SetBodygroup( 1, false ); } // Initialize pose parameters SetPoseParameter( JEEP_GUN_YAW, 0 ); SetPoseParameter( JEEP_GUN_PITCH, 0 ); m_nSpinPos = 0; SetPoseParameter( JEEP_GUN_SPIN, m_nSpinPos ); m_aimYaw = 0; m_aimPitch = 0; AddSolidFlags( FSOLID_NOT_STANDABLE ); CAmmoDef *pAmmoDef = GetAmmoDef(); m_nAmmoType = pAmmoDef->Index("GaussEnergy"); // normal HL2 vehicles don't feel nice in a network game // so destroy ourselves and spawn the serverside component of our custom ASW client authorative vehicle system }
//----------------------------------------------------------------------------- // Purpose: Catches the monster-specific messages that occur when tagged // animation frames are played. // Input : *pEvent - //----------------------------------------------------------------------------- void CItem_AmmoCrate::HandleAnimEvent( animevent_t *pEvent ) { if ( pEvent->event == AE_AMMOCRATE_PICKUP_AMMO ) { if ( m_hActivator ) { if ( m_pGiveWeapon[m_nAmmoType] && !m_hActivator->Weapon_OwnsThisType( m_pGiveWeapon[m_nAmmoType] ) ) { CBaseEntity *pEntity = CreateEntityByName( m_pGiveWeapon[m_nAmmoType] ); CBaseCombatWeapon *pWeapon = dynamic_cast<CBaseCombatWeapon*>(pEntity); if ( pWeapon ) { pWeapon->SetAbsOrigin( m_hActivator->GetAbsOrigin() ); pWeapon->m_iPrimaryAmmoType = 0; pWeapon->m_iSecondaryAmmoType = 0; pWeapon->Spawn(); if ( !m_hActivator->BumpWeapon( pWeapon ) ) { UTIL_Remove( pEntity ); } else { SetBodygroup( 1, false ); } } } if ( m_hActivator->GiveAmmo( m_nAmmoAmounts[m_nAmmoType], m_nAmmoIndex ) != 0 ) { SetBodygroup( 1, false ); } m_hActivator = NULL; } return; } BaseClass::HandleAnimEvent( pEvent ); }