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
31 changes: 31 additions & 0 deletions sp/src/game/server/BasePropDoor.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ abstract_class CBasePropDoor : public CDynamicProp

DECLARE_CLASS( CBasePropDoor, CDynamicProp );
DECLARE_SERVERCLASS();
#ifdef MAPBASE_VSCRIPT
DECLARE_ENT_SCRIPTDESC();
#endif

CBasePropDoor( void );

Expand Down Expand Up @@ -79,6 +82,28 @@ abstract_class CBasePropDoor : public CDynamicProp
virtual bool PassesDoorFilter(CBaseEntity *pEntity) { return true; }

virtual bool KeyValue( const char *szKeyName, const char *szValue );

float GetSpeed() const { return m_flSpeed; }
#endif

#ifdef MAPBASE_VSCRIPT
bool ScriptIsDoorOpen() { return IsDoorOpen(); }
bool ScriptIsDoorAjar() { return IsDoorAjar(); }
bool ScriptIsDoorOpening() { return IsDoorOpening(); }
bool ScriptIsDoorClosed() { return IsDoorClosed(); }
bool ScriptIsDoorClosing() { return IsDoorClosing(); }
bool ScriptIsDoorLocked() { return IsDoorLocked(); }
bool ScriptIsDoorBlocked() const { return IsDoorBlocked(); }
HSCRIPT ScriptGetActivator() { return ToHScript( m_hActivator.Get() ); }

HSCRIPT ScriptGetDoorList( int i ) { return m_hDoorList.IsValidIndex(i) ? ToHScript( m_hDoorList[i] ) : NULL; }
int GetDoorListCount() { return m_hDoorList.Count(); }

const char *ScriptGetFullyOpenSound() { return STRING( m_SoundOpen ); }
const char *ScriptGetFullyClosedSound() { return STRING( m_SoundClose ); }
const char *ScriptGetMovingSound() { return STRING( m_SoundMoving ); }
const char *ScriptGetLockedSound() { return STRING( m_ls.sLockedSound ); }
const char *ScriptGetUnlockedSound() { return STRING( m_ls.sUnlockedSound ); }
#endif

protected:
Expand Down Expand Up @@ -178,6 +203,12 @@ abstract_class CBasePropDoor : public CDynamicProp
#ifdef MAPBASE
void InputAllowPlayerUse(inputdata_t &inputdata);
void InputDisallowPlayerUse(inputdata_t &inputdata);

void InputSetFullyOpenSound(inputdata_t &inputdata);
void InputSetFullyClosedSound(inputdata_t &inputdata);
void InputSetMovingSound(inputdata_t &inputdata);
void InputSetLockedSound(inputdata_t &inputdata);
void InputSetUnlockedSound(inputdata_t &inputdata);
#endif

void SetDoorBlocker( CBaseEntity *pBlocker );
Expand Down
82 changes: 82 additions & 0 deletions sp/src/game/server/props.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4206,6 +4206,12 @@ BEGIN_DATADESC(CBasePropDoor)
#ifdef MAPBASE
DEFINE_INPUTFUNC(FIELD_VOID, "AllowPlayerUse", InputAllowPlayerUse),
DEFINE_INPUTFUNC(FIELD_VOID, "DisallowPlayerUse", InputDisallowPlayerUse),

DEFINE_INPUTFUNC( FIELD_STRING, "SetFullyOpenSound", InputSetFullyOpenSound ),
DEFINE_INPUTFUNC( FIELD_STRING, "SetFullyClosedSound", InputSetFullyClosedSound ),
DEFINE_INPUTFUNC( FIELD_STRING, "SetMovingSound", InputSetMovingSound ),
DEFINE_INPUTFUNC( FIELD_STRING, "SetLockedSound", InputSetLockedSound ),
DEFINE_INPUTFUNC( FIELD_STRING, "SetUnlockedSound", InputSetUnlockedSound ),
#endif

DEFINE_OUTPUT(m_OnBlockedOpening, "OnBlockedOpening"),
Expand All @@ -4228,6 +4234,34 @@ END_DATADESC()
IMPLEMENT_SERVERCLASS_ST(CBasePropDoor, DT_BasePropDoor)
END_SEND_TABLE()

#ifdef MAPBASE_VSCRIPT
BEGIN_ENT_SCRIPTDESC( CBasePropDoor, CBaseAnimating, "The base class used by prop doors, such as prop_door_rotating." )

DEFINE_SCRIPTFUNC_NAMED( ScriptIsDoorOpen, "IsDoorOpen", "" )
DEFINE_SCRIPTFUNC_NAMED( ScriptIsDoorAjar, "IsDoorAjar", "" )
DEFINE_SCRIPTFUNC_NAMED( ScriptIsDoorOpening, "IsDoorOpening", "" )
DEFINE_SCRIPTFUNC_NAMED( ScriptIsDoorClosed, "IsDoorClosed", "" )
DEFINE_SCRIPTFUNC_NAMED( ScriptIsDoorClosing, "IsDoorClosing", "" )
DEFINE_SCRIPTFUNC_NAMED( ScriptIsDoorLocked, "IsDoorLocked", "" )
DEFINE_SCRIPTFUNC_NAMED( ScriptIsDoorBlocked, "IsDoorBlocked", "" )

DEFINE_SCRIPTFUNC_NAMED( ScriptGetActivator, "GetActivator", "" )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetDoorList, "GetDoorList", "Get connected door entity by index." )
DEFINE_SCRIPTFUNC( GetDoorListCount, "Get number of connected doors." )

DEFINE_SCRIPTFUNC_NAMED( ScriptGetFullyOpenSound, "GetFullyOpenSound", "" )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetFullyClosedSound, "GetFullyClosedSound", "" )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetMovingSound, "GetMovingSound", "" )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetLockedSound, "GetLockedSound", "" )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetUnlockedSound, "GetUnlockedSound", "" )

DEFINE_SCRIPTFUNC( DoorCanClose, "Return true if the door has room to close. Boolean is for whether or not this is an automatic close and not manually triggered by someone." )
DEFINE_SCRIPTFUNC( DoorCanOpen, "Return true if there are other doors connected to this one." )
DEFINE_SCRIPTFUNC( HasSlaves, "" )

END_SCRIPTDESC();
#endif

CBasePropDoor::CBasePropDoor( void )
{
m_hMaster = NULL;
Expand Down Expand Up @@ -4701,6 +4735,54 @@ void CBasePropDoor::InputOpenAwayFrom(inputdata_t &inputdata)
}


#ifdef MAPBASE
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBasePropDoor::InputSetFullyOpenSound( inputdata_t &inputdata )
{
m_SoundOpen = inputdata.value.StringID();
PrecacheScriptSound( STRING( m_SoundOpen ) );
}

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBasePropDoor::InputSetFullyClosedSound( inputdata_t &inputdata )
{
m_SoundClose = inputdata.value.StringID();
PrecacheScriptSound( STRING( m_SoundClose ) );
}

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBasePropDoor::InputSetMovingSound( inputdata_t &inputdata )
{
m_SoundMoving = inputdata.value.StringID();
PrecacheScriptSound( STRING( m_SoundMoving ) );
}

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBasePropDoor::InputSetLockedSound( inputdata_t &inputdata )
{
m_ls.sLockedSound = inputdata.value.StringID();
PrecacheScriptSound( STRING( m_ls.sLockedSound ) );
}

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBasePropDoor::InputSetUnlockedSound( inputdata_t &inputdata )
{
m_ls.sUnlockedSound = inputdata.value.StringID();
PrecacheScriptSound( STRING( m_ls.sUnlockedSound ) );
}
#endif


//-----------------------------------------------------------------------------
// Purpose:
//
Expand Down