From 9e4e35ddecdd95b32fec7aa3ac42e393b49f1456 Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Fri, 2 Aug 2024 12:40:29 -0500 Subject: [PATCH] separate burn grace period per incendiary weapon type fix incendiary mines not properly handling friendly fire sometimes make rolling through mines actually do something --- src/game/server/ai_basenpc.h | 2 +- src/game/server/baseanimating.cpp | 2 +- src/game/server/hl2/npc_BaseZombie.h | 2 - src/game/server/hl2/npc_combines.h | 2 - src/game/server/hl2/npc_headcrab.h | 2 - src/game/server/props.cpp | 2 +- src/game/server/swarm/asw_buzzer.cpp | 6 +-- src/game/server/swarm/asw_buzzer.h | 2 +- src/game/server/swarm/asw_colonist.cpp | 6 +-- src/game/server/swarm/asw_colonist.h | 2 +- src/game/server/swarm/asw_egg.cpp | 8 +-- src/game/server/swarm/asw_egg.h | 2 +- .../swarm/asw_extinguisher_projectile.cpp | 2 +- .../swarm/asw_extinguisher_projectile.h | 6 ++- src/game/server/swarm/asw_fire.cpp | 6 +-- src/game/server/swarm/asw_harvester.cpp | 2 +- src/game/server/swarm/asw_inhabitable_npc.cpp | 8 +-- src/game/server/swarm/asw_inhabitable_npc.h | 4 +- src/game/server/swarm/asw_marine.cpp | 51 ++++++++++++++++--- src/game/server/swarm/asw_marine.h | 8 +-- src/game/server/swarm/asw_mine.cpp | 3 +- src/game/server/swarm/asw_queen.h | 2 +- src/game/server/swarm/asw_shieldbug.cpp | 4 +- src/game/server/swarm/asw_shieldbug.h | 2 +- src/game/server/swarm/asw_simple_alien.cpp | 4 +- src/game/server/swarm/asw_simple_alien.h | 26 +++++----- src/game/server/swarm/iasw_spawnable_npc.h | 2 +- src/game/shared/swarm/asw_deathmatch_mode.cpp | 2 + src/game/shared/swarm/asw_marine_shared.cpp | 2 +- 29 files changed, 104 insertions(+), 68 deletions(-) diff --git a/src/game/server/ai_basenpc.h b/src/game/server/ai_basenpc.h index 9605b2897..5b2fd6915 100644 --- a/src/game/server/ai_basenpc.h +++ b/src/game/server/ai_basenpc.h @@ -1125,7 +1125,7 @@ class CAI_BaseNPC : public CBaseCombatCharacter, void SelectDeathPose( const CTakeDamageInfo &info ); virtual bool ShouldPickADeathPose( void ) { return true; } - virtual bool AllowedToIgnite( void ) { return false; } + virtual bool AllowedToIgnite( CBaseEntity *pAttacker, CBaseEntity *pWeapon, CBaseEntity *pInflictor ) { return false; } protected: virtual float GetGoalRepathTolerance( CBaseEntity *pGoalEnt, GoalType_t type, const Vector &curGoal, const Vector &curTargetPos ); diff --git a/src/game/server/baseanimating.cpp b/src/game/server/baseanimating.cpp index 452977ec6..85a9f4143 100644 --- a/src/game/server/baseanimating.cpp +++ b/src/game/server/baseanimating.cpp @@ -3684,7 +3684,7 @@ void CBaseAnimating::Ignite( float flFlameLifetime, bool bNPCOnly, float flSize, { CAI_BaseNPC *pNPC = MyNPCPointer(); - if ( pNPC && pNPC->AllowedToIgnite() == false ) + if ( pNPC && pNPC->AllowedToIgnite( NULL, NULL, NULL ) == false ) return; } diff --git a/src/game/server/hl2/npc_BaseZombie.h b/src/game/server/hl2/npc_BaseZombie.h index d54ad284e..e235e594d 100644 --- a/src/game/server/hl2/npc_BaseZombie.h +++ b/src/game/server/hl2/npc_BaseZombie.h @@ -192,8 +192,6 @@ abstract_class CNPC_BaseZombie : public CASW_Alien bool OnInsufficientStopDist( AILocalMoveGoal_t *pMoveGoal, float distClear, AIMoveResult_t *pResult ); - virtual bool AllowedToIgnite( void ) { return m_bFlammable; } - public: CAI_ActBusyBehavior m_ActBusyBehavior; diff --git a/src/game/server/hl2/npc_combines.h b/src/game/server/hl2/npc_combines.h index e0e4b0b99..443541bbe 100644 --- a/src/game/server/hl2/npc_combines.h +++ b/src/game/server/hl2/npc_combines.h @@ -36,8 +36,6 @@ class CNPC_CombineS : public CNPC_Combine bool m_fIsBlocking; - virtual bool AllowedToIgnite( void ) { return true; } - private: bool ShouldHitPlayer( const Vector &targetDir, float targetDist ); diff --git a/src/game/server/hl2/npc_headcrab.h b/src/game/server/hl2/npc_headcrab.h index 726d84086..b6f52e767 100644 --- a/src/game/server/hl2/npc_headcrab.h +++ b/src/game/server/hl2/npc_headcrab.h @@ -74,8 +74,6 @@ abstract_class CBaseHeadcrab : public CASW_Alien_Jumper void CrawlFromCanister(); - virtual bool AllowedToIgnite( void ) { return m_bFlammable; } - virtual bool CanBeAnEnemyOf( CBaseEntity *pEnemy ); bool IsHangingFromCeiling( void ) diff --git a/src/game/server/props.cpp b/src/game/server/props.cpp index 87998b128..b1b3c333b 100644 --- a/src/game/server/props.cpp +++ b/src/game/server/props.cpp @@ -1043,7 +1043,7 @@ void CBreakableProp::BreakablePropTouch( CBaseEntity *pOther ) { CAI_BaseNPC *pNPC = pOther->MyNPCPointer(); - if ( pNPC && pNPC->AllowedToIgnite() && pNPC->IsOnFire() == false ) + if ( pNPC && pNPC->AllowedToIgnite( NULL, NULL, NULL ) && pNPC->IsOnFire() == false ) { pNPC->Ignite( 25.0f ); KillFlare( this, m_hFlareEnt, PROP_FLARE_IGNITE_SUBSTRACT ); diff --git a/src/game/server/swarm/asw_buzzer.cpp b/src/game/server/swarm/asw_buzzer.cpp index 779e31c5d..c412064c8 100644 --- a/src/game/server/swarm/asw_buzzer.cpp +++ b/src/game/server/swarm/asw_buzzer.cpp @@ -684,7 +684,7 @@ int CASW_Buzzer::OnTakeDamage_Alive( const CTakeDamageInfo &info ) if (nRetVal > 0 && ( ((info.GetDamageType() & DMG_BURN) || (info.GetDamageType() & DMG_BLAST)) && m_bFlammable ) ) - ASW_Ignite(30.0f, 0, pAttacker, info.GetWeapon() ); + ASW_Ignite(30.0f, 0, pAttacker, info.GetWeapon(), info.GetInflictor() ); } return nRetVal; @@ -3024,9 +3024,9 @@ int CASW_Buzzer::SelectSchedule( void ) return BaseClass::SelectSchedule(); } -void CASW_Buzzer::ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon /*= NULL */ ) +void CASW_Buzzer::ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon, CBaseEntity *pInflictor ) { - if (AllowedToIgnite()) + if ( AllowedToIgnite( pAttacker, pDamagingWeapon, pInflictor ) ) { if( IsOnFire() ) return; diff --git a/src/game/server/swarm/asw_buzzer.h b/src/game/server/swarm/asw_buzzer.h index 5c7f80f14..d67a4ab65 100644 --- a/src/game/server/swarm/asw_buzzer.h +++ b/src/game/server/swarm/asw_buzzer.h @@ -176,7 +176,7 @@ DECLARE_SERVERCLASS(); virtual bool IsAlien(void) const { return true; } virtual void MoveAside() { } - virtual void ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon = NULL ); + virtual void ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon, CBaseEntity *pInflictor ); virtual void Extinguish(); virtual void OnSwarmSensed(int iDistance); diff --git a/src/game/server/swarm/asw_colonist.cpp b/src/game/server/swarm/asw_colonist.cpp index 7a8ab24f8..244eb325d 100644 --- a/src/game/server/swarm/asw_colonist.cpp +++ b/src/game/server/swarm/asw_colonist.cpp @@ -410,7 +410,7 @@ int CASW_Colonist::OnTakeDamage_Alive( const CTakeDamageInfo &info ) { if ( !IsOnFire() ) { - ASW_Ignite( 10, 0, info.GetAttacker(), info.GetWeapon() ); + ASW_Ignite( 10, 0, info.GetAttacker(), info.GetWeapon(), info.GetInflictor() ); } } else if ( info.GetDamage() > 0 ) @@ -433,9 +433,9 @@ int CASW_Colonist::OnTakeDamage_Alive( const CTakeDamageInfo &info ) return BaseClass::OnTakeDamage_Alive( info ); } -void CASW_Colonist::ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon ) +void CASW_Colonist::ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon, CBaseEntity *pInflictor ) { - if ( AllowedToIgnite() ) + if ( AllowedToIgnite( pAttacker, pDamagingWeapon, pInflictor ) ) { bool bFriendlyFire = IRelationType( pAttacker ) == D_LI; diff --git a/src/game/server/swarm/asw_colonist.h b/src/game/server/swarm/asw_colonist.h index 878b337fd..cf9c20ea6 100644 --- a/src/game/server/swarm/asw_colonist.h +++ b/src/game/server/swarm/asw_colonist.h @@ -27,7 +27,7 @@ class CASW_Colonist : public CASW_Inhabitable_NPC, public IASW_Server_Usable_Ent Class_T Classify() { return (Class_T) CLASS_ASW_COLONIST; } Activity NPC_TranslateActivity( Activity eNewActivity ); int OnTakeDamage_Alive( const CTakeDamageInfo &info ); - void ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon ); + void ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon, CBaseEntity *pInflictor ) override; virtual void MeleeBleed(CTakeDamageInfo* info); bool IsPlayerAlly( CBasePlayer *pPlayer = NULL ); void PainSound( const CTakeDamageInfo &info ); diff --git a/src/game/server/swarm/asw_egg.cpp b/src/game/server/swarm/asw_egg.cpp index e7979a639..e61532db7 100644 --- a/src/game/server/swarm/asw_egg.cpp +++ b/src/game/server/swarm/asw_egg.cpp @@ -448,7 +448,7 @@ void CASW_Egg::Hatch(CBaseEntity* pOther) CBaseEntity *pBurner = m_hBurner.Get(); if (!pBurner) pBurner = this; - GetParasite()->ASW_Ignite( 30, 0, pBurner, m_hBurnerWeapon.Get() ); + GetParasite()->ASW_Ignite( 30, 0, pBurner, m_hBurnerWeapon.Get(), pBurner ); } else { @@ -547,7 +547,7 @@ int CASW_Egg::OnTakeDamage( const CTakeDamageInfo &info ) if ( ( info.GetDamageType() & DMG_BURN ) || ( info.GetDamageType() & DMG_BLAST ) ) { - ASW_Ignite( 30.0f, 0, pAttacker, info.GetWeapon() ); + ASW_Ignite( 30.0f, 0, pAttacker, info.GetWeapon(), info.GetInflictor() ); } } return result; @@ -642,7 +642,7 @@ void CASW_Egg::ParasiteDied(CASW_Parasite* pParasite) m_hParasite = NULL; } -void CASW_Egg::ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon /*= NULL */ ) +void CASW_Egg::ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon, CBaseEntity *pInflictor ) { if( IsOnFire() ) return; @@ -660,7 +660,7 @@ void CASW_Egg::ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAt void CASW_Egg::Ignite( float flFlameLifetime, bool bNPCOnly, float flSize, bool bCalledByLevelDesigner ) { - return; // use ASW_Ignite instead + Assert( 0 ); // use ASW_Ignite instead } CASW_Parasite* CASW_Egg::GetParasite() diff --git a/src/game/server/swarm/asw_egg.h b/src/game/server/swarm/asw_egg.h index 8bcc03dbb..0505b9e5b 100644 --- a/src/game/server/swarm/asw_egg.h +++ b/src/game/server/swarm/asw_egg.h @@ -52,7 +52,7 @@ class CASW_Egg : public CBaseFlex // damage related virtual int OnTakeDamage( const CTakeDamageInfo &info ); virtual void Event_Killed( const CTakeDamageInfo &info ); - virtual void ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon = NULL ); + virtual void ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon, CBaseEntity *pInflictor ); virtual void Ignite( float flFlameLifetime, bool bNPCOnly = true, float flSize = 0.0f, bool bCalledByLevelDesigner = false ); virtual void TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr ); virtual void Bleed( const CTakeDamageInfo &info, const Vector &vecPos, const Vector &vecDir, trace_t *ptr ); diff --git a/src/game/server/swarm/asw_extinguisher_projectile.cpp b/src/game/server/swarm/asw_extinguisher_projectile.cpp index b609dea8b..a6ff9e005 100644 --- a/src/game/server/swarm/asw_extinguisher_projectile.cpp +++ b/src/game/server/swarm/asw_extinguisher_projectile.cpp @@ -49,7 +49,7 @@ IMPLEMENT_SERVERCLASS_ST( CASW_Extinguisher_Projectile, DT_ASW_Extinguisher_Proj END_SEND_TABLE() BEGIN_DATADESC( CASW_Extinguisher_Projectile ) - DEFINE_FUNCTION( ProjectileTouch ), + DEFINE_ENTITYFUNC( ProjectileTouch ), DEFINE_FIELD( m_hFirer, FIELD_EHANDLE ), DEFINE_FIELD( m_hFirerWeapon, FIELD_EHANDLE ), DEFINE_FIELD( m_flDamage, FIELD_FLOAT ), diff --git a/src/game/server/swarm/asw_extinguisher_projectile.h b/src/game/server/swarm/asw_extinguisher_projectile.h index aa267cb11..6190157ed 100644 --- a/src/game/server/swarm/asw_extinguisher_projectile.h +++ b/src/game/server/swarm/asw_extinguisher_projectile.h @@ -4,7 +4,7 @@ #include "rd_inventory_shared.h" -class CASW_Extinguisher_Projectile : public CBaseCombatCharacter +class CASW_Extinguisher_Projectile : public CBaseCombatCharacter, public IRD_Has_Projectile_Data { DECLARE_CLASS( CASW_Extinguisher_Projectile, CBaseCombatCharacter ); DECLARE_SERVERCLASS(); @@ -32,6 +32,10 @@ class CASW_Extinguisher_Projectile : public CBaseCombatCharacter EHANDLE m_hFirerWeapon; CNetworkVarEmbedded( CRD_ProjectileData, m_ProjectileData ); + const CRD_ProjectileData *GetProjectileData() const override + { + return &m_ProjectileData; + } float m_flDamage; float m_flFreezeAmount; diff --git a/src/game/server/swarm/asw_fire.cpp b/src/game/server/swarm/asw_fire.cpp index 6382f5e44..12774e2e3 100644 --- a/src/game/server/swarm/asw_fire.cpp +++ b/src/game/server/swarm/asw_fire.cpp @@ -1806,13 +1806,13 @@ void CFire::ASWFireTouch( CBaseEntity *pOther ) } // Burn for 1/3rd the time decided by difficulty - pMarine->ASW_Ignite( ( m_nFireType == FIRE_WALL_MINE ) ? 0.5f : 1.0f, 0, pOwner ? pOwner : this, m_hCreatorWeapon ); + pMarine->ASW_Ignite( ( m_nFireType == FIRE_WALL_MINE ) ? 0.5f : 1.0f, 0, pOwner ? pOwner : this, m_hCreatorWeapon, this ); //Msg("OUCH OUCH BURNING MARINE\n"); } else if ( pOther->Classify() == CLASS_ASW_COLONIST ) { CASW_Colonist *pColonist = assert_cast(pOther); - pColonist->ASW_Ignite( ( m_nFireType == FIRE_WALL_MINE ) ? 5 : 10, 0, pOwner ? pOwner : this, m_hCreatorWeapon ); + pColonist->ASW_Ignite( ( m_nFireType == FIRE_WALL_MINE ) ? 5 : 10, 0, pOwner ? pOwner : this, m_hCreatorWeapon, this ); } else if ( IASW_Spawnable_NPC *pSpawnable = dynamic_cast< IASW_Spawnable_NPC * >( pOther ) ) { @@ -1828,7 +1828,7 @@ void CFire::ASWFireTouch( CBaseEntity *pOther ) } } } - pSpawnable->ASW_Ignite( 10.0f, 0, pOwner ? pOwner : this, m_hCreatorWeapon ); + pSpawnable->ASW_Ignite( 10.0f, 0, pOwner ? pOwner : this, m_hCreatorWeapon, this ); if ( m_nFireType == FIRE_WALL_MINE && pSpawnable->GetNPC() ) { diff --git a/src/game/server/swarm/asw_harvester.cpp b/src/game/server/swarm/asw_harvester.cpp index 113ecfddf..3299a36d7 100644 --- a/src/game/server/swarm/asw_harvester.cpp +++ b/src/game/server/swarm/asw_harvester.cpp @@ -689,7 +689,7 @@ void CASW_Harvester::Event_Killed( const CTakeDamageInfo &info ) if ( IsOnFire() ) { - pParasite->ASW_Ignite( 30.0f, 0, info.GetAttacker(), info.GetWeapon() ); + pParasite->ASW_Ignite( 30.0f, 0, info.GetAttacker(), info.GetWeapon(), info.GetInflictor() ); } } } diff --git a/src/game/server/swarm/asw_inhabitable_npc.cpp b/src/game/server/swarm/asw_inhabitable_npc.cpp index 185484841..ad2821c10 100644 --- a/src/game/server/swarm/asw_inhabitable_npc.cpp +++ b/src/game/server/swarm/asw_inhabitable_npc.cpp @@ -674,7 +674,7 @@ int CASW_Inhabitable_NPC::OnTakeDamage_Alive( const CTakeDamageInfo &info ) // if we take fire damage (but not afterburn damage), catch on fire if ( result > 0 && ( newInfo.GetDamageType() & DMG_BURN ) && m_bFlammable && newInfo.GetWeapon() && !( newInfo.GetDamageType() & DMG_DIRECT ) ) { - ASW_Ignite( asw_alien_burn_duration.GetFloat(), 0, pAttacker, newInfo.GetWeapon() ); + ASW_Ignite( asw_alien_burn_duration.GetFloat(), 0, pAttacker, newInfo.GetWeapon(), newInfo.GetInflictor() ); } // make the alien move slower for 0.5 seconds @@ -738,9 +738,9 @@ void CASW_Inhabitable_NPC::Event_Killed( const CTakeDamageInfo &info ) BaseClass::Event_Killed( info ); } -void CASW_Inhabitable_NPC::ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon ) +void CASW_Inhabitable_NPC::ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon, CBaseEntity *pInflictor ) { - if ( AllowedToIgnite() ) + if ( AllowedToIgnite( pAttacker, pDamagingWeapon, pInflictor ) ) { if ( IsOnFire() ) { @@ -765,7 +765,7 @@ void CASW_Inhabitable_NPC::Ignite( float flFlameLifetime, bool bNPCOnly, float f void CASW_Inhabitable_NPC::ScriptIgnite( float flFlameLifetime ) { - ASW_Ignite( flFlameLifetime, 0, NULL, NULL ); + ASW_Ignite( flFlameLifetime, 0, NULL, NULL, NULL ); } void CASW_Inhabitable_NPC::Extinguish() diff --git a/src/game/server/swarm/asw_inhabitable_npc.h b/src/game/server/swarm/asw_inhabitable_npc.h index 746b7c869..32cdaad56 100644 --- a/src/game/server/swarm/asw_inhabitable_npc.h +++ b/src/game/server/swarm/asw_inhabitable_npc.h @@ -130,8 +130,8 @@ class CASW_Inhabitable_NPC : public CAI_PlayerAlly, public IASW_Spawnable_NPC virtual void Event_Killed( const CTakeDamageInfo &info ) override; // burning - virtual bool AllowedToIgnite( void ) override { return m_bFlammable; } - virtual void ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon = NULL ) override; + virtual bool AllowedToIgnite( CBaseEntity *pAttacker, CBaseEntity *pWeapon, CBaseEntity *pInflictor ) override { return m_bFlammable; } + virtual void ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon, CBaseEntity *pInflictor ) override; virtual void Ignite( float flFlameLifetime, bool bNPCOnly = true, float flSize = 0.0f, bool bCalledByLevelDesigner = false ) override; virtual void ScriptIgnite( float flFlameLifetime ); virtual void Extinguish() override; diff --git a/src/game/server/swarm/asw_marine.cpp b/src/game/server/swarm/asw_marine.cpp index 8360efc0c..4b064ee23 100644 --- a/src/game/server/swarm/asw_marine.cpp +++ b/src/game/server/swarm/asw_marine.cpp @@ -462,8 +462,17 @@ ConVar asw_marine_burn_time_normal( "asw_marine_burn_time_normal", "8", FCVAR_CH ConVar asw_marine_burn_time_hard( "asw_marine_burn_time_hard", "12", FCVAR_CHEAT, "Amount of time marine burns for when ignited on hard difficulty" ); ConVar asw_marine_burn_time_insane( "asw_marine_burn_time_insane", "15", FCVAR_CHEAT, "Amount of time marine burns for when ignited on insane difficulty" ); ConVar asw_marine_time_until_ignite_expire( "asw_marine_time_until_ignite_expire", "2.0", FCVAR_CHEAT, "Amount of time until repeated burn damage counter expires" ); -ConVar asw_marine_time_until_ignite( "asw_marine_time_until_ignite", "0.0", FCVAR_CHEAT, "Amount of time before a marine ignites from taking repeated burn damage" ); -ConVar asw_marine_time_until_ignite_hcff( "asw_marine_time_until_ignite_hcff", "0.0", FCVAR_CHEAT, "Amount of time before a marine ignites from taking repeated burn damage (hardcore ff)" ); +ConVar asw_marine_time_until_ignite( "asw_marine_time_until_ignite", "0.7", FCVAR_CHEAT, "Amount of time before a marine ignites from taking repeated burn damage" ); +ConVar asw_marine_time_until_ignite_hcff( "asw_marine_time_until_ignite_hcff", "0.2", FCVAR_CHEAT, "Amount of time before a marine ignites from taking repeated burn damage (hardcore ff)" ); +ConVar asw_marine_time_until_ignite_flamer( "asw_marine_time_until_ignite_flamer", "0.0", FCVAR_CHEAT, "If non-negative, overrides asw_marine_time_until_ignite for the M868 Flamer Unit" ); +ConVar asw_marine_time_until_ignite_hcff_flamer( "asw_marine_time_until_ignite_hcff_flamer", "0.0", FCVAR_CHEAT, "If non-negative, overrides asw_marine_time_until_ignite_hcff for the M868 Flamer Unit" ); +ConVar asw_marine_time_until_ignite_grenade( "asw_marine_time_until_ignite_grenade", "-1", FCVAR_CHEAT, "If non-negative, overrides asw_marine_time_until_ignite for M42 Vindicator grenades and NA-23 Incendiary Grenades" ); +ConVar asw_marine_time_until_ignite_hcff_grenade( "asw_marine_time_until_ignite_hcff_grenade", "-1", FCVAR_CHEAT, "If non-negative, overrides asw_marine_time_until_ignite_hcff for M42 Vindicator grenades and NA-23 Incendiary Grenades" ); +ConVar asw_marine_time_until_ignite_mines( "asw_marine_time_until_ignite_mines", "-1", FCVAR_CHEAT, "If non-negative, overrides asw_marine_time_until_ignite for M478 Proximity Incendiary Mines" ); +ConVar asw_marine_time_until_ignite_hcff_mines( "asw_marine_time_until_ignite_hcff_mines", "-1", FCVAR_CHEAT, "If non-negative, overrides asw_marine_time_until_ignite_hcff for M478 Proximity Incendiary Mines" ); +ConVar asw_marine_time_until_ignite_plasma( "asw_marine_time_until_ignite_plasma", "-1", FCVAR_CHEAT, "If non-negative, overrides asw_marine_time_until_ignite for the G521 Plasma Thrower" ); +ConVar asw_marine_time_until_ignite_hcff_plasma( "asw_marine_time_until_ignite_hcff_plasma", "-1", FCVAR_CHEAT, "If non-negative, overrides asw_marine_time_until_ignite_hcff for the G521 Plasma Thrower" ); +ConVar asw_marine_roll_through_firewall( "asw_marine_roll_through_firewall", "1", FCVAR_CHEAT, "If set, marines cannot be ignited by M478 Proximity Incendiary Mines while rolling" ); ConVar asw_mad_firing_break( "asw_mad_firing_break", "4", FCVAR_CHEAT, "Point at which the mad firing counter triggers the mad firing speech" ); ConVar asw_mad_firing_decay( "asw_mad_firing_decay", "0.15", FCVAR_CHEAT, "Tick down rate of the mad firing counter" ); ConVar asw_marine_special_idle_chatter_chance( "asw_marine_special_idle_chatter_chance", "0.25", FCVAR_CHEAT, "Chance of marine doing a special idle chatter" ); @@ -1874,9 +1883,9 @@ int CASW_Marine::OnTakeDamage_Alive( const CTakeDamageInfo &info ) // if we take fire damage, catch on fire float fPainInterval = 0.7f; - if ( info.GetDamageType() & DMG_BURN ) + if ( ( info.GetDamageType() & DMG_BURN ) && !( info.GetDamageType() & DMG_DIRECT ) ) { - ASW_Ignite( 1.0f, 0, pAttacker, info.GetWeapon() ); + ASW_Ignite( 1.0f, 0, pAttacker, info.GetWeapon(), info.GetInflictor() ); } if ( info.GetDamageType() & DMG_POISON ) @@ -5058,7 +5067,7 @@ void CASW_Marine::ScriptIgnite( float flFlameLifetime ) m_flLastBurnTime = gpGlobals->curtime; } -void CASW_Marine::ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon /*= NULL */ ) +void CASW_Marine::ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon, CBaseEntity *pInflictor ) { if (!ASWGameRules()) return; @@ -5081,7 +5090,7 @@ void CASW_Marine::ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity * // if this is an env_fire trying to burn us, ignore the grace period that the AllowedToIgnite function does // we want env_fires to always ignite the marine immediately so they can be used as dangerous blockers in levels CFire *pFire = dynamic_cast< CFire * >( pAttacker ); - if ( AllowedToIgnite( pAttacker, pDamagingWeapon ) || ( pFire && !pFire->m_bPlacedByMarine ) || rd_marine_ignite_immediately.GetBool() ) + if ( AllowedToIgnite( pAttacker, pDamagingWeapon, pInflictor ) || ( pFire && !pFire->m_bPlacedByMarine ) || rd_marine_ignite_immediately.GetBool() ) { if ( IsOnFire() ) return; @@ -5113,7 +5122,7 @@ void CASW_Marine::ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity * void CASW_Marine::Ignite( float flFlameLifetime, bool bNPCOnly, float flSize, bool bCalledByLevelDesigner ) { - return; // use ASW_Ignite instead; + Assert( 0 ); // use ASW_Ignite instead; } void CASW_Marine::Extinguish( CBaseEntity *pHealer, CBaseEntity *pWeapon ) @@ -5147,12 +5156,38 @@ void CASW_Marine::Extinguish() Extinguish( NULL, NULL ); } -bool CASW_Marine::AllowedToIgnite( CBaseEntity *pAttacker, CBaseEntity *pWeapon ) +bool CASW_Marine::AllowedToIgnite( CBaseEntity *pAttacker, CBaseEntity *pWeapon, CBaseEntity *pInflictor ) { if ( m_iJumpJetting.Get() != 0 ) return false; float flBurnTime = ( asw_marine_ff_absorption.GetInt() > 0 ) ? asw_marine_time_until_ignite.GetFloat() : asw_marine_time_until_ignite_hcff.GetFloat(); +#define CHECK_BURN_TIME( suffix ) \ + if ( asw_marine_ff_absorption.GetInt() > 0 && asw_marine_time_until_ignite_##suffix.GetFloat() >= 0 ) \ + flBurnTime = asw_marine_time_until_ignite_##suffix.GetFloat(); \ + else if ( asw_marine_ff_absorption.GetInt() <= 0 && asw_marine_time_until_ignite_hcff_##suffix.GetFloat() >= 0 ) \ + flBurnTime = asw_marine_time_until_ignite_hcff_##suffix.GetFloat() + if ( pWeapon && pWeapon->Classify() == CLASS_ASW_FLAMER ) + { + CHECK_BURN_TIME( flamer ); + } + else if ( pWeapon && pWeapon->Classify() == CLASS_ASW_PLASMA_THROWER ) + { + CHECK_BURN_TIME( plasma ); + } + else if ( pInflictor && pInflictor->Classify() == CLASS_ASW_GRENADE_VINDICATOR ) + { + CHECK_BURN_TIME( grenade ); + } + else if ( pInflictor && pInflictor->Classify() == CLASS_ASW_FIRE && assert_cast< CFire * >( pInflictor )->m_bPlacedByMarine ) + { + if ( m_iMeleeAttackID == CASW_Melee_System::s_nRollAttackID && asw_marine_roll_through_firewall.GetBool() ) + return false; + + CHECK_BURN_TIME( mines ); + } +#undef CHECK_BURN_TIME + if ( flBurnTime <= 0.0f || ( m_flFirstBurnTime > 0 && ( gpGlobals->curtime - m_flFirstBurnTime ) >= flBurnTime ) ) return true; diff --git a/src/game/server/swarm/asw_marine.h b/src/game/server/swarm/asw_marine.h index add3cf322..374312010 100644 --- a/src/game/server/swarm/asw_marine.h +++ b/src/game/server/swarm/asw_marine.h @@ -623,12 +623,12 @@ class CASW_Marine : public CASW_VPhysics_NPC, public IASWPlayerAnimStateHelpers, CNetworkVar(float, m_fInfestedStartTime); // when the marine first got infested int m_iInfestCycle; virtual void ScriptIgnite( float flFlameLifetime ); - virtual void ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon = NULL ); - virtual void Ignite( float flFlameLifetime, bool bNPCOnly = true, float flSize = 0.0f, bool bCalledByLevelDesigner = false ); + virtual void ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon, CBaseEntity *pInflictor ) override; + virtual void Ignite( float flFlameLifetime, bool bNPCOnly = true, float flSize = 0.0f, bool bCalledByLevelDesigner = false ) override; virtual void Extinguish( CBaseEntity *pHealer, CBaseEntity *pWeapon ); - virtual void Extinguish(); + virtual void Extinguish() override; void ScriptExtinguish() { Extinguish( NULL, NULL ); } - virtual bool AllowedToIgnite( CBaseEntity *pAttacker, CBaseEntity *pWeapon ); + bool AllowedToIgnite( CBaseEntity *pAttacker, CBaseEntity *pWeapon, CBaseEntity *pInflictor ) override; float m_flFirstBurnTime; float m_flLastBurnTime; float m_flLastBurnSoundTime; diff --git a/src/game/server/swarm/asw_mine.cpp b/src/game/server/swarm/asw_mine.cpp index 76b5b99b6..8c1070dcd 100644 --- a/src/game/server/swarm/asw_mine.cpp +++ b/src/game/server/swarm/asw_mine.cpp @@ -103,7 +103,8 @@ void CASW_Mine::Explode() if (GetOwnerEntity()) Msg("Creating firewall with owner %s\n", GetOwnerEntity()->GetClassname()); pFirewall->SetOwnerEntity(GetOwnerEntity()); - pFirewall->SetAbsOrigin( GetAbsOrigin() ); + pFirewall->SetAbsOrigin( GetAbsOrigin() ); + pFirewall->m_bPlacedByMarine = m_bPlacedByMarine; CASW_Marine* pMarine = NULL; if ( GetOwnerEntity() && GetOwnerEntity()->Classify() == CLASS_ASW_MARINE ) diff --git a/src/game/server/swarm/asw_queen.h b/src/game/server/swarm/asw_queen.h index d3595d7ce..3524c1346 100644 --- a/src/game/server/swarm/asw_queen.h +++ b/src/game/server/swarm/asw_queen.h @@ -67,7 +67,7 @@ class CASW_Queen : public CASW_Alien virtual void SpitProjectile(); Vector GetQueenAutoaimVector(Vector &spitSrc, QAngle &angSpit); - virtual bool AllowedToIgnite( void ) { return false; } + bool AllowedToIgnite( CBaseEntity *pAttacker, CBaseEntity *pWeapon, CBaseEntity *pInflictor ) override { return false; } // head turning bool ShouldWatchEnemy(); diff --git a/src/game/server/swarm/asw_shieldbug.cpp b/src/game/server/swarm/asw_shieldbug.cpp index cfff9c38b..b9b12457f 100644 --- a/src/game/server/swarm/asw_shieldbug.cpp +++ b/src/game/server/swarm/asw_shieldbug.cpp @@ -944,9 +944,9 @@ int CASW_Shieldbug::GetBaseHealth() return rd_shieldbug_health.GetInt() + m_nExtraHeath; } -void CASW_Shieldbug::ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon /*= NULL */ ) +void CASW_Shieldbug::ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon, CBaseEntity *pInflictor ) { - BaseClass::ASW_Ignite(MIN(flFlameLifetime, 3.0f), flSize, pAttacker, pDamagingWeapon ); + BaseClass::ASW_Ignite( MIN( flFlameLifetime, 3.0f ), flSize, pAttacker, pDamagingWeapon, pInflictor ); } void CASW_Shieldbug::NPCThink() diff --git a/src/game/server/swarm/asw_shieldbug.h b/src/game/server/swarm/asw_shieldbug.h index 205d1dbf7..8e51a074b 100644 --- a/src/game/server/swarm/asw_shieldbug.h +++ b/src/game/server/swarm/asw_shieldbug.h @@ -42,7 +42,7 @@ class CASW_Shieldbug : public CASW_Alien_Shover, public IShieldbugAutoList int TranslateSchedule( int scheduleType ); bool OverrideMoveFacing( const AILocalMoveGoal_t &move, float flInterval ); void SetTurnActivity(); - virtual void ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon = NULL ); + virtual void ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon, CBaseEntity *pInflictor ); virtual bool ShouldDefend(); float m_fNextHeadhitAttack; float m_fLastHurtTime; diff --git a/src/game/server/swarm/asw_simple_alien.cpp b/src/game/server/swarm/asw_simple_alien.cpp index aeb813fa6..1b2fbe7fe 100644 --- a/src/game/server/swarm/asw_simple_alien.cpp +++ b/src/game/server/swarm/asw_simple_alien.cpp @@ -859,9 +859,9 @@ void CASW_Simple_Alien::ClearAlienOrders() m_bFailedMoveTo = false; } -void CASW_Simple_Alien::ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon ) +void CASW_Simple_Alien::ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon, CBaseEntity *pInflictor ) { - if ( AllowedToIgnite() ) + if ( AllowedToIgnite( pAttacker, pDamagingWeapon, pInflictor ) ) { if ( IsOnFire() ) return; diff --git a/src/game/server/swarm/asw_simple_alien.h b/src/game/server/swarm/asw_simple_alien.h index f68a0744c..c9eefd62e 100644 --- a/src/game/server/swarm/asw_simple_alien.h +++ b/src/game/server/swarm/asw_simple_alien.h @@ -136,19 +136,19 @@ class CASW_Simple_Alien : public CBaseAnimating, public IASW_Spawnable_NPC virtual void SetHealthByDifficultyLevel(); // unused parts of the interface - CAI_BaseNPC* GetNPC() { return NULL; } - virtual bool CanStartBurrowed() { return false; } - virtual void StartBurrowed() { } - virtual void SetUnburrowActivity( string_t iszActivityName ) { } - virtual void SetUnburrowIdleActivity( string_t iszActivityName ) { } - virtual void MoveAside() { } - virtual void ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon ); - virtual void ElectroStun( float flStunTime ) { } - virtual void OnSwarmSensed(int iDistance) { } - virtual void OnSwarmSenseEntity(CBaseEntity* pEnt) { } - virtual bool AllowedToIgnite() { return true; } - virtual void SetHoldoutAlien() { m_bHoldoutAlien = true; } - virtual bool IsHoldoutAlien() { return m_bHoldoutAlien; } + CAI_BaseNPC *GetNPC() override { return NULL; } + virtual bool CanStartBurrowed() override { return false; } + virtual void StartBurrowed() override { } + virtual void SetUnburrowActivity( string_t iszActivityName ) override { } + virtual void SetUnburrowIdleActivity( string_t iszActivityName ) override { } + virtual void MoveAside() override { } + virtual void ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon, CBaseEntity *pInflictor ) override; + virtual void ElectroStun( float flStunTime ) override { } + virtual void OnSwarmSensed(int iDistance) override { } + virtual void OnSwarmSenseEntity(CBaseEntity* pEnt) override { } + virtual bool AllowedToIgnite( CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon, CBaseEntity *pInflictor ) { return true; } + virtual void SetHoldoutAlien() override { m_bHoldoutAlien = true; } + virtual bool IsHoldoutAlien() override { return m_bHoldoutAlien; } // debug virtual int DrawDebugTextOverlays(); diff --git a/src/game/server/swarm/iasw_spawnable_npc.h b/src/game/server/swarm/iasw_spawnable_npc.h index f61f57d69..4407da5f4 100644 --- a/src/game/server/swarm/iasw_spawnable_npc.h +++ b/src/game/server/swarm/iasw_spawnable_npc.h @@ -30,7 +30,7 @@ abstract_class IASW_Spawnable_NPC virtual AlienOrder_t GetAlienOrders() = 0; // this means the spawnable is blocking a spawn point and should try to move out of the way virtual void MoveAside() = 0; - virtual void ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon = NULL ) = 0; + virtual void ASW_Ignite( float flFlameLifetime, float flSize, CBaseEntity *pAttacker, CBaseEntity *pDamagingWeapon, CBaseEntity *pInflictor ) = 0; virtual void ElectroStun( float flStuntime ) = 0; virtual void OnSwarmSensed(int iDistance) = 0; virtual void OnSwarmSenseEntity( CBaseEntity *pEnt ) = 0; diff --git a/src/game/shared/swarm/asw_deathmatch_mode.cpp b/src/game/shared/swarm/asw_deathmatch_mode.cpp index 8174d2b69..2f0970275 100644 --- a/src/game/shared/swarm/asw_deathmatch_mode.cpp +++ b/src/game/shared/swarm/asw_deathmatch_mode.cpp @@ -73,6 +73,7 @@ extern ConVar asw_world_healthbars; extern ConVar asw_world_usingbars; extern ConVar asw_marine_rolls; extern ConVar asw_vindicator_grenade_fuse; +extern ConVar asw_marine_roll_through_firewall; extern ConVar rd_default_weapon; extern ConVar rd_chatter_about_ff; extern ConVar rd_chatter_about_marine_death; @@ -193,6 +194,7 @@ void CASW_Deathmatch_Mode::ApplyDeathmatchConVars() SaveSetConvar( asw_marine_death_protection, 0 ); // disable 1 HP protection SaveSetConvar( asw_vindicator_grenade_fuse, 1.0f ); + SaveSetConvar( asw_marine_roll_through_firewall, 0 ); SaveSetConvar( rd_chatter_about_ff, 0 ); SaveSetConvar( rd_chatter_about_marine_death, 0 ); diff --git a/src/game/shared/swarm/asw_marine_shared.cpp b/src/game/shared/swarm/asw_marine_shared.cpp index ae604aaf2..25b115e05 100644 --- a/src/game/shared/swarm/asw_marine_shared.cpp +++ b/src/game/shared/swarm/asw_marine_shared.cpp @@ -602,7 +602,7 @@ void CASW_Marine::DoDamagePowerupEffects( CBaseEntity *pTarget, CTakeDamageInfo IASW_Spawnable_NPC *pSpawnableNPC = dynamic_cast( pTarget ); if ( pSpawnableNPC ) { - pSpawnableNPC->ASW_Ignite( 2.0f, 0, info.GetAttacker(), info.GetWeapon() ); + pSpawnableNPC->ASW_Ignite( 2.0f, 0, info.GetAttacker(), info.GetWeapon(), info.GetInflictor() ); } }