Skip to content

Commit

Permalink
TC79 Energy Field Generator tweaks in response to feedback
Browse files Browse the repository at this point in the history
- Fixed missing reload sound.
- Increased shield damage (doubled).
- Shield no longer damages friendly targets.
- Can now drop the gun, which kills the shield.
- Can now holster the gun, which pauses the shield.
  • Loading branch information
BenLubar committed Jun 15, 2024
1 parent 8f8af28 commit 898ecf8
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 30 deletions.
27 changes: 27 additions & 0 deletions reactivedrop/scripts/game_sounds_asw_weapons.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1866,3 +1866,30 @@
"wave" "weapons/3D/shieldrifle/shield_dmg2.wav"
}
}

"ASW_Weapon_Energy_Shield.ReloadA"
{
"channel" "CHAN_ITEM"
"volume" "1.0"
"soundlevel" "SNDLVL_NORM"

"wave" "weapons/3D/reloads/shieldrifle_A.wav"
}

"ASW_Weapon_Energy_Shield.ReloadB"
{
"channel" "CHAN_ITEM"
"volume" "1.0"
"soundlevel" "SNDLVL_NORM"

"wave" "weapons/3D/reloads/shieldrifle_B.wav"
}

"ASW_Weapon_Energy_Shield.ReloadC"
{
"channel" "CHAN_ITEM"
"volume" "1.0"
"soundlevel" "SNDLVL_NORM"

"wave" "weapons/3D/reloads/shieldrifle_C.wav"
}
2 changes: 1 addition & 1 deletion src/game/client/swarm/c_asw_fx_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ void CRD_ShieldFalloff_Proxy::OnBind( void *pRenderable )
float flSinceLastShot = pGun ? gpGlobals->curtime - pGun->m_fLastMuzzleFlashTime : FLT_MAX;
float flTimeRemaining = pShield->m_flExpireTime - gpGlobals->curtime;
C_ASW_Marine *pMarine = pShield->m_hCreatorMarine;
if ( pMarine && pMarine->GetCurrentMeleeAttack() )
if ( pMarine && ( pMarine->GetCurrentMeleeAttack() || pMarine->GetActiveASWWeapon() != pGun ) )
{
SetFloatResult( -1.0f );
return;
Expand Down
4 changes: 2 additions & 2 deletions src/game/shared/swarm/asw_marine_skills.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ ConVar asw_skill_engineering_sentry_base( "asw_skill_engineering_sentry_base", "
ConVar asw_skill_engineering_firerate_base( "asw_skill_engineering_firerate_base", "0.0", FCVAR_REPLICATED | FCVAR_CHEAT );
ConVar asw_skill_engineering_shield_health_base( "asw_skill_engineering_shield_health_base", "300", FCVAR_REPLICATED | FCVAR_CHEAT );
ConVar asw_skill_engineering_shield_duration_base( "asw_skill_engineering_shield_duration_base", "30", FCVAR_REPLICATED | FCVAR_CHEAT );
ConVar asw_skill_engineering_shield_damage_base( "asw_skill_engineering_shield_damage_base", "1", FCVAR_REPLICATED | FCVAR_CHEAT );
ConVar asw_skill_engineering_shield_damage_base( "asw_skill_engineering_shield_damage_base", "2", FCVAR_REPLICATED | FCVAR_CHEAT );

ConVar asw_skill_grenades_radius_base( "asw_skill_grenades_radius_base", "280", FCVAR_REPLICATED | FCVAR_CHEAT );
ConVar asw_skill_grenades_dmg_base( "asw_skill_grenades_dmg_base", "128", FCVAR_REPLICATED | FCVAR_CHEAT );
Expand Down Expand Up @@ -110,7 +110,7 @@ ConVar asw_skill_engineering_sentry_step( "asw_skill_engineering_sentry_step", "
ConVar asw_skill_engineering_firerate_step( "asw_skill_engineering_firerate_step", "0.005", FCVAR_REPLICATED | FCVAR_CHEAT );
ConVar asw_skill_engineering_shield_health_step( "asw_skill_engineering_shield_health_step", "50", FCVAR_REPLICATED | FCVAR_CHEAT );
ConVar asw_skill_engineering_shield_duration_step( "asw_skill_engineering_shield_duration_step", "5", FCVAR_REPLICATED | FCVAR_CHEAT );
ConVar asw_skill_engineering_shield_damage_step( "asw_skill_engineering_shield_damage_step", "0.5", FCVAR_REPLICATED | FCVAR_CHEAT );
ConVar asw_skill_engineering_shield_damage_step( "asw_skill_engineering_shield_damage_step", "2", FCVAR_REPLICATED | FCVAR_CHEAT );

ConVar asw_skill_grenades_radius_step( "asw_skill_grenades_radius_step", "20", FCVAR_REPLICATED | FCVAR_CHEAT );
ConVar asw_skill_grenades_dmg_step( "asw_skill_grenades_dmg_step", "20", FCVAR_REPLICATED | FCVAR_CHEAT );
Expand Down
74 changes: 48 additions & 26 deletions src/game/shared/swarm/asw_weapon_energy_shield_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@ ConVar rd_energy_shield_burst_penalty_shield( "rd_energy_shield_burst_penalty_sh
ConVar rd_energy_shield_burst_sound_count( "rd_energy_shield_burst_sound_count", "10", FCVAR_CHEAT | FCVAR_REPLICATED, "number of consecutive bursts to get maximum pitch" );
ConVar rd_energy_shield_burst_sound_pitch( "rd_energy_shield_burst_sound_pitch", "50", FCVAR_CHEAT | FCVAR_REPLICATED, "maximum pitch change" );
ConVar rd_energy_shield_holster_burst( "rd_energy_shield_holster_burst", "1", FCVAR_CHEAT | FCVAR_REPLICATED, "allow holstering to cancel burst" );
ConVar rd_energy_shield_holster_shield( "rd_energy_shield_holster_shield", "0", FCVAR_CHEAT | FCVAR_REPLICATED, "allow holstering to cancel shield" );
ConVar rd_energy_shield_holster_shield( "rd_energy_shield_holster_shield", "2", FCVAR_CHEAT | FCVAR_REPLICATED, "allow holstering to cancel shield (2 = holster does not cancel, only pauses)" );
ConVar rd_energy_shield_activation_blocks_shooting( "rd_energy_shield_activation_blocks_shooting", "0.5", FCVAR_CHEAT | FCVAR_REPLICATED, "minimum delay between activating shield and shooting next burst" );
#ifdef GAME_DLL
ConVar rd_energy_shield_touch_interval( "rd_energy_shield_touch_interval", "0.2", FCVAR_CHEAT, "time between damage ticks for the energy shield's electric dissolve" );
ConVar rd_energy_shield_distance_min( "rd_energy_shield_distance_min", "64", FCVAR_CHEAT );
ConVar rd_energy_shield_distance_max( "rd_energy_shield_distance_max", "112", FCVAR_CHEAT );
ConVar rd_energy_shield_height_min( "rd_energy_shield_height_min", "32", FCVAR_CHEAT );
ConVar rd_energy_shield_height_max( "rd_energy_shield_height_max", "64", FCVAR_CHEAT );
ConVar rd_energy_shield_move_speed( "rd_energy_shield_move_speed", "10", FCVAR_CHEAT );
ConVar rd_energy_shield_distance_min( "rd_energy_shield_distance_min", "64", FCVAR_CHEAT, "shield min distance in front of marine" );
ConVar rd_energy_shield_distance_max( "rd_energy_shield_distance_max", "112", FCVAR_CHEAT, "shield max distance in front of marine (it stays this far out unless there's a wall)" );
ConVar rd_energy_shield_height_min( "rd_energy_shield_height_min", "32", FCVAR_CHEAT, "shield height above floor when marine is aiming horizontally or lower" );
ConVar rd_energy_shield_height_max( "rd_energy_shield_height_max", "64", FCVAR_CHEAT, "shield height above floor when marine is aiming straight up" );
ConVar rd_energy_shield_move_speed( "rd_energy_shield_move_speed", "10", FCVAR_CHEAT, "speed multiplier for shield moving forward and backward" );
ConVar rd_energy_shield_ff( "rd_energy_shield_ff", "0", FCVAR_CHEAT, "does the energy shield damage friendly characters?" );
#endif
extern ConVar rd_shield_rifle_dmg_base;

Expand Down Expand Up @@ -112,6 +113,15 @@ const char *CASW_Weapon_Energy_Shield::GetMuzzleEffectName( int iShot )
return "muzzle_shieldrifle";
}

const char *CASW_Weapon_Energy_Shield::GetPartialReloadSound( int iPart )
{
if ( iPart == 1 )
return "ASW_Weapon_Energy_Shield.ReloadB";
if ( iPart == 2 )
return "ASW_Weapon_Energy_Shield.ReloadC";
return "ASW_Weapon_Energy_Shield.ReloadA";
}

void CASW_Weapon_Energy_Shield::OnDataChanged( DataUpdateType_t updateType )
{
BaseClass::OnDataChanged( updateType );
Expand Down Expand Up @@ -170,17 +180,26 @@ void CASW_Weapon_Energy_Shield::ClientThink()
}
}
#else
void CASW_Weapon_Energy_Shield::DestroyShield()
void CASW_Weapon_Energy_Shield::DestroyShield( bool bViolent )
{
Assert( m_hShield.Get() );
if ( !m_hShield.Get() )
return;

CBaseEntity *pHelpHelpImBeingSupressed = ( CBaseEntity * )te->GetSuppressHost();
te->SetSuppressHost( NULL );
CPASAttenuationFilter filter( m_hShield->GetAbsOrigin(), "ASW_Weapon_Energy_Shield.TurnOff" );
EmitSound( filter, entindex(), "ASW_Weapon_Energy_Shield.TurnOff", &m_hShield->GetAbsOrigin() );
DispatchParticleEffect( "energy_shield_dissipate", m_hShield->GetAbsOrigin(), m_hShield->GetAbsAngles() );
if ( bViolent )
{
CPASAttenuationFilter filter( m_hShield->GetAbsOrigin(), "ASW_Weapon_Energy_Shield.Shatter" );
EmitSound( filter, entindex(), "ASW_Weapon_Energy_Shield.Shatter", &m_hShield->GetAbsOrigin() );
DispatchParticleEffect( "energy_shield_dissipate_violent", m_hShield->GetAbsOrigin(), m_hShield->GetAbsAngles() );
}
else
{
CPASAttenuationFilter filter( m_hShield->GetAbsOrigin(), "ASW_Weapon_Energy_Shield.TurnOff" );
EmitSound( filter, entindex(), "ASW_Weapon_Energy_Shield.TurnOff", &m_hShield->GetAbsOrigin() );
DispatchParticleEffect( "energy_shield_dissipate", m_hShield->GetAbsOrigin(), m_hShield->GetAbsAngles() );
}
te->SetSuppressHost( pHelpHelpImBeingSupressed );

UTIL_Remove( m_hShield );
Expand All @@ -205,6 +224,9 @@ void CASW_Weapon_Energy_Shield::Precache()

PrecacheScriptSound( "ASW_Weapon_Energy_Shield.TurnOn" );
PrecacheScriptSound( "ASW_Weapon_Energy_Shield.TurnOff" );
PrecacheScriptSound( "ASW_Weapon_Energy_Shield.ReloadA" );
PrecacheScriptSound( "ASW_Weapon_Energy_Shield.ReloadB" );
PrecacheScriptSound( "ASW_Weapon_Energy_Shield.ReloadC" );

#ifdef GAME_DLL
UTIL_PrecacheOther( "asw_energy_shield_shield" );
Expand Down Expand Up @@ -335,7 +357,7 @@ void CASW_Weapon_Energy_Shield::UpdateOnRemove()
#ifdef GAME_DLL
if ( m_hShield.Get() )
{
DestroyShield();
DestroyShield( true );
}
#endif

Expand All @@ -345,9 +367,9 @@ void CASW_Weapon_Energy_Shield::UpdateOnRemove()
bool CASW_Weapon_Energy_Shield::Holster( CBaseCombatWeapon *pSwitchingTo )
{
#ifdef GAME_DLL
if ( m_hShield.Get() )
if ( m_hShield.Get() && rd_energy_shield_holster_shield.GetInt() <= 1 )
{
DestroyShield();
DestroyShield( false );
}
#endif

Expand All @@ -359,7 +381,7 @@ void CASW_Weapon_Energy_Shield::Drop( const Vector &vecVelocity )
#ifdef GAME_DLL
if ( m_hShield.Get() )
{
DestroyShield();
DestroyShield( !GetMarine() || !GetMarine()->IsAlive() );
}
#endif

Expand Down Expand Up @@ -503,7 +525,7 @@ void CASW_Energy_Shield::ClientThink()
m_pDLight->radius = 130.0f;
m_pDLight->die = m_flExpireTime;

bool bHiddenNow = m_hCreatorMarine.Get() && m_hCreatorMarine->GetCurrentMeleeAttack() != NULL;
bool bHiddenNow = m_hCreatorMarine.Get() && ( m_hCreatorMarine->GetCurrentMeleeAttack() != NULL || m_hCreatorMarine->GetActiveASWWeapon() != m_hCreatorWeapon.Get() );
if ( m_bWasHidden != bHiddenNow )
{
if ( bHiddenNow )
Expand Down Expand Up @@ -571,6 +593,8 @@ bool CASW_Energy_Shield::IsShieldInactive() const
return true;
if ( !m_hCreatorWeapon.Get() )
return true;
if ( m_hCreatorMarine->GetActiveASWWeapon() != m_hCreatorWeapon.Get() )
return true;

if ( m_hCreatorMarine->GetCurrentMeleeAttack() )
return true;
Expand Down Expand Up @@ -619,20 +643,13 @@ int CASW_Energy_Shield::OnTakeDamage( const CTakeDamageInfo &info )
}
void CASW_Energy_Shield::Event_Killed( const CTakeDamageInfo &info )
{
CBaseEntity *pHelpHelpImBeingSupressed = ( CBaseEntity * )te->GetSuppressHost();
te->SetSuppressHost( NULL );
DispatchParticleEffect( "energy_shield_dissipate_violent", GetAbsOrigin(), GetAbsAngles() );
CPASAttenuationFilter filter( this, "ASW_Weapon_Energy_Shield.Shatter" );
EmitSound( filter, m_hCreatorWeapon.Get() ? m_hCreatorWeapon->entindex() : 0, "ASW_Weapon_Energy_Shield.Shatter", &GetAbsOrigin() );
te->SetSuppressHost( pHelpHelpImBeingSupressed );

BaseClass::Event_Killed( info );

if ( m_hCreatorWeapon.Get() )
{
m_hCreatorWeapon->m_hShield = NULL;
m_hCreatorWeapon->DestroyShield( true );
}

BaseClass::Event_Killed( info );

UTIL_Remove( this );
}

Expand Down Expand Up @@ -694,7 +711,7 @@ void CASW_Energy_Shield::PositionThink()

if ( gpGlobals->curtime > m_flExpireTime )
{
m_hCreatorWeapon->DestroyShield();
m_hCreatorWeapon->DestroyShield( false );
}

SetContextThink( &CASW_Energy_Shield::PositionThink, gpGlobals->curtime + flInterval, s_pPositionThink );
Expand Down Expand Up @@ -728,6 +745,11 @@ void CASW_Energy_Shield::TouchThink()
continue;
}

if ( !rd_energy_shield_ff.GetBool() && m_hCreatorMarine->IRelationType( pEnt ) == D_LI )
{
continue;
}

trace_t tr;
CTraceFilterOnlyHitThis filter( pEnt );
UTIL_TraceLine( WorldSpaceCenter(), pEnt->GetAutoAimCenter(), MASK_ALL, &filter, &tr );
Expand Down
3 changes: 2 additions & 1 deletion src/game/shared/swarm/asw_weapon_energy_shield_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class CASW_Weapon_Energy_Shield : public CASW_Weapon_Rifle_Burst

const char *GetTracerEffectName( int iShot ) override;
const char *GetMuzzleEffectName( int iShot ) override;
const char *GetPartialReloadSound( int iPart ) override;
bool HasSecondaryExplosive() const override { return false; }
void OnDataChanged( DataUpdateType_t updateType ) override;
void ClientThink() override;
Expand All @@ -36,7 +37,7 @@ class CASW_Weapon_Energy_Shield : public CASW_Weapon_Rifle_Burst
#else
DECLARE_DATADESC();

void DestroyShield();
void DestroyShield( bool bViolent );
#endif

void Precache() override;
Expand Down

0 comments on commit 898ecf8

Please sign in to comment.