Merge pull request #261 from samisalreadytaken/dev

Misc vscript additions
This commit is contained in:
Blixibon 2024-02-04 15:20:12 -06:00 committed by GitHub
commit de01ce6292
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 18 additions and 12 deletions

View File

@ -1477,6 +1477,11 @@ public:
{ {
ivgui()->AddTickSignal( this->GetVPanel(), i ); ivgui()->AddTickSignal( this->GetVPanel(), i );
} }
void RemoveTickSignal()
{
ivgui()->RemoveTickSignal( this->GetVPanel() );
}
#if SCRIPT_VGUI_SIGNAL_INTERFACE #if SCRIPT_VGUI_SIGNAL_INTERFACE
void AddActionSignalTarget( HSCRIPT messageTarget ) void AddActionSignalTarget( HSCRIPT messageTarget )
{ {
@ -1867,6 +1872,7 @@ public:
DEFINE_SCRIPTFUNC( MakeReadyForUse, "" )\ DEFINE_SCRIPTFUNC( MakeReadyForUse, "" )\
DEFINE_SCRIPTFUNC( GetName, "" )\ DEFINE_SCRIPTFUNC( GetName, "" )\
DEFINE_SCRIPTFUNC( AddTickSignal, "" )\ DEFINE_SCRIPTFUNC( AddTickSignal, "" )\
DEFINE_SCRIPTFUNC( RemoveTickSignal, "" )\
\ \
DEFINE_SCRIPTFUNC( GetParent, "" )\ DEFINE_SCRIPTFUNC( GetParent, "" )\
DEFINE_SCRIPTFUNC( SetParent, "" )\ DEFINE_SCRIPTFUNC( SetParent, "" )\

View File

@ -12333,6 +12333,7 @@ BEGIN_ENT_SCRIPTDESC( CAI_BaseNPC, CBaseCombatCharacter, "The base class all NPC
DEFINE_SCRIPTFUNC( IsCommandable, "Check if the NPC is commandable." ) DEFINE_SCRIPTFUNC( IsCommandable, "Check if the NPC is commandable." )
DEFINE_SCRIPTFUNC( IsInPlayerSquad, "Check if the NPC is in the player's squad." ) DEFINE_SCRIPTFUNC( IsInPlayerSquad, "Check if the NPC is in the player's squad." )
DEFINE_SCRIPTFUNC( IsMedic, "Returns true if this NPC is a medic." )
DEFINE_SCRIPTFUNC_NAMED( VScriptGetCine, "GetCine", "Get the NPC's currently running scripted sequence if it has one." ) DEFINE_SCRIPTFUNC_NAMED( VScriptGetCine, "GetCine", "Get the NPC's currently running scripted sequence if it has one." )
DEFINE_SCRIPTFUNC( GetScriptState, "Get the NPC's current scripted sequence state." ) DEFINE_SCRIPTFUNC( GetScriptState, "Get the NPC's current scripted sequence state." )

View File

@ -10300,8 +10300,9 @@ bool CBaseEntity::ScriptAddOutput( const char *pszOutputName, const char *pszTar
const char *CBaseEntity::ScriptGetKeyValue( const char *pszKeyName ) const char *CBaseEntity::ScriptGetKeyValue( const char *pszKeyName )
{ {
static char szValue[128]; static char szValue[128];
GetKeyValue( pszKeyName, szValue, sizeof(szValue) ); if ( GetKeyValue( pszKeyName, szValue, sizeof(szValue) ) )
return szValue; return szValue;
return NULL;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -412,7 +412,6 @@ ScriptHook_t CNPC_Citizen::g_Hook_SelectModel;
BEGIN_ENT_SCRIPTDESC( CNPC_Citizen, CAI_BaseActor, "npc_citizen from Half-Life 2" ) BEGIN_ENT_SCRIPTDESC( CNPC_Citizen, CAI_BaseActor, "npc_citizen from Half-Life 2" )
DEFINE_SCRIPTFUNC( IsMedic, "Returns true if this citizen is a medic." )
DEFINE_SCRIPTFUNC( IsAmmoResupplier, "Returns true if this citizen is an ammo resupplier." ) DEFINE_SCRIPTFUNC( IsAmmoResupplier, "Returns true if this citizen is an ammo resupplier." )
DEFINE_SCRIPTFUNC( CanHeal, "Returns true if this citizen is a medic or ammo resupplier currently able to heal/give ammo." ) DEFINE_SCRIPTFUNC( CanHeal, "Returns true if this citizen is a medic or ammo resupplier currently able to heal/give ammo." )

View File

@ -118,15 +118,14 @@ class CSimpleCallChainer
function PostScriptExecute() function PostScriptExecute()
{ {
local func; if ( prefix in scope )
try { {
func = scope[prefix]; local func = scope[prefix];
} catch(e) { if ( typeof func == "function" )
return; {
chain.push(func);
}
} }
if (typeof(func) != "function")
return;
chain.push(func);
} }
function Call() function Call()
@ -569,4 +568,4 @@ if (developer)
__Documentation.RegisterHelp( "Lerp", "float Lerp(float, float, float)", "" ); __Documentation.RegisterHelp( "Lerp", "float Lerp(float, float, float)", "" );
__Documentation.RegisterHelp( "SimpleSpline", "float SimpleSpline(float)", "" ); __Documentation.RegisterHelp( "SimpleSpline", "float SimpleSpline(float)", "" );
} }
)vscript"; )vscript";