diff --git a/reactivedrop/fgd/reactivedrop.fgd b/reactivedrop/fgd/reactivedrop.fgd index c374d7e3e..87c77ff61 100644 --- a/reactivedrop/fgd/reactivedrop.fgd +++ b/reactivedrop/fgd/reactivedrop.fgd @@ -914,3 +914,22 @@ asw_pickup_50calmg : "50cal Machine Gun" input TurnOff(void) input Toggle(void) ] + +@PointClass base(Targetname, Parentname, Angles) studio("models/sentry_gun/sentry_base.mdl") = asw_sentry_base : "Pre-built IAF sentry" +[ + GunType(choices) : "Gun type" : 0 = + [ + 0 : "Machine Gun" + 1 : "Grenade Launcher" + 2 : "Flamer" + 3 : "Cryo Cannon" + 4 : "Railgun" + ] + IsAssembled(choices) : "Fully assembled" : 0 = + [ + 0 : "No" + 1 : "Yes" + ] + AssembleProgress(float) : "Assembly progress" : "0.0" : "Number between 0 (just placed) and 1 (almost fully assembled). Ignored if fully assembled." + Ammo(integer) : "Ammo" : "-1" : "Remaining ammo in gun. -1 = full (automatically changed to the gun type's max ammo). Max ammo for each type: machine gun = 450, grenade launcher = 40, flamer = 1200, cryo cannon = 800, railgun = 300" +] diff --git a/src/game/server/swarm/asw_sentry_base.cpp b/src/game/server/swarm/asw_sentry_base.cpp index 44da3c428..a36ec2188 100644 --- a/src/game/server/swarm/asw_sentry_base.cpp +++ b/src/game/server/swarm/asw_sentry_base.cpp @@ -17,11 +17,9 @@ #include "tier0/memdbgon.h" #define SENTRY_BASE_MODEL "models/sentry_gun/sentry_base.mdl" -//#define SENTRY_BASE_MODEL "models/swarm/droneprops/DronePropIdle.mdl" extern int g_sModelIndexFireball; // (in combatweapon.cpp) holds the index for the smoke cloud - ConVar asw_sentry_gun_type("asw_sentry_gun_type", "-1", FCVAR_CHEAT, "Force the type of sentry guns built to this. -1, the default, reads from the marine attributes."); ConVar asw_sentry_infinite_ammo( "asw_sentry_infinite_ammo", "0", FCVAR_CHEAT ); ConVar asw_sentry_health_base( "asw_sentry_health_base", "300", FCVAR_CHEAT ); @@ -53,12 +51,14 @@ END_SEND_TABLE() BEGIN_DATADESC( CASW_Sentry_Base ) DEFINE_THINKFUNC( AnimThink ), DEFINE_FIELD( m_hSentryTop, FIELD_EHANDLE ), - DEFINE_FIELD( m_bAssembled, FIELD_BOOLEAN ), + DEFINE_KEYFIELD( m_bAssembled, FIELD_BOOLEAN, "IsAssembled" ), DEFINE_FIELD( m_bIsInUse, FIELD_BOOLEAN ), - DEFINE_FIELD( m_fAssembleProgress, FIELD_FLOAT ), + DEFINE_KEYFIELD( m_fAssembleProgress, FIELD_FLOAT, "AssembleProgress" ), DEFINE_FIELD( m_fAssembleCompleteTime, FIELD_TIME ), DEFINE_FIELD( m_hDeployer, FIELD_EHANDLE ), DEFINE_FIELD( m_hLastDisassembler, FIELD_EHANDLE ), + DEFINE_KEYFIELD( m_iAmmo, FIELD_INTEGER, "Ammo" ), + DEFINE_KEYFIELD( m_nGunType, FIELD_INTEGER, "GunType" ), END_DATADESC() BEGIN_ENT_SCRIPTDESC( CASW_Sentry_Base, CBaseAnimating, "sentry" ) @@ -156,6 +156,24 @@ void CASW_Sentry_Base::Spawn( void ) { m_iAmmo = m_iMaxAmmo; } + + // mapper-placed sentries + SetGunType( m_nGunType ); // set skin + if ( m_bAssembled ) + { + Assert( !m_hSentryTop ); + m_fAssembleProgress = 1.0f; + m_fAssembleCompleteTime = gpGlobals->curtime; + + CASW_Sentry_Top *pSentryTop = dynamic_cast< CASW_Sentry_Top * >( CreateEntityByName( GetEntityNameForGunType( GetGunType() ) ) ); + m_hSentryTop = pSentryTop; + if ( pSentryTop ) + { + pSentryTop->SetSentryBase( this ); + pSentryTop->SetAbsAngles( GetAbsAngles() ); + DispatchSpawn( pSentryTop ); + } + } } void CASW_Sentry_Base::PlayDeploySound() @@ -328,30 +346,6 @@ void CASW_Sentry_Base::NPCStartedUsing( CASW_Inhabitable_NPC *pNPC ) { EmitSound( "ASW_Sentry.SetupLoop" ); - if ( GetModelPtr() && GetModelPtr()->numskinfamilies() >= kGUNTYPE_MAX + 2 ) // modeller guy says 2 first textures are a must - { - switch ( GetGunType() ) - { - case kAUTOGUN: - this->m_nSkin = 2; - break; - case kCANNON: - this->m_nSkin = 5; - break; - case kFLAME: - this->m_nSkin = 4; - break; - case kICE: - this->m_nSkin = 3; - break; -#ifdef RD_7A_WEAPONS - case kRAILGUN: - this->m_nSkin = 6; - break; -#endif - } - } - if ( !m_bIsInUse && m_fAssembleProgress < 1.0f ) { IGameEvent *event = gameeventmanager->CreateEvent( "sentry_start_building" ); diff --git a/src/game/server/swarm/asw_sentry_base.h b/src/game/server/swarm/asw_sentry_base.h index 267471758..5f8f03240 100644 --- a/src/game/server/swarm/asw_sentry_base.h +++ b/src/game/server/swarm/asw_sentry_base.h @@ -115,6 +115,30 @@ inline void CASW_Sentry_Base::SetGunType( int iType ) inline void CASW_Sentry_Base::SetGunType( GunType_t iType ) { m_nGunType = iType; + + if ( GetModelPtr() && GetModelPtr()->numskinfamilies() >= kGUNTYPE_MAX + 2 ) // modeller guy says 2 first textures are a must + { + switch ( GetGunType() ) + { + case kAUTOGUN: + m_nSkin = 2; + break; + case kCANNON: + m_nSkin = 5; + break; + case kFLAME: + m_nSkin = 4; + break; + case kICE: + m_nSkin = 3; + break; +#ifdef RD_7A_WEAPONS + case kRAILGUN: + m_nSkin = 6; + break; +#endif + } + } } #endif /* ASW_SENTRY_BASE_H */ \ No newline at end of file