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

// dont try to close when an entity is standing inside any trigger_asw_door_area's that would make the door open
FOR_EACH_VEC( m_AttachedDoorAreas, i )
{
if ( m_AttachedDoorAreas[i]->GetNumTouching() != 0 )
return false;
}

if ( g_debug_doors.GetBool() )
{
NDebugOverlay::Box( vecClosed, m_vecBoundsMin, m_vecBoundsMax, 0, 255, 0, true, 10.0f );
Expand Down
3 changes: 3 additions & 0 deletions src/game/server/swarm/asw_door.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "entityblocker.h"
#include "BasePropDoor.h"
#include "asw_door_area.h"
#include "asw_shareddefs.h"

class CASW_Player;
Expand Down Expand Up @@ -152,6 +153,8 @@ class CASW_Door : public CBasePropDoor

void UpdateDoorHealthOnMissionStart( int iDifficulty );

CUtlVector<CASW_Door_Area *> m_AttachedDoorAreas;

private:

float m_fLastFullyWeldedSound;
Expand Down
20 changes: 20 additions & 0 deletions src/game/server/swarm/asw_door_area.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,26 @@ CASW_Door_Area::CASW_Door_Area()
m_fNextCutCheck = 0;
}

CASW_Door_Area::~CASW_Door_Area()
{
CASW_Door *pDoor = GetDoor();
if ( pDoor )
{
pDoor->m_AttachedDoorAreas.FindAndRemove( this );
}
}

void CASW_Door_Area::Spawn( void )
{
BaseClass::Spawn();

CASW_Door *pDoor = GetDoor();
if ( pDoor )
{
pDoor->m_AttachedDoorAreas.AddToTail( this );
}
}

bool CASW_Door_Area::HasWelder( CASW_Marine *pMarine )
{
CASW_Weapon *pExtra = pMarine->GetASWWeapon( ASW_INVENTORY_SLOT_EXTRA );
Expand Down
3 changes: 3 additions & 0 deletions src/game/server/swarm/asw_door_area.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ class CASW_Door_Area : public CASW_Use_Area
DECLARE_CLASS( CASW_Door_Area, CASW_Use_Area );
public:
CASW_Door_Area();
~CASW_Door_Area();

virtual void Spawn( void );
virtual void ActivateMultiTrigger( CBaseEntity *pActivator );

bool HasWelder( CASW_Marine *pMarine );
Expand Down
4 changes: 2 additions & 2 deletions src/game/server/triggers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ BEGIN_ENT_SCRIPTDESC( CBaseTrigger, CBaseEntity, "Server-side trigger" )
DEFINE_SCRIPTFUNC( Disable, "Disable the trigger" )
DEFINE_SCRIPTFUNC( Enable, "Enable the trigger" )
DEFINE_SCRIPTFUNC_NAMED( ScriptIsTouching, "IsTouching", "Checks whether the passed entity is touching the trigger." )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetNumTouching, "GetNumTouching", "Gets the number of entities currently touching the trigger." )
DEFINE_SCRIPTFUNC( GetNumTouching, "Gets the number of entities currently touching the trigger." )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetTouching, "GetTouching", "Gets the i'th entity currently touching the trigger." )
END_SCRIPTDESC();

Expand Down Expand Up @@ -566,7 +566,7 @@ bool CBaseTrigger::ScriptIsTouching( HSCRIPT entity )
return IsTouching( pOther );
}

int CBaseTrigger::ScriptGetNumTouching()
int CBaseTrigger::GetNumTouching()
{
return m_hTouchingEntities.Count();
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/server/triggers.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class CBaseTrigger : public CBaseToggle

bool IsTouching( CBaseEntity *pOther );
bool ScriptIsTouching( HSCRIPT entity );
int ScriptGetNumTouching();
int GetNumTouching();
HSCRIPT ScriptGetTouching( int i );

CBaseEntity *GetTouchedEntityOfType( const char *sClassName );
Expand Down