From 02e232babf80b12ba7db102b39a659c584658b66 Mon Sep 17 00:00:00 2001 From: rlen Date: Tue, 2 Jan 2024 01:39:12 +0900 Subject: [PATCH 1/2] add "OnPhysGunPull" output to CPhysicsProp --- sp/src/game/server/hl2/weapon_physcannon.cpp | 5 +++++ sp/src/game/server/props.cpp | 8 ++++++++ sp/src/game/server/props.h | 2 ++ 3 files changed, 15 insertions(+) diff --git a/sp/src/game/server/hl2/weapon_physcannon.cpp b/sp/src/game/server/hl2/weapon_physcannon.cpp index 66991e45e6..19ebb8c3bb 100644 --- a/sp/src/game/server/hl2/weapon_physcannon.cpp +++ b/sp/src/game/server/hl2/weapon_physcannon.cpp @@ -2723,6 +2723,11 @@ CWeaponPhysCannon::FindObjectResult_t CWeaponPhysCannon::FindObject( void ) pullDir *= (mass + 0.5) * (1/50.0f); } + CPhysicsProp* pProp = dynamic_cast(pObj); + if (pProp) { + pProp->OnPhysGunPull( pOwner, pullDir ); + } + // Nudge it towards us pObj->ApplyForceCenter( pullDir ); return OBJECT_NOT_FOUND; diff --git a/sp/src/game/server/props.cpp b/sp/src/game/server/props.cpp index 5ad4c11a3c..d7fcf59902 100644 --- a/sp/src/game/server/props.cpp +++ b/sp/src/game/server/props.cpp @@ -3021,6 +3021,7 @@ BEGIN_DATADESC( CPhysicsProp ) DEFINE_OUTPUT( m_MotionEnabled, "OnMotionEnabled" ), DEFINE_OUTPUT( m_OnPhysGunPickup, "OnPhysGunPickup" ), DEFINE_OUTPUT( m_OnPhysGunOnlyPickup, "OnPhysGunOnlyPickup" ), + DEFINE_OUTPUT( m_OnPhysGunPull, "OnPhysGunPull" ), DEFINE_OUTPUT( m_OnPhysGunPunt, "OnPhysGunPunt" ), DEFINE_OUTPUT( m_OnPhysGunDrop, "OnPhysGunDrop" ), DEFINE_OUTPUT( m_OnPlayerUse, "OnPlayerUse" ), @@ -3391,6 +3392,13 @@ void CPhysicsProp::OnPhysGunPickup( CBasePlayer *pPhysGunUser, PhysGunPickup_t r CheckRemoveRagdolls(); } +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CPhysicsProp::OnPhysGunPull( CBasePlayer* pPhysGunUser, Vector pullDir ) { + m_OnPhysGunPull.FireOutput(pPhysGunUser, this); +} + //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- diff --git a/sp/src/game/server/props.h b/sp/src/game/server/props.h index ebd87c4da1..c36f11bbd2 100644 --- a/sp/src/game/server/props.h +++ b/sp/src/game/server/props.h @@ -413,6 +413,7 @@ class CPhysicsProp : public CBreakableProp void EnableMotion( void ); bool CanBePickedUpByPhyscannon( void ); void OnPhysGunPickup( CBasePlayer *pPhysGunUser, PhysGunPickup_t reason ); + void OnPhysGunPull( CBasePlayer *pPhysGunUser, Vector pullDir ); void OnPhysGunDrop( CBasePlayer *pPhysGunUser, PhysGunDrop_t reason ); bool GetPropDataAngles( const char *pKeyName, QAngle &vecAngles ); @@ -446,6 +447,7 @@ class CPhysicsProp : public CBreakableProp COutputEvent m_OnPhysGunPickup; COutputEvent m_OnPhysGunPunt; COutputEvent m_OnPhysGunOnlyPickup; + COutputEvent m_OnPhysGunPull; COutputEvent m_OnPhysGunDrop; COutputEvent m_OnPlayerUse; COutputEvent m_OnPlayerPickup; From f484aa7ebc8b6cdf5da41040456e7622fca0778d Mon Sep 17 00:00:00 2001 From: rlen Date: Mon, 19 Feb 2024 21:46:04 +0900 Subject: [PATCH 2/2] removed `pullDir` parameter from `OnPhysGunPull` --- sp/src/game/server/hl2/weapon_physcannon.cpp | 2 +- sp/src/game/server/props.cpp | 2 +- sp/src/game/server/props.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sp/src/game/server/hl2/weapon_physcannon.cpp b/sp/src/game/server/hl2/weapon_physcannon.cpp index 19ebb8c3bb..8a246a2d56 100644 --- a/sp/src/game/server/hl2/weapon_physcannon.cpp +++ b/sp/src/game/server/hl2/weapon_physcannon.cpp @@ -2725,7 +2725,7 @@ CWeaponPhysCannon::FindObjectResult_t CWeaponPhysCannon::FindObject( void ) CPhysicsProp* pProp = dynamic_cast(pObj); if (pProp) { - pProp->OnPhysGunPull( pOwner, pullDir ); + pProp->OnPhysGunPull( pOwner ); } // Nudge it towards us diff --git a/sp/src/game/server/props.cpp b/sp/src/game/server/props.cpp index d7fcf59902..33aba2638f 100644 --- a/sp/src/game/server/props.cpp +++ b/sp/src/game/server/props.cpp @@ -3395,7 +3395,7 @@ void CPhysicsProp::OnPhysGunPickup( CBasePlayer *pPhysGunUser, PhysGunPickup_t r //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -void CPhysicsProp::OnPhysGunPull( CBasePlayer* pPhysGunUser, Vector pullDir ) { +void CPhysicsProp::OnPhysGunPull( CBasePlayer* pPhysGunUser ) { m_OnPhysGunPull.FireOutput(pPhysGunUser, this); } diff --git a/sp/src/game/server/props.h b/sp/src/game/server/props.h index c36f11bbd2..5c57824daa 100644 --- a/sp/src/game/server/props.h +++ b/sp/src/game/server/props.h @@ -413,7 +413,7 @@ class CPhysicsProp : public CBreakableProp void EnableMotion( void ); bool CanBePickedUpByPhyscannon( void ); void OnPhysGunPickup( CBasePlayer *pPhysGunUser, PhysGunPickup_t reason ); - void OnPhysGunPull( CBasePlayer *pPhysGunUser, Vector pullDir ); + void OnPhysGunPull( CBasePlayer *pPhysGunUser ); void OnPhysGunDrop( CBasePlayer *pPhysGunUser, PhysGunDrop_t reason ); bool GetPropDataAngles( const char *pKeyName, QAngle &vecAngles );