Expose prop_door_rotating to VScript

This commit is contained in:
ALLEN-PC\acj30 2025-01-04 08:35:16 -06:00
parent 0464bd7fd3
commit a00c8234e4
2 changed files with 113 additions and 0 deletions

View File

@ -38,6 +38,9 @@ public:
DECLARE_CLASS( CBasePropDoor, CDynamicProp );
DECLARE_SERVERCLASS();
#ifdef MAPBASE_VSCRIPT
DECLARE_ENT_SCRIPTDESC();
#endif
CBasePropDoor( void );
@ -79,6 +82,28 @@ public:
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:
@ -178,6 +203,12 @@ private:
#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 );

View File

@ -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"),
@ -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;
@ -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:
//