From f93b716fc74f4489b6cc6f4267ef57ae0ebf6e98 Mon Sep 17 00:00:00 2001 From: ZehM4tt Date: Sun, 27 Dec 2015 02:08:44 +0100 Subject: [PATCH 1/4] Fixed npc_manhack not notifying npc_template_maker/npc_maker when thrown and destroyed with gravity gun. --- mp/src/game/server/hl2/npc_manhack.cpp | 10 ++++++++-- mp/src/game/server/hl2/npc_manhack.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/mp/src/game/server/hl2/npc_manhack.cpp b/mp/src/game/server/hl2/npc_manhack.cpp index 5dc22f8f63c..8f41aed653b 100644 --- a/mp/src/game/server/hl2/npc_manhack.cpp +++ b/mp/src/game/server/hl2/npc_manhack.cpp @@ -3007,6 +3007,9 @@ void CNPC_Manhack::OnPhysGunPickup( CBasePlayer *pPhysGunUser, PhysGunPickup_t r } else { + // FIX: Remember the current owner in case we are from a npc_template_maker/npc_maker. + m_pPrevOwner.Set(GetOwnerEntity()); + // Suppress collisions between the manhack and the player; we're currently bumping // almost certainly because it's not purely a physics object. SetOwnerEntity( pPhysGunUser ); @@ -3022,8 +3025,11 @@ void CNPC_Manhack::OnPhysGunPickup( CBasePlayer *pPhysGunUser, PhysGunPickup_t r //----------------------------------------------------------------------------- void CNPC_Manhack::OnPhysGunDrop( CBasePlayer *pPhysGunUser, PhysGunDrop_t Reason ) { - // Stop suppressing collisions between the manhack and the player - SetOwnerEntity( NULL ); + // Stop suppressing collisions between the manhack and the player + SetOwnerEntity(m_pPrevOwner.Get()); + + // Reset previous owner back to NULL. + m_pPrevOwner.Set(NULL); m_bHeld = false; diff --git a/mp/src/game/server/hl2/npc_manhack.h b/mp/src/game/server/hl2/npc_manhack.h index c80ca22eb74..989ea293a9f 100644 --- a/mp/src/game/server/hl2/npc_manhack.h +++ b/mp/src/game/server/hl2/npc_manhack.h @@ -254,6 +254,7 @@ DECLARE_SERVERCLASS(); CSprite *m_pLightGlow; CHandle m_hSmokeTrail; + CHandle m_pPrevOwner; int m_iPanel1; int m_iPanel2; From 63ff6a7211ad60742bbadd92e7ddb4408dc8229a Mon Sep 17 00:00:00 2001 From: ZehM4tt Date: Sun, 27 Dec 2015 02:15:31 +0100 Subject: [PATCH 2/4] Fixed npc_manhack not notifying npc_template_maker/npc_maker when thrown and destroyed with gravity gun. --- sp/src/game/server/hl2/npc_manhack.cpp | 12 +++++++++--- sp/src/game/server/hl2/npc_manhack.h | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/sp/src/game/server/hl2/npc_manhack.cpp b/sp/src/game/server/hl2/npc_manhack.cpp index 5dc22f8f63c..32a050b10f8 100644 --- a/sp/src/game/server/hl2/npc_manhack.cpp +++ b/sp/src/game/server/hl2/npc_manhack.cpp @@ -3007,9 +3007,12 @@ void CNPC_Manhack::OnPhysGunPickup( CBasePlayer *pPhysGunUser, PhysGunPickup_t r } else { + // FIX: Remember the current owner in case we are from a npc_template_maker/npc_maker. + m_pPrevOwner.Set(GetOwnerEntity()); + // Suppress collisions between the manhack and the player; we're currently bumping // almost certainly because it's not purely a physics object. - SetOwnerEntity( pPhysGunUser ); + SetOwnerEntity(pPhysGunUser); m_bHeld = true; } } @@ -3022,8 +3025,11 @@ void CNPC_Manhack::OnPhysGunPickup( CBasePlayer *pPhysGunUser, PhysGunPickup_t r //----------------------------------------------------------------------------- void CNPC_Manhack::OnPhysGunDrop( CBasePlayer *pPhysGunUser, PhysGunDrop_t Reason ) { - // Stop suppressing collisions between the manhack and the player - SetOwnerEntity( NULL ); + // Stop suppressing collisions between the manhack and the player + SetOwnerEntity(m_pPrevOwner.Get()); + + // Reset previous owner back to NULL. + m_pPrevOwner.Set(NULL); m_bHeld = false; diff --git a/sp/src/game/server/hl2/npc_manhack.h b/sp/src/game/server/hl2/npc_manhack.h index c80ca22eb74..989ea293a9f 100644 --- a/sp/src/game/server/hl2/npc_manhack.h +++ b/sp/src/game/server/hl2/npc_manhack.h @@ -254,6 +254,7 @@ DECLARE_SERVERCLASS(); CSprite *m_pLightGlow; CHandle m_hSmokeTrail; + CHandle m_pPrevOwner; int m_iPanel1; int m_iPanel2; From f4c807ad479da9942d7c01022e2ee685ae5ec7bc Mon Sep 17 00:00:00 2001 From: ZehM4tt Date: Sat, 11 Jun 2016 07:06:42 +0200 Subject: [PATCH 3/4] Fixed infinite recursion by using incorrect key on value conversation. --- mp/src/game/shared/baseentity_shared.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mp/src/game/shared/baseentity_shared.cpp b/mp/src/game/shared/baseentity_shared.cpp index 949143b16e0..07be5190049 100644 --- a/mp/src/game/shared/baseentity_shared.cpp +++ b/mp/src/game/shared/baseentity_shared.cpp @@ -408,7 +408,7 @@ bool CBaseEntity::KeyValue( const char *szKeyName, const char *szValue ) } // Do this so inherited classes looking for 'angles' don't have to bother with 'angle' - return KeyValue( szKeyName, szBuf ); + return KeyValue( "angles", szBuf ); } // NOTE: Have to do these separate because they set two values instead of one From 3972c3f8266226186c48a098d9103d99a4eca626 Mon Sep 17 00:00:00 2001 From: ZehM4tt Date: Sat, 11 Jun 2016 07:13:17 +0200 Subject: [PATCH 4/4] Revert "Fixed infinite recursion by using incorrect key on value conversation." This reverts commit f4c807ad479da9942d7c01022e2ee685ae5ec7bc. --- mp/src/game/shared/baseentity_shared.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mp/src/game/shared/baseentity_shared.cpp b/mp/src/game/shared/baseentity_shared.cpp index 07be5190049..949143b16e0 100644 --- a/mp/src/game/shared/baseentity_shared.cpp +++ b/mp/src/game/shared/baseentity_shared.cpp @@ -408,7 +408,7 @@ bool CBaseEntity::KeyValue( const char *szKeyName, const char *szValue ) } // Do this so inherited classes looking for 'angles' don't have to bother with 'angle' - return KeyValue( "angles", szBuf ); + return KeyValue( szKeyName, szBuf ); } // NOTE: Have to do these separate because they set two values instead of one