From 8cf78e118226ec48a7eeca3a1b3c30d03d988258 Mon Sep 17 00:00:00 2001 From: kitsune Date: Thu, 16 Oct 2025 06:48:45 +0200 Subject: [PATCH 01/14] func_asw_fade: add runtime IO inputs for CollideWithGrenades and CollideWithMarines --- reactivedrop/fgd/reactivedrop.fgd | 2 ++ src/game/client/swarm/c_func_asw_fade.cpp | 1 + src/game/client/swarm/c_func_asw_fade.h | 1 + src/game/server/swarm/func_asw_fade.cpp | 7 ++++--- src/game/server/swarm/func_asw_fade.h | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/reactivedrop/fgd/reactivedrop.fgd b/reactivedrop/fgd/reactivedrop.fgd index 2694e4023..4018f27aa 100644 --- a/reactivedrop/fgd/reactivedrop.fgd +++ b/reactivedrop/fgd/reactivedrop.fgd @@ -149,6 +149,8 @@ input SetExcluded( string ) : "Change the NPC class excluded from collisions" input SetInvert( integer ) : "Set the state of inversion for NPC class exclusion (0 or 1)" input AllowFade( integer ) : "Enable or disable fading (0 or 1)" + input CollideWithGrenades( integer ) : "Change CollideWithGrenades at runtime (0, 1 or 2)" + input CollideWithMarines( integer ) : "Change CollideWithMarines at runtime (0 or 1)" ] @PointClass base(prop_dynamic_base, EnableDisable) sphere(fademindist) sphere(fademaxdist) studioprop() = prop_asw_fade : diff --git a/src/game/client/swarm/c_func_asw_fade.cpp b/src/game/client/swarm/c_func_asw_fade.cpp index 5e12f249f..a98c74e78 100644 --- a/src/game/client/swarm/c_func_asw_fade.cpp +++ b/src/game/client/swarm/c_func_asw_fade.cpp @@ -6,6 +6,7 @@ IMPLEMENT_CLIENTCLASS_DT( C_Func_ASW_Fade, DT_Func_ASW_Fade, CFunc_ASW_Fade ) RecvPropInt( RECVINFO( m_nFadeOpacity ) ), + RecvPropInt( RECVINFO( m_iCollideWithGrenades ) ), RecvPropBool( RECVINFO( m_bAllowFade ) ), RecvPropBool( RECVINFO( m_bHasProxies ) ), RecvPropBool( RECVINFO( m_bCollideWithMarines ) ), diff --git a/src/game/client/swarm/c_func_asw_fade.h b/src/game/client/swarm/c_func_asw_fade.h index 973a34e8b..d21bb33e4 100644 --- a/src/game/client/swarm/c_func_asw_fade.h +++ b/src/game/client/swarm/c_func_asw_fade.h @@ -17,6 +17,7 @@ class C_Func_ASW_Fade : public C_FuncBrush, public IASW_Fade_List IMPLEMENT_ASW_FADE_LIST( GetAbsOrigin() ); CNetworkVar( bool, m_bCollideWithMarines ); + CNetworkVar( byte, m_iCollideWithGrenades ); }; #endif // _INCLUDED_C_FUNC_ASW_FADE_H diff --git a/src/game/server/swarm/func_asw_fade.cpp b/src/game/server/swarm/func_asw_fade.cpp index 6d9ab4196..1eed44848 100644 --- a/src/game/server/swarm/func_asw_fade.cpp +++ b/src/game/server/swarm/func_asw_fade.cpp @@ -12,17 +12,18 @@ LINK_ENTITY_TO_CLASS( func_asw_fade, CFunc_ASW_Fade ); BEGIN_DATADESC( CFunc_ASW_Fade ) DEFINE_FIELD( m_bHasProxies, FIELD_BOOLEAN ), - DEFINE_KEYFIELD( m_iCollideWithGrenades, FIELD_CHARACTER, "CollideWithGrenades" ), - DEFINE_KEYFIELD( m_bCollideWithMarines, FIELD_BOOLEAN, "CollideWithMarines" ), DEFINE_KEYFIELD( m_nFadeOpacity, FIELD_CHARACTER, "fade_opacity" ), + DEFINE_INPUT( m_iCollideWithGrenades, FIELD_CHARACTER, "CollideWithGrenades" ), + DEFINE_INPUT( m_bCollideWithMarines, FIELD_BOOLEAN, "CollideWithMarines" ), DEFINE_INPUT( m_bAllowFade, FIELD_BOOLEAN, "AllowFade" ), END_DATADESC() IMPLEMENT_SERVERCLASS_ST( CFunc_ASW_Fade, DT_Func_ASW_Fade ) SendPropInt( SENDINFO( m_nFadeOpacity ), 8, SPROP_UNSIGNED ), + SendPropInt( SENDINFO( m_iCollideWithGrenades ), 2, SPROP_UNSIGNED ), + SendPropBool( SENDINFO( m_bCollideWithMarines ) ), SendPropBool( SENDINFO( m_bAllowFade ) ), SendPropBool( SENDINFO( m_bHasProxies ) ), - SendPropBool( SENDINFO( m_bCollideWithMarines ) ), END_SEND_TABLE() CFunc_ASW_Fade::CFunc_ASW_Fade() diff --git a/src/game/server/swarm/func_asw_fade.h b/src/game/server/swarm/func_asw_fade.h index 055fb4e7c..1b265e25d 100644 --- a/src/game/server/swarm/func_asw_fade.h +++ b/src/game/server/swarm/func_asw_fade.h @@ -28,7 +28,7 @@ class CFunc_ASW_Fade : public CFuncBrush // 0 = only when grenade spawns above the brush // 1 = always // 2 = never - byte m_iCollideWithGrenades; + CNetworkVar( byte, m_iCollideWithGrenades ); CNetworkVar( bool, m_bCollideWithMarines ); CNetworkVar( byte, m_nFadeOpacity ); CNetworkVar( bool, m_bAllowFade ); From 2fcee002b9ff25470814a12d17b6f02cded5c06d Mon Sep 17 00:00:00 2001 From: kitsune Date: Thu, 16 Oct 2025 08:23:29 +0200 Subject: [PATCH 02/14] update --- reactivedrop/fgd/reactivedrop.fgd | 4 +- src/game/server/swarm/func_asw_fade.cpp | 61 +++++++++++++++++++++---- src/game/server/swarm/func_asw_fade.h | 3 ++ 3 files changed, 56 insertions(+), 12 deletions(-) diff --git a/reactivedrop/fgd/reactivedrop.fgd b/reactivedrop/fgd/reactivedrop.fgd index 4018f27aa..31bf59bef 100644 --- a/reactivedrop/fgd/reactivedrop.fgd +++ b/reactivedrop/fgd/reactivedrop.fgd @@ -149,8 +149,8 @@ input SetExcluded( string ) : "Change the NPC class excluded from collisions" input SetInvert( integer ) : "Set the state of inversion for NPC class exclusion (0 or 1)" input AllowFade( integer ) : "Enable or disable fading (0 or 1)" - input CollideWithGrenades( integer ) : "Change CollideWithGrenades at runtime (0, 1 or 2)" - input CollideWithMarines( integer ) : "Change CollideWithMarines at runtime (0 or 1)" + input SetCollideWithGrenades(integer) : "Change CollideWithGrenades at runtime (0, 1 or 2)" + input SetCollideWithMarines(integer) : "Enable or disable marine collisions (0 or 1)" ] @PointClass base(prop_dynamic_base, EnableDisable) sphere(fademindist) sphere(fademaxdist) studioprop() = prop_asw_fade : diff --git a/src/game/server/swarm/func_asw_fade.cpp b/src/game/server/swarm/func_asw_fade.cpp index 1eed44848..3dd25a2dc 100644 --- a/src/game/server/swarm/func_asw_fade.cpp +++ b/src/game/server/swarm/func_asw_fade.cpp @@ -11,19 +11,22 @@ LINK_ENTITY_TO_CLASS( func_asw_fade, CFunc_ASW_Fade ); BEGIN_DATADESC( CFunc_ASW_Fade ) - DEFINE_FIELD( m_bHasProxies, FIELD_BOOLEAN ), - DEFINE_KEYFIELD( m_nFadeOpacity, FIELD_CHARACTER, "fade_opacity" ), - DEFINE_INPUT( m_iCollideWithGrenades, FIELD_CHARACTER, "CollideWithGrenades" ), - DEFINE_INPUT( m_bCollideWithMarines, FIELD_BOOLEAN, "CollideWithMarines" ), - DEFINE_INPUT( m_bAllowFade, FIELD_BOOLEAN, "AllowFade" ), +DEFINE_FIELD( m_bHasProxies, FIELD_BOOLEAN ), +DEFINE_KEYFIELD( m_nFadeOpacity, FIELD_CHARACTER, "fade_opacity" ), +DEFINE_KEYFIELD( m_iCollideWithGrenades, FIELD_CHARACTER, "CollideWithGrenades" ), +DEFINE_KEYFIELD( m_bCollideWithMarines, FIELD_BOOLEAN, "CollideWithMarines" ), +DEFINE_KEYFIELD( m_bAllowFade, FIELD_BOOLEAN, "AllowFade" ), + +DEFINE_INPUTFUNC( FIELD_INTEGER, "SetCollideWithGrenades", InputSetCollideWithGrenades ), +DEFINE_INPUTFUNC( FIELD_BOOLEAN, "SetCollideWithMarines", InputSetCollideWithMarines ), END_DATADESC() IMPLEMENT_SERVERCLASS_ST( CFunc_ASW_Fade, DT_Func_ASW_Fade ) - SendPropInt( SENDINFO( m_nFadeOpacity ), 8, SPROP_UNSIGNED ), - SendPropInt( SENDINFO( m_iCollideWithGrenades ), 2, SPROP_UNSIGNED ), - SendPropBool( SENDINFO( m_bCollideWithMarines ) ), - SendPropBool( SENDINFO( m_bAllowFade ) ), - SendPropBool( SENDINFO( m_bHasProxies ) ), +SendPropInt( SENDINFO( m_nFadeOpacity ), 8, SPROP_UNSIGNED ), +SendPropInt( SENDINFO( m_iCollideWithGrenades ), 2, SPROP_UNSIGNED ), +SendPropBool( SENDINFO( m_bCollideWithMarines ) ), +SendPropBool( SENDINFO( m_bAllowFade ) ), +SendPropBool( SENDINFO( m_bHasProxies ) ), END_SEND_TABLE() CFunc_ASW_Fade::CFunc_ASW_Fade() @@ -72,6 +75,44 @@ void CFunc_ASW_Fade::DisableCollisionsWithMarine( CBaseEntity *pMarine ) } } +void CFunc_ASW_Fade::InputSetCollideWithGrenades( inputdata_t& inputdata ) +{ + m_iCollideWithGrenades = clamp( inputdata.value.Int(), 0, 2 ); + + static const char* pszExplosiveClasses[] = { + "asw_mine", + "npc_zombine", + "asw_rocket", + "grenadespit", + "asw_missile_round", + "asw_grenade_cluster", + "asw_flare_projectile", + "asw_laser_mine", + "asw_grenade_vindicator", + nullptr + }; + + for ( const char** pszClass = pszExplosiveClasses; *pszClass; ++pszClass ) + { + CBaseEntity* pGrenade = NULL; + while ( ( pGrenade = gEntList.FindEntityByClassname( pGrenade, *pszClass ) ) != NULL ) + { + DisableCollisionsWithGrenade( pGrenade ); + } + } +} + +void CFunc_ASW_Fade::InputSetCollideWithMarines( inputdata_t& inputdata ) +{ + m_bCollideWithMarines = !!inputdata.value.Int(); + + CBaseEntity* pMarine = NULL; + while ( ( pMarine = gEntList.FindEntityByClassname( pMarine, "asw_marine" ) ) != NULL ) + { + DisableCollisionsWithMarine( pMarine ); + } +} + bool CFunc_ASW_Fade::ShouldFade( CASW_Inhabitable_NPC *pNPC ) { if ( !m_bAllowFade || !pNPC || !pNPC->IsInhabited() || !pNPC->GetCommander() ) diff --git a/src/game/server/swarm/func_asw_fade.h b/src/game/server/swarm/func_asw_fade.h index 1b265e25d..6d5b2c8ba 100644 --- a/src/game/server/swarm/func_asw_fade.h +++ b/src/game/server/swarm/func_asw_fade.h @@ -24,6 +24,9 @@ class CFunc_ASW_Fade : public CFuncBrush static void DisableCollisionsWithGrenade( CBaseEntity *pGrenade ); static void DisableCollisionsWithMarine( CBaseEntity *pMarine ); + void InputSetCollideWithGrenades( inputdata_t& inputdata ); + void InputSetCollideWithMarines( inputdata_t& inputdata ); + CNetworkVar( bool, m_bHasProxies ); // 0 = only when grenade spawns above the brush // 1 = always From f03da22b9d81bd112e18c0746cbf9e3941d49ba7 Mon Sep 17 00:00:00 2001 From: kitsune Date: Thu, 16 Oct 2025 08:36:06 +0200 Subject: [PATCH 03/14] update --- src/game/server/swarm/func_asw_fade.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/game/server/swarm/func_asw_fade.cpp b/src/game/server/swarm/func_asw_fade.cpp index 3dd25a2dc..94b7e4b8c 100644 --- a/src/game/server/swarm/func_asw_fade.cpp +++ b/src/game/server/swarm/func_asw_fade.cpp @@ -11,22 +11,21 @@ LINK_ENTITY_TO_CLASS( func_asw_fade, CFunc_ASW_Fade ); BEGIN_DATADESC( CFunc_ASW_Fade ) -DEFINE_FIELD( m_bHasProxies, FIELD_BOOLEAN ), -DEFINE_KEYFIELD( m_nFadeOpacity, FIELD_CHARACTER, "fade_opacity" ), -DEFINE_KEYFIELD( m_iCollideWithGrenades, FIELD_CHARACTER, "CollideWithGrenades" ), -DEFINE_KEYFIELD( m_bCollideWithMarines, FIELD_BOOLEAN, "CollideWithMarines" ), -DEFINE_KEYFIELD( m_bAllowFade, FIELD_BOOLEAN, "AllowFade" ), - -DEFINE_INPUTFUNC( FIELD_INTEGER, "SetCollideWithGrenades", InputSetCollideWithGrenades ), -DEFINE_INPUTFUNC( FIELD_BOOLEAN, "SetCollideWithMarines", InputSetCollideWithMarines ), + DEFINE_FIELD( m_bHasProxies, FIELD_BOOLEAN ), + DEFINE_KEYFIELD( m_nFadeOpacity, FIELD_CHARACTER, "fade_opacity" ), + DEFINE_KEYFIELD( m_iCollideWithGrenades, FIELD_CHARACTER, "CollideWithGrenades" ), + DEFINE_KEYFIELD( m_bCollideWithMarines, FIELD_BOOLEAN, "CollideWithMarines" ), + DEFINE_INPUT( m_bAllowFade, FIELD_BOOLEAN, "AllowFade" ), + DEFINE_INPUTFUNC( FIELD_INTEGER, "SetCollideWithGrenades", InputSetCollideWithGrenades ), + DEFINE_INPUTFUNC( FIELD_BOOLEAN, "SetCollideWithMarines", InputSetCollideWithMarines ), END_DATADESC() IMPLEMENT_SERVERCLASS_ST( CFunc_ASW_Fade, DT_Func_ASW_Fade ) -SendPropInt( SENDINFO( m_nFadeOpacity ), 8, SPROP_UNSIGNED ), -SendPropInt( SENDINFO( m_iCollideWithGrenades ), 2, SPROP_UNSIGNED ), -SendPropBool( SENDINFO( m_bCollideWithMarines ) ), -SendPropBool( SENDINFO( m_bAllowFade ) ), -SendPropBool( SENDINFO( m_bHasProxies ) ), + SendPropInt( SENDINFO( m_nFadeOpacity ), 8, SPROP_UNSIGNED ), + SendPropInt( SENDINFO( m_iCollideWithGrenades ), 2, SPROP_UNSIGNED ), + SendPropBool( SENDINFO( m_bCollideWithMarines ) ), + SendPropBool( SENDINFO( m_bAllowFade ) ), + SendPropBool( SENDINFO( m_bHasProxies ) ), END_SEND_TABLE() CFunc_ASW_Fade::CFunc_ASW_Fade() From 09160de8f0ba50aad83ea4c33a618ea8d35d38cb Mon Sep 17 00:00:00 2001 From: kitsune Date: Thu, 16 Oct 2025 09:42:51 +0200 Subject: [PATCH 04/14] update --- src/game/server/swarm/asw_gas_grenade_projectile.cpp | 3 +++ src/game/server/swarm/func_asw_fade.cpp | 1 + 2 files changed, 4 insertions(+) diff --git a/src/game/server/swarm/asw_gas_grenade_projectile.cpp b/src/game/server/swarm/asw_gas_grenade_projectile.cpp index ade399da7..793e293a6 100644 --- a/src/game/server/swarm/asw_gas_grenade_projectile.cpp +++ b/src/game/server/swarm/asw_gas_grenade_projectile.cpp @@ -11,6 +11,7 @@ #include "particle_parse.h" #include "asw_generic_emitter_entity.h" #include "asw_radiation_volume.h" +#include "func_asw_fade.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" @@ -103,6 +104,8 @@ void CASW_Gas_Grenade_Projectile::Spawn( void ) SetCollisionGroup( ASW_COLLISION_GROUP_IGNORE_NPCS ); + CFunc_ASW_Fade::DisableCollisionsWithGrenade( this ); + // Tumble in air QAngle vecAngVelocity( 0, random->RandomFloat ( -100, -500 ), 0 ); SetLocalAngularVelocity( vecAngVelocity ); diff --git a/src/game/server/swarm/func_asw_fade.cpp b/src/game/server/swarm/func_asw_fade.cpp index 94b7e4b8c..2dbfb9e37 100644 --- a/src/game/server/swarm/func_asw_fade.cpp +++ b/src/game/server/swarm/func_asw_fade.cpp @@ -88,6 +88,7 @@ void CFunc_ASW_Fade::InputSetCollideWithGrenades( inputdata_t& inputdata ) "asw_flare_projectile", "asw_laser_mine", "asw_grenade_vindicator", + "asw_gas_grenade_projectile", nullptr }; From 9902366ad117ed9725b83dfee98123bb73e04a38 Mon Sep 17 00:00:00 2001 From: kitsune Date: Thu, 16 Oct 2025 12:20:21 +0200 Subject: [PATCH 05/14] update --- src/game/server/swarm/func_asw_fade.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/server/swarm/func_asw_fade.cpp b/src/game/server/swarm/func_asw_fade.cpp index 2dbfb9e37..65b85f99b 100644 --- a/src/game/server/swarm/func_asw_fade.cpp +++ b/src/game/server/swarm/func_asw_fade.cpp @@ -80,7 +80,7 @@ void CFunc_ASW_Fade::InputSetCollideWithGrenades( inputdata_t& inputdata ) static const char* pszExplosiveClasses[] = { "asw_mine", - "npc_zombine", + "npc_grenade_frag", "asw_rocket", "grenadespit", "asw_missile_round", From 986d8ba8fcc6b40ea7b1fb974405c8b172c394ee Mon Sep 17 00:00:00 2001 From: kitsune Date: Thu, 16 Oct 2025 12:26:21 +0200 Subject: [PATCH 06/14] update --- src/game/server/swarm/func_asw_fade.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/game/server/swarm/func_asw_fade.cpp b/src/game/server/swarm/func_asw_fade.cpp index 65b85f99b..8e186015b 100644 --- a/src/game/server/swarm/func_asw_fade.cpp +++ b/src/game/server/swarm/func_asw_fade.cpp @@ -57,6 +57,10 @@ void CFunc_ASW_Fade::DisableCollisionsWithGrenade( CBaseEntity *pGrenade ) { PhysDisableEntityCollisions( pCeiling, pGrenade ); } + else + { + PhysEnableEntityCollisions( pCeiling, pGrenade ); + } } } @@ -71,6 +75,10 @@ void CFunc_ASW_Fade::DisableCollisionsWithMarine( CBaseEntity *pMarine ) { PhysDisableEntityCollisions( pCeiling, pMarine ); } + else + { + PhysEnableEntityCollisions( pCeiling, pMarine ); + } } } From 698aeb9e1b2f6024df258ee482ee5998049ee495 Mon Sep 17 00:00:00 2001 From: kitsune Date: Thu, 16 Oct 2025 12:46:29 +0200 Subject: [PATCH 07/14] update --- src/game/server/swarm/func_asw_fade.cpp | 42 ++++++++++++++++--------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/src/game/server/swarm/func_asw_fade.cpp b/src/game/server/swarm/func_asw_fade.cpp index 8e186015b..261f3db5d 100644 --- a/src/game/server/swarm/func_asw_fade.cpp +++ b/src/game/server/swarm/func_asw_fade.cpp @@ -45,43 +45,55 @@ void CFunc_ASW_Fade::Spawn() Assert( m_iCollideWithGrenades <= 2 ); } -void CFunc_ASW_Fade::DisableCollisionsWithGrenade( CBaseEntity *pGrenade ) +void CFunc_ASW_Fade::DisableCollisionsWithGrenade( CBaseEntity* pGrenade ) { - float flGrenadeZ = pGrenade->GetAbsOrigin().z; - string_t iszClassName = AllocPooledString( "func_asw_fade" ); + const float flGrenadeZ = pGrenade->GetAbsOrigin().z; + const string_t iszClassName = AllocPooledString( "func_asw_fade" ); - CFunc_ASW_Fade *pCeiling = NULL; - while ( ( pCeiling = assert_cast< CFunc_ASW_Fade * >( gEntList.FindEntityByClassnameFast( pCeiling, iszClassName ) ) ) != NULL ) + CFunc_ASW_Fade* pCeiling = nullptr; + while ( ( pCeiling = assert_cast( + gEntList.FindEntityByClassnameFast( pCeiling, iszClassName ) ) ) != nullptr ) { - if ( ( pCeiling->m_iCollideWithGrenades == 0 && pCeiling->GetAbsOrigin().z >= flGrenadeZ ) || pCeiling->m_iCollideWithGrenades == 2 ) + const bool bShouldDisable = + ( pCeiling->m_iCollideWithGrenades == 0 && pCeiling->GetAbsOrigin().z >= flGrenadeZ ) || + ( pCeiling->m_iCollideWithGrenades == 2 ); + + const bool bCurrentlyDisabled = PhysEntityCollisionsAreDisabled( pCeiling, pGrenade ); + + if ( bShouldDisable && !bCurrentlyDisabled ) { PhysDisableEntityCollisions( pCeiling, pGrenade ); } - else + else if ( !bShouldDisable && bCurrentlyDisabled ) { PhysEnableEntityCollisions( pCeiling, pGrenade ); - } + } } } -void CFunc_ASW_Fade::DisableCollisionsWithMarine( CBaseEntity *pMarine ) +void CFunc_ASW_Fade::DisableCollisionsWithMarine( CBaseEntity* pMarine ) { - string_t iszClassName = AllocPooledString( "func_asw_fade" ); + const string_t iszClassName = AllocPooledString( "func_asw_fade" ); - CFunc_ASW_Fade *pCeiling = NULL; - while ( ( pCeiling = assert_cast< CFunc_ASW_Fade * >( gEntList.FindEntityByClassnameFast( pCeiling, iszClassName ) ) ) != NULL ) + CFunc_ASW_Fade* pCeiling = nullptr; + while ( ( pCeiling = assert_cast( + gEntList.FindEntityByClassnameFast( pCeiling, iszClassName ) ) ) != nullptr ) { - if ( !pCeiling->m_bCollideWithMarines ) + const bool bShouldDisable = !pCeiling->m_bCollideWithMarines; + const bool bCurrentlyDisabled = PhysEntityCollisionsAreDisabled( pCeiling, pMarine ); + + if ( bShouldDisable && !bCurrentlyDisabled ) { PhysDisableEntityCollisions( pCeiling, pMarine ); } - else + else if ( !bShouldDisable && bCurrentlyDisabled ) { PhysEnableEntityCollisions( pCeiling, pMarine ); - } + } } } + void CFunc_ASW_Fade::InputSetCollideWithGrenades( inputdata_t& inputdata ) { m_iCollideWithGrenades = clamp( inputdata.value.Int(), 0, 2 ); From dd23db8e78dcb236f22f6b83fcd5c5a6f80e110f Mon Sep 17 00:00:00 2001 From: kitsune Date: Thu, 16 Oct 2025 13:32:25 +0200 Subject: [PATCH 08/14] polishing --- src/game/server/hl2/grenade_spit.cpp | 2 +- src/game/server/hl2/npc_zombine.cpp | 2 +- src/game/server/swarm/asw_flare_projectile.cpp | 2 +- .../server/swarm/asw_gas_grenade_projectile.cpp | 2 +- src/game/server/swarm/asw_grenade_cluster.cpp | 2 +- src/game/server/swarm/asw_grenade_vindicator.cpp | 2 +- src/game/server/swarm/asw_laser_mine.cpp | 2 +- src/game/server/swarm/asw_marine.cpp | 2 +- src/game/server/swarm/asw_mine.cpp | 2 +- src/game/server/swarm/asw_rocket.cpp | 2 +- src/game/server/swarm/func_asw_fade.cpp | 16 ++++++++-------- src/game/server/swarm/func_asw_fade.h | 8 ++++---- .../shared/swarm/asw_missile_round_shared.cpp | 2 +- 13 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/game/server/hl2/grenade_spit.cpp b/src/game/server/hl2/grenade_spit.cpp index 8b194bcd1..88ffc2be8 100644 --- a/src/game/server/hl2/grenade_spit.cpp +++ b/src/game/server/hl2/grenade_spit.cpp @@ -71,7 +71,7 @@ void CGrenadeSpit::Spawn( void ) SetFriction( 0.8f ); SetCollisionGroup( ASW_COLLISION_GROUP_NPC_GRENADES ); - CFunc_ASW_Fade::DisableCollisionsWithGrenade( this ); + CFunc_ASW_Fade::ApplyGrenadeCollisionRules( this ); AddEFlags( EFL_FORCE_CHECK_TRANSMIT ); diff --git a/src/game/server/hl2/npc_zombine.cpp b/src/game/server/hl2/npc_zombine.cpp index 19c9cf6de..6748cdf54 100644 --- a/src/game/server/hl2/npc_zombine.cpp +++ b/src/game/server/hl2/npc_zombine.cpp @@ -379,7 +379,7 @@ void CNPC_Zombine::DropGrenade( Vector vDir ) m_hGrenade->SetMoveType( MOVETYPE_VPHYSICS ); m_hGrenade->SetSolid( SOLID_VPHYSICS ); m_hGrenade->SetCollisionGroup( ASW_COLLISION_GROUP_GRENADES ); - CFunc_ASW_Fade::DisableCollisionsWithGrenade( m_hGrenade ); + CFunc_ASW_Fade::ApplyGrenadeCollisionRules( m_hGrenade ); m_hGrenade->CreateVPhysics(); } diff --git a/src/game/server/swarm/asw_flare_projectile.cpp b/src/game/server/swarm/asw_flare_projectile.cpp index 9ffa34c49..a81a2fce7 100644 --- a/src/game/server/swarm/asw_flare_projectile.cpp +++ b/src/game/server/swarm/asw_flare_projectile.cpp @@ -162,7 +162,7 @@ void CASW_Flare_Projectile::Spawn( void ) AddFlag( FL_OBJECT ); SetCollisionGroup( ASW_COLLISION_GROUP_GRENADES ); - CFunc_ASW_Fade::DisableCollisionsWithGrenade( this ); + CFunc_ASW_Fade::ApplyGrenadeCollisionRules( this ); // Tumble in air QAngle vecAngVelocity( 0, random->RandomFloat ( -100, -500 ), 0 ); diff --git a/src/game/server/swarm/asw_gas_grenade_projectile.cpp b/src/game/server/swarm/asw_gas_grenade_projectile.cpp index 793e293a6..c236e589e 100644 --- a/src/game/server/swarm/asw_gas_grenade_projectile.cpp +++ b/src/game/server/swarm/asw_gas_grenade_projectile.cpp @@ -104,7 +104,7 @@ void CASW_Gas_Grenade_Projectile::Spawn( void ) SetCollisionGroup( ASW_COLLISION_GROUP_IGNORE_NPCS ); - CFunc_ASW_Fade::DisableCollisionsWithGrenade( this ); + CFunc_ASW_Fade::ApplyGrenadeCollisionRules( this ); // Tumble in air QAngle vecAngVelocity( 0, random->RandomFloat ( -100, -500 ), 0 ); diff --git a/src/game/server/swarm/asw_grenade_cluster.cpp b/src/game/server/swarm/asw_grenade_cluster.cpp index 00ca55cf3..21ea824f0 100644 --- a/src/game/server/swarm/asw_grenade_cluster.cpp +++ b/src/game/server/swarm/asw_grenade_cluster.cpp @@ -100,7 +100,7 @@ void CASW_Grenade_Cluster::Spawn( void ) SetFriction( asw_vindicator_grenade_friction.GetFloat() ); SetElasticity( asw_vindicator_grenade_elasticity.GetFloat() ); SetCollisionGroup( ASW_COLLISION_GROUP_GRENADES ); - CFunc_ASW_Fade::DisableCollisionsWithGrenade( this ); + CFunc_ASW_Fade::ApplyGrenadeCollisionRules( this ); SetTouch( &CASW_Grenade_Cluster::VGrenadeTouch ); diff --git a/src/game/server/swarm/asw_grenade_vindicator.cpp b/src/game/server/swarm/asw_grenade_vindicator.cpp index c92e41560..0ed097d21 100644 --- a/src/game/server/swarm/asw_grenade_vindicator.cpp +++ b/src/game/server/swarm/asw_grenade_vindicator.cpp @@ -95,7 +95,7 @@ void CASW_Grenade_Vindicator::Spawn( void ) SetFriction( asw_vindicator_grenade_friction.GetFloat() ); SetElasticity( asw_vindicator_grenade_elasticity.GetFloat() ); SetCollisionGroup( ASW_COLLISION_GROUP_GRENADES ); - CFunc_ASW_Fade::DisableCollisionsWithGrenade( this ); + CFunc_ASW_Fade::ApplyGrenadeCollisionRules( this ); //CreateVPhysics(); SetTouch( &CASW_Grenade_Vindicator::VGrenadeTouch ); diff --git a/src/game/server/swarm/asw_laser_mine.cpp b/src/game/server/swarm/asw_laser_mine.cpp index 0f6a4f6e9..190fd3f66 100644 --- a/src/game/server/swarm/asw_laser_mine.cpp +++ b/src/game/server/swarm/asw_laser_mine.cpp @@ -82,7 +82,7 @@ void CASW_Laser_Mine::Spawn( void ) AddEffects( EF_NOSHADOW | EF_NORECEIVESHADOW ); SetCollisionGroup( ASW_COLLISION_GROUP_GRENADES ); - CFunc_ASW_Fade::DisableCollisionsWithGrenade( this ); + CFunc_ASW_Fade::ApplyGrenadeCollisionRules( this ); SetThink( &CASW_Laser_Mine::LaserThink ); SetNextThink( gpGlobals->curtime + 0.1f ); diff --git a/src/game/server/swarm/asw_marine.cpp b/src/game/server/swarm/asw_marine.cpp index aebc71d8b..14171720c 100644 --- a/src/game/server/swarm/asw_marine.cpp +++ b/src/game/server/swarm/asw_marine.cpp @@ -890,7 +890,7 @@ void CASW_Marine::Spawn( void ) UTIL_SetSize( this, GetHullMins(), GetHullMaxs() ); - CFunc_ASW_Fade::DisableCollisionsWithMarine( this ); + CFunc_ASW_Fade::ApplyMarineCollisionRules( this ); } unsigned int CASW_Marine::PhysicsSolidMaskForEntity( void ) const diff --git a/src/game/server/swarm/asw_mine.cpp b/src/game/server/swarm/asw_mine.cpp index 8c1070dcd..70443d668 100644 --- a/src/game/server/swarm/asw_mine.cpp +++ b/src/game/server/swarm/asw_mine.cpp @@ -56,7 +56,7 @@ void CASW_Mine::Spawn( void ) SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_TRIGGER ); SetCollisionGroup( ASW_COLLISION_GROUP_GRENADES ); - CFunc_ASW_Fade::DisableCollisionsWithGrenade( this ); + CFunc_ASW_Fade::ApplyGrenadeCollisionRules( this ); SetMoveType( MOVETYPE_FLYGRAVITY ); m_takedamage = DAMAGE_NO; m_bPrimed = false; diff --git a/src/game/server/swarm/asw_rocket.cpp b/src/game/server/swarm/asw_rocket.cpp index 7b4d5c7c9..c722e4a05 100644 --- a/src/game/server/swarm/asw_rocket.cpp +++ b/src/game/server/swarm/asw_rocket.cpp @@ -103,7 +103,7 @@ void CASW_Rocket::Spawn( void ) SetTouch( &CASW_Rocket::MissileTouch ); SetCollisionGroup( ASW_COLLISION_GROUP_PLAYER_MISSILE ); - CFunc_ASW_Fade::DisableCollisionsWithGrenade( this ); + CFunc_ASW_Fade::ApplyGrenadeCollisionRules( this ); SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE ); SetThink( &CASW_Rocket::IgniteThink ); diff --git a/src/game/server/swarm/func_asw_fade.cpp b/src/game/server/swarm/func_asw_fade.cpp index 261f3db5d..ddd66e028 100644 --- a/src/game/server/swarm/func_asw_fade.cpp +++ b/src/game/server/swarm/func_asw_fade.cpp @@ -16,8 +16,8 @@ BEGIN_DATADESC( CFunc_ASW_Fade ) DEFINE_KEYFIELD( m_iCollideWithGrenades, FIELD_CHARACTER, "CollideWithGrenades" ), DEFINE_KEYFIELD( m_bCollideWithMarines, FIELD_BOOLEAN, "CollideWithMarines" ), DEFINE_INPUT( m_bAllowFade, FIELD_BOOLEAN, "AllowFade" ), - DEFINE_INPUTFUNC( FIELD_INTEGER, "SetCollideWithGrenades", InputSetCollideWithGrenades ), - DEFINE_INPUTFUNC( FIELD_BOOLEAN, "SetCollideWithMarines", InputSetCollideWithMarines ), + DEFINE_INPUTFUNC( FIELD_INTEGER, "SetCollideWithGrenades", SetGrenadeCollisionRules ), + DEFINE_INPUTFUNC( FIELD_BOOLEAN, "SetCollideWithMarines", SetMarineCollisionRules ), END_DATADESC() IMPLEMENT_SERVERCLASS_ST( CFunc_ASW_Fade, DT_Func_ASW_Fade ) @@ -45,7 +45,7 @@ void CFunc_ASW_Fade::Spawn() Assert( m_iCollideWithGrenades <= 2 ); } -void CFunc_ASW_Fade::DisableCollisionsWithGrenade( CBaseEntity* pGrenade ) +void CFunc_ASW_Fade::ApplyGrenadeCollisionRules( CBaseEntity* pGrenade ) { const float flGrenadeZ = pGrenade->GetAbsOrigin().z; const string_t iszClassName = AllocPooledString( "func_asw_fade" ); @@ -71,7 +71,7 @@ void CFunc_ASW_Fade::DisableCollisionsWithGrenade( CBaseEntity* pGrenade ) } } -void CFunc_ASW_Fade::DisableCollisionsWithMarine( CBaseEntity* pMarine ) +void CFunc_ASW_Fade::ApplyMarineCollisionRules( CBaseEntity* pMarine ) { const string_t iszClassName = AllocPooledString( "func_asw_fade" ); @@ -94,7 +94,7 @@ void CFunc_ASW_Fade::DisableCollisionsWithMarine( CBaseEntity* pMarine ) } -void CFunc_ASW_Fade::InputSetCollideWithGrenades( inputdata_t& inputdata ) +void CFunc_ASW_Fade::SetGrenadeCollisionRules( inputdata_t& inputdata ) { m_iCollideWithGrenades = clamp( inputdata.value.Int(), 0, 2 ); @@ -117,19 +117,19 @@ void CFunc_ASW_Fade::InputSetCollideWithGrenades( inputdata_t& inputdata ) CBaseEntity* pGrenade = NULL; while ( ( pGrenade = gEntList.FindEntityByClassname( pGrenade, *pszClass ) ) != NULL ) { - DisableCollisionsWithGrenade( pGrenade ); + ApplyGrenadeCollisionRules( pGrenade ); } } } -void CFunc_ASW_Fade::InputSetCollideWithMarines( inputdata_t& inputdata ) +void CFunc_ASW_Fade::SetMarineCollisionRules( inputdata_t& inputdata ) { m_bCollideWithMarines = !!inputdata.value.Int(); CBaseEntity* pMarine = NULL; while ( ( pMarine = gEntList.FindEntityByClassname( pMarine, "asw_marine" ) ) != NULL ) { - DisableCollisionsWithMarine( pMarine ); + ApplyMarineCollisionRules( pMarine ); } } diff --git a/src/game/server/swarm/func_asw_fade.h b/src/game/server/swarm/func_asw_fade.h index 6d5b2c8ba..1745358db 100644 --- a/src/game/server/swarm/func_asw_fade.h +++ b/src/game/server/swarm/func_asw_fade.h @@ -21,11 +21,11 @@ class CFunc_ASW_Fade : public CFuncBrush virtual void Spawn() override; bool ShouldFade( CASW_Inhabitable_NPC *pNPC ); - static void DisableCollisionsWithGrenade( CBaseEntity *pGrenade ); - static void DisableCollisionsWithMarine( CBaseEntity *pMarine ); + static void ApplyGrenadeCollisionRules( CBaseEntity *pGrenade ); + static void ApplyMarineCollisionRules( CBaseEntity *pMarine ); - void InputSetCollideWithGrenades( inputdata_t& inputdata ); - void InputSetCollideWithMarines( inputdata_t& inputdata ); + void SetGrenadeCollisionRules( inputdata_t& inputdata ); + void SetMarineCollisionRules( inputdata_t& inputdata ); CNetworkVar( bool, m_bHasProxies ); // 0 = only when grenade spawns above the brush diff --git a/src/game/shared/swarm/asw_missile_round_shared.cpp b/src/game/shared/swarm/asw_missile_round_shared.cpp index 4b4e3f106..a86460eb8 100644 --- a/src/game/shared/swarm/asw_missile_round_shared.cpp +++ b/src/game/shared/swarm/asw_missile_round_shared.cpp @@ -95,7 +95,7 @@ void CASW_Missile_Round::Spawn( void ) SetSolid( SOLID_NONE ); SetGravity( m_ShotDef.m_flGravity ); SetCollisionGroup( ASW_COLLISION_GROUP_ALIEN_MISSILE ); - CFunc_ASW_Fade::DisableCollisionsWithGrenade( this ); + CFunc_ASW_Fade::ApplyGrenadeCollisionRules( this ); SetTouch( &CASW_Missile_Round::Touch ); From ce98c293214a9027bb4b6acd8647087a637a9bc3 Mon Sep 17 00:00:00 2001 From: Grimowy <87246477+Kitsune44@users.noreply.github.com> Date: Sat, 18 Oct 2025 17:34:47 +0200 Subject: [PATCH 09/14] Update src/game/client/swarm/c_func_asw_fade.h Co-authored-by: Ben Lubar --- src/game/client/swarm/c_func_asw_fade.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/game/client/swarm/c_func_asw_fade.h b/src/game/client/swarm/c_func_asw_fade.h index d21bb33e4..973a34e8b 100644 --- a/src/game/client/swarm/c_func_asw_fade.h +++ b/src/game/client/swarm/c_func_asw_fade.h @@ -17,7 +17,6 @@ class C_Func_ASW_Fade : public C_FuncBrush, public IASW_Fade_List IMPLEMENT_ASW_FADE_LIST( GetAbsOrigin() ); CNetworkVar( bool, m_bCollideWithMarines ); - CNetworkVar( byte, m_iCollideWithGrenades ); }; #endif // _INCLUDED_C_FUNC_ASW_FADE_H From ad251798092e3e01bc9e69ecfb7fdbe5a2cca932 Mon Sep 17 00:00:00 2001 From: Grimowy <87246477+Kitsune44@users.noreply.github.com> Date: Sat, 18 Oct 2025 17:34:58 +0200 Subject: [PATCH 10/14] Update src/game/client/swarm/c_func_asw_fade.cpp Co-authored-by: Ben Lubar --- src/game/client/swarm/c_func_asw_fade.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/game/client/swarm/c_func_asw_fade.cpp b/src/game/client/swarm/c_func_asw_fade.cpp index a98c74e78..5e12f249f 100644 --- a/src/game/client/swarm/c_func_asw_fade.cpp +++ b/src/game/client/swarm/c_func_asw_fade.cpp @@ -6,7 +6,6 @@ IMPLEMENT_CLIENTCLASS_DT( C_Func_ASW_Fade, DT_Func_ASW_Fade, CFunc_ASW_Fade ) RecvPropInt( RECVINFO( m_nFadeOpacity ) ), - RecvPropInt( RECVINFO( m_iCollideWithGrenades ) ), RecvPropBool( RECVINFO( m_bAllowFade ) ), RecvPropBool( RECVINFO( m_bHasProxies ) ), RecvPropBool( RECVINFO( m_bCollideWithMarines ) ), From 4dcbfb15f07c13dc0dd1c02675f2fae67e83a871 Mon Sep 17 00:00:00 2001 From: Grimowy <87246477+Kitsune44@users.noreply.github.com> Date: Sat, 18 Oct 2025 17:35:11 +0200 Subject: [PATCH 11/14] Update src/game/server/swarm/func_asw_fade.cpp Co-authored-by: Ben Lubar --- src/game/server/swarm/func_asw_fade.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/game/server/swarm/func_asw_fade.cpp b/src/game/server/swarm/func_asw_fade.cpp index ddd66e028..092bbeba0 100644 --- a/src/game/server/swarm/func_asw_fade.cpp +++ b/src/game/server/swarm/func_asw_fade.cpp @@ -26,6 +26,7 @@ IMPLEMENT_SERVERCLASS_ST( CFunc_ASW_Fade, DT_Func_ASW_Fade ) SendPropBool( SENDINFO( m_bCollideWithMarines ) ), SendPropBool( SENDINFO( m_bAllowFade ) ), SendPropBool( SENDINFO( m_bHasProxies ) ), + SendPropBool( SENDINFO( m_bCollideWithMarines ) ), END_SEND_TABLE() CFunc_ASW_Fade::CFunc_ASW_Fade() From 7db27ed1a1fd6f40b092246e89d9b0c090790f47 Mon Sep 17 00:00:00 2001 From: Grimowy <87246477+Kitsune44@users.noreply.github.com> Date: Sat, 18 Oct 2025 17:35:19 +0200 Subject: [PATCH 12/14] Update src/game/server/swarm/func_asw_fade.cpp Co-authored-by: Ben Lubar --- src/game/server/swarm/func_asw_fade.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/game/server/swarm/func_asw_fade.cpp b/src/game/server/swarm/func_asw_fade.cpp index 092bbeba0..e36195f4e 100644 --- a/src/game/server/swarm/func_asw_fade.cpp +++ b/src/game/server/swarm/func_asw_fade.cpp @@ -22,8 +22,6 @@ END_DATADESC() IMPLEMENT_SERVERCLASS_ST( CFunc_ASW_Fade, DT_Func_ASW_Fade ) SendPropInt( SENDINFO( m_nFadeOpacity ), 8, SPROP_UNSIGNED ), - SendPropInt( SENDINFO( m_iCollideWithGrenades ), 2, SPROP_UNSIGNED ), - SendPropBool( SENDINFO( m_bCollideWithMarines ) ), SendPropBool( SENDINFO( m_bAllowFade ) ), SendPropBool( SENDINFO( m_bHasProxies ) ), SendPropBool( SENDINFO( m_bCollideWithMarines ) ), From f5be9f0df4b6ef2c20090999cb2d7208c7da23bf Mon Sep 17 00:00:00 2001 From: Grimowy <87246477+Kitsune44@users.noreply.github.com> Date: Sat, 18 Oct 2025 17:35:24 +0200 Subject: [PATCH 13/14] Update src/game/server/swarm/func_asw_fade.h Co-authored-by: Ben Lubar --- src/game/server/swarm/func_asw_fade.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/server/swarm/func_asw_fade.h b/src/game/server/swarm/func_asw_fade.h index 1745358db..0eaa65326 100644 --- a/src/game/server/swarm/func_asw_fade.h +++ b/src/game/server/swarm/func_asw_fade.h @@ -31,7 +31,7 @@ class CFunc_ASW_Fade : public CFuncBrush // 0 = only when grenade spawns above the brush // 1 = always // 2 = never - CNetworkVar( byte, m_iCollideWithGrenades ); + byte m_iCollideWithGrenades; CNetworkVar( bool, m_bCollideWithMarines ); CNetworkVar( byte, m_nFadeOpacity ); CNetworkVar( bool, m_bAllowFade ); From 3d4635a7feaf55402ad0fe0530c1bd9274b9b660 Mon Sep 17 00:00:00 2001 From: kitsune Date: Sat, 18 Oct 2025 21:58:20 +0200 Subject: [PATCH 14/14] update: asw_bait and asw_grenade_prifle --- src/game/server/swarm/asw_bait.cpp | 2 ++ src/game/server/swarm/asw_grenade_prifle.cpp | 2 ++ src/game/server/swarm/func_asw_fade.cpp | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/game/server/swarm/asw_bait.cpp b/src/game/server/swarm/asw_bait.cpp index eb88fd870..fd22e331a 100644 --- a/src/game/server/swarm/asw_bait.cpp +++ b/src/game/server/swarm/asw_bait.cpp @@ -7,6 +7,7 @@ #include "asw_shareddefs.h" #include "ai_senses.h" #include "asw_gamerules.h" +#include "func_asw_fade.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" @@ -58,6 +59,7 @@ void CASW_Bait::Spawn( void ) SetCollisionGroup( ASW_COLLISION_GROUP_IGNORE_NPCS ); //CreateVPhysics(); + CFunc_ASW_Fade::ApplyGrenadeCollisionRules( this ); // Tumble in air QAngle vecAngVelocity( 0, random->RandomFloat ( -100, -500 ), 0 ); diff --git a/src/game/server/swarm/asw_grenade_prifle.cpp b/src/game/server/swarm/asw_grenade_prifle.cpp index 95eaa861d..f531978da 100644 --- a/src/game/server/swarm/asw_grenade_prifle.cpp +++ b/src/game/server/swarm/asw_grenade_prifle.cpp @@ -12,6 +12,7 @@ #include "particle_parse.h" #include "asw_player.h" #include "asw_achievements.h" +#include "func_asw_fade.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" @@ -48,6 +49,7 @@ void CASW_Grenade_PRifle::Spawn() { BaseClass::Spawn(); SetModel( STUN_GRENADE_MODEL ); + CFunc_ASW_Fade::ApplyGrenadeCollisionRules( this ); } void CASW_Grenade_PRifle::Detonate() diff --git a/src/game/server/swarm/func_asw_fade.cpp b/src/game/server/swarm/func_asw_fade.cpp index e36195f4e..875f5261f 100644 --- a/src/game/server/swarm/func_asw_fade.cpp +++ b/src/game/server/swarm/func_asw_fade.cpp @@ -92,7 +92,6 @@ void CFunc_ASW_Fade::ApplyMarineCollisionRules( CBaseEntity* pMarine ) } } - void CFunc_ASW_Fade::SetGrenadeCollisionRules( inputdata_t& inputdata ) { m_iCollideWithGrenades = clamp( inputdata.value.Int(), 0, 2 ); @@ -108,6 +107,8 @@ void CFunc_ASW_Fade::SetGrenadeCollisionRules( inputdata_t& inputdata ) "asw_laser_mine", "asw_grenade_vindicator", "asw_gas_grenade_projectile", + "asw_bait", + "asw_grenade_prifle", nullptr };