Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion src/game/shared/tf/tf_projectile_energy_ring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "halloween/merasmus/merasmus_trick_or_treat_prop.h"
#include "tf_robot_destruction_robot.h"
#include "tf_generic_bomb.h"
#include "tf_weapon_compound_bow.h"
#endif

#define ENERGY_RING_DISPATCH_EFFECT "ClientProjectile_EnergyRing"
Expand Down Expand Up @@ -65,6 +66,8 @@ PRECACHE_REGISTER_FN(PrecacheRing);

#ifdef GAME_DLL
ConVar tf_bison_tick_time( "tf_bison_tick_time", "0.025", FCVAR_CHEAT );
ConVar tf_energy_ring_old_damage_mechanics( "tf_energy_ring_old_damage_mechanics", "1", FCVAR_CHEAT | FCVAR_NOTIFY, "Globally use the old Pomson/Bison damage ramp-up and falloff mechanics." );
ConVar tf_energy_ring_old_damage_maxdamagedist( "tf_energy_ring_old_damage_maxdamagedist", "350.0", FCVAR_CHEAT | FCVAR_DEVELOPMENTONLY, "Maximum damage distance for energy weapons." );
#endif


Expand Down Expand Up @@ -188,6 +191,9 @@ void CTFProjectile_EnergyRing::Spawn()
SetRenderMode( kRenderNone );
SetSolidFlags( FSOLID_TRIGGER | FSOLID_NOT_SOLID );
SetCollisionGroup( TFCOLLISION_GROUP_ROCKETS );
CollisionProp()->UseTriggerBounds( true, 24.0f, true );

m_vecInitialPos = GetAbsOrigin();
}

//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -256,15 +262,48 @@ void CTFProjectile_EnergyRing::ProjectileTouch( CBaseEntity *pOther )

if ( bCombatEntity )
{
// Light friendly Huntsman arrows with the Bison and Pomson
if ( pOther->IsPlayer() && pOther->InSameTeam( pOwner ) )
{
CTFPlayer* pPlayer = ToTFPlayer( pOther );

// Only care about Snipers
if ( pPlayer->IsPlayerClass( TF_CLASS_SNIPER ) )
{
// Does he have the bow?
CTFWeaponBase* pWpn = pPlayer->GetActiveTFWeapon();
if ( pWpn && pWpn->GetWeaponID() == TF_WEAPON_COMPOUND_BOW )
{
CTFCompoundBow *pBow = static_cast<CTFCompoundBow*>( pWpn );
pBow->SetArrowAlight( true );
}
}
}

// Bison projectiles shouldn't collide with friendly things
if ( ShouldPenetrate() && ( pOther->InSameTeam( this ) || ( gpGlobals->curtime - m_flLastHitTime ) < tf_bison_tick_time.GetFloat() ) )
return;

m_flLastHitTime = gpGlobals->curtime;

const int nDamage = GetDamage();
float flDamage = GetDamage();

if ( tf_energy_ring_old_damage_mechanics.GetBool() ) // Pre-July 7, 2016 Bison and Pomson damage falloff mechanics
{
const float flDistance = GetAbsOrigin().DistTo( m_vecInitialPos );
flDamage *= RemapValClamped( flDistance, tf_energy_ring_old_damage_maxdamagedist.GetFloat()/2, tf_energy_ring_old_damage_maxdamagedist.GetFloat(), 1.0f, 0.70f );
}

const int nDamage = RoundFloatToInt( flDamage );

CTakeDamageInfo info( this, pOwner, GetLauncher(), nDamage, GetDamageType(), TF_DMG_CUSTOM_PLASMA );
info.SetDamageForce( GetAbsVelocity() ); // Fix "== vec3_origin" check errors caused by setting damage type to DMG_SONIC

if ( tf_energy_ring_old_damage_mechanics.GetBool() )
{
info.SetDamageType( info.GetDamageType() &~( DMG_USEDISTANCEMOD | DMG_NOCLOSEDISTANCEMOD ) );
}

info.SetReportedPosition( pOwner->GetAbsOrigin() );
info.SetDamagePosition( pTrace->endpos );

Expand Down
1 change: 1 addition & 0 deletions src/game/shared/tf/tf_projectile_energy_ring.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class CTFProjectile_EnergyRing : public CTFBaseProjectile
Vector m_vColor2;

Vector m_vecPrevPos;
Vector m_vecInitialPos;

#ifdef GAME_DLL
float m_flLastHitTime;
Expand Down
4 changes: 2 additions & 2 deletions src/game/shared/tf/tf_shareddefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -792,10 +792,10 @@ int g_aWeaponDamageTypes[] =
DMG_BULLET | DMG_USEDISTANCEMOD, // TF_WEAPON_HANDGUN_SCOUT_SECONDARY
DMG_BUCKSHOT | DMG_USEDISTANCEMOD, // TF_WEAPON_SODA_POPPER,
DMG_BULLET | DMG_USE_HITLOCATIONS, // TF_WEAPON_SNIPERRIFLE_DECAP,
DMG_BULLET | DMG_USEDISTANCEMOD | DMG_NOCLOSEDISTANCEMOD | DMG_PREVENT_PHYSICS_FORCE, // TF_WEAPON_RAYGUN,
DMG_SONIC | DMG_USEDISTANCEMOD | DMG_NOCLOSEDISTANCEMOD, // TF_WEAPON_RAYGUN,
DMG_BLAST | DMG_HALF_FALLOFF | DMG_USEDISTANCEMOD, // TF_WEAPON_PARTICLE_CANNON,
DMG_BULLET | DMG_USEDISTANCEMOD, // TF_WEAPON_MECHANICAL_ARM,
DMG_BULLET | DMG_USEDISTANCEMOD | DMG_NOCLOSEDISTANCEMOD | DMG_PREVENT_PHYSICS_FORCE, // TF_WEAPON_DRG_POMSON,
DMG_SONIC | DMG_USEDISTANCEMOD | DMG_NOCLOSEDISTANCEMOD, // TF_WEAPON_DRG_POMSON,
DMG_CLUB, // TF_WEAPON_BAT_GIFTWRAP,
DMG_CLUB, // TF_WEAPON_GRENADE_ORNAMENT_BALL
DMG_BULLET | DMG_IGNITE, // TF_WEAPON_FLAREGUN_REVENGE,
Expand Down