Skip to content
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
12 changes: 12 additions & 0 deletions src/game/server/swarm/asw_door.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,18 @@ bool CASW_Door::CloseForWeld( CASW_Marine *pMarine )
return false;
}

bool CASW_Door::StopCloseForWeld( CASW_Marine *pMarine )
{
if ( m_bCanCloseToWeld )
{
variant_t emptyVariant;
AcceptInput( "Open", pMarine, this, emptyVariant, 0 );
m_fClosingToWeldTime = gpGlobals->curtime;
return true;
}
return false;
}

void CASW_Door::AutoOpen( CBaseEntity *pOther )
{
if ( gpGlobals->curtime > m_fClosingToWeldTime )
Expand Down
1 change: 1 addition & 0 deletions src/game/server/swarm/asw_door.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class CASW_Door : public CBasePropDoor
Vector GetWeldFacingPoint(CBaseEntity* pOther); // the point a marine should look to weld this door

bool CloseForWeld(CASW_Marine* PMarine); // player requests the door to shut so he can weld it
bool StopCloseForWeld(CASW_Marine *pMarine); // open the door
bool IsRecommendedSeal( void ) { return m_bRecommendedSeal; }
bool CanWeld( void ) { return m_bCanCloseToWeld; }
float m_fClosingToWeldTime; // door won't autoopen before this curtime
Expand Down
94 changes: 46 additions & 48 deletions src/game/shared/swarm/asw_weapon_welder_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ void CASW_Weapon_Welder::WeldDoor(bool bSeal)
pMarine->DoMuzzleFlash();
m_bIsFiring = true;
}
else
{
bWelding = false;
}
}
#ifdef CLIENT_DLL
pMarine->SetFacingPoint(vecFacingPoint, GetFireRate()*2.0f);
Expand All @@ -163,12 +167,19 @@ void CASW_Weapon_Welder::WeldDoor(bool bSeal)
{
if ( pDoor->IsOpen() )
{
#ifndef CLIENT_DLL
if ( bSeal )
{
#ifndef CLIENT_DLL
pDoor->CloseForWeld( pMarine ); // shut the door first, so we can start welding it
#endif
}
else
{
#ifndef CLIENT_DLL
pDoor->StopCloseForWeld( pMarine );
#endif
bWelding = false;
}
}
else
{
Expand Down Expand Up @@ -203,19 +214,7 @@ void CASW_Weapon_Welder::WeldDoor(bool bSeal)

if ( !bWelding )
{
m_iAutomaticWeldDirection = 0;
m_bShotDelayed = false;
#ifdef GAME_DLL
if ( pMarine->GetMarineResource() )
{
pMarine->GetMarineResource()->m_hWeldingDoor = NULL;
}

m_pWeldDoor = NULL;

pMarine->OnWeldFinished();
#endif
m_bIsFiring = false;
FinishWeld( pMarine, false );
}
else
{
Expand All @@ -230,29 +229,46 @@ void CASW_Weapon_Welder::WeldDoor(bool bSeal)
}
}

void CASW_Weapon_Welder::FinishWeld( CASW_Marine* pMarine, bool bKeepWeldDirection )
{
m_bShotDelayed = false;
#ifdef GAME_DLL
if ( pMarine )
{
if ( pMarine->GetMarineResource() )
{
pMarine->GetMarineResource()->m_hWeldingDoor = NULL;
}
pMarine->OnWeldFinished();
}
#endif // GAME_DLL
#ifndef CLIENT_DLL
if ( m_iAutomaticWeldDirection < 0 && m_pWeldDoor && m_pWeldDoor->GetSealAmount() <= 0.0f )
{
// Open ASAP
m_pWeldDoor->StopCloseForWeld( pMarine );
}
m_pWeldDoor = NULL;
#endif // !CLIENT_DLL
if ( !bKeepWeldDirection )
{
m_iAutomaticWeldDirection = 0;
}
m_bIsFiring = false;
}

// make the weapon weld if needed

void CASW_Weapon_Welder::ItemPostFrame()
{
CASW_Marine *pMarine = NULL;
#ifndef CLIENT_DLL
CASW_Marine *pMarine = GetMarine();
pMarine = GetMarine();
if ( !pMarine || !pMarine->GetCommander() )
{
if ( m_bPlayingWelderSound )
{
m_bIsFiring = false;

m_pWeldDoor = NULL;

if (pMarine)
{
if (pMarine->GetMarineResource())
{
pMarine->GetMarineResource()->m_hWeldingDoor = NULL;
}

pMarine->OnWeldFinished();
}
FinishWeld( pMarine, true );
//Msg( "Clearing weld door as no marine\n" );
}
return BaseItemPostFrame();
Expand Down Expand Up @@ -317,32 +333,14 @@ void CASW_Weapon_Welder::ItemPostFrame()
if ( ( m_iAutomaticWeldDirection > 0 && m_pWeldDoor->GetSealAmount() >= 1.0f ) ||
( m_iAutomaticWeldDirection < 0 && m_pWeldDoor->GetSealAmount() <= 0.0f ) )
{
m_bShotDelayed = false;
#ifdef GAME_DLL
if ( pMarine->GetMarineResource() )
{
pMarine->GetMarineResource()->m_hWeldingDoor = NULL;
}
m_pWeldDoor = NULL;
pMarine->OnWeldFinished();
#endif
m_bIsFiring = false;
FinishWeld( pMarine, false );
}
}
else
{
if ( !FindDoor() )
{
m_bShotDelayed = false;
#ifdef GAME_DLL
if ( pMarine->GetMarineResource() )
{
pMarine->GetMarineResource()->m_hWeldingDoor = NULL;
}
m_pWeldDoor = NULL;
pMarine->OnWeldFinished();
#endif
m_bIsFiring = false;
FinishWeld( pMarine, true );
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/game/shared/swarm/asw_weapon_welder_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#ifdef CLIENT_DLL
#define CASW_Weapon_Welder C_ASW_Weapon_Welder
#define CASW_Weapon C_ASW_Weapon
#define CASW_Marine C_ASW_Marine
#include "c_asw_weapon.h"
#else
#include "asw_weapon.h"
Expand All @@ -29,6 +30,7 @@ class CASW_Weapon_Welder : public CASW_Weapon
virtual void PrimaryAttack();
virtual void SecondaryAttack();
virtual void WeldDoor(bool bSeal);
virtual void FinishWeld( CASW_Marine* pMarine, bool bKeepWeldDirection = false );

#ifndef CLIENT_DLL
DECLARE_DATADESC();
Expand Down
Loading