Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement "OnPhysGunPull" output in CPhysicsProp #266

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
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
5 changes: 5 additions & 0 deletions sp/src/game/server/hl2/weapon_physcannon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2723,6 +2723,11 @@ CWeaponPhysCannon::FindObjectResult_t CWeaponPhysCannon::FindObject( void )
pullDir *= (mass + 0.5) * (1/50.0f);
}

CPhysicsProp* pProp = dynamic_cast<CPhysicsProp*>(pObj);
if (pProp) {
pProp->OnPhysGunPull( pOwner );
}

// Nudge it towards us
pObj->ApplyForceCenter( pullDir );
return OBJECT_NOT_FOUND;
Expand Down
8 changes: 8 additions & 0 deletions sp/src/game/server/props.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" ),
Expand Down Expand Up @@ -3391,6 +3392,13 @@ void CPhysicsProp::OnPhysGunPickup( CBasePlayer *pPhysGunUser, PhysGunPickup_t r
CheckRemoveRagdolls();
}

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPhysicsProp::OnPhysGunPull( CBasePlayer* pPhysGunUser ) {
m_OnPhysGunPull.FireOutput(pPhysGunUser, this);
}

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions sp/src/game/server/props.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
void OnPhysGunDrop( CBasePlayer *pPhysGunUser, PhysGunDrop_t reason );

bool GetPropDataAngles( const char *pKeyName, QAngle &vecAngles );
Expand Down Expand Up @@ -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;
Expand Down
Loading