Skip to content

Commit de01ce6

Browse files
authored
Merge pull request #261 from samisalreadytaken/dev
Misc vscript additions
2 parents 5afe4fa + f1123ed commit de01ce6

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
lines changed

sp/src/game/client/mapbase/vscript_vgui.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,6 +1477,11 @@ CLASS_HELPER_INTERFACE_ROOT( Panel )
14771477
{
14781478
ivgui()->AddTickSignal( this->GetVPanel(), i );
14791479
}
1480+
1481+
void RemoveTickSignal()
1482+
{
1483+
ivgui()->RemoveTickSignal( this->GetVPanel() );
1484+
}
14801485
#if SCRIPT_VGUI_SIGNAL_INTERFACE
14811486
void AddActionSignalTarget( HSCRIPT messageTarget )
14821487
{
@@ -1867,6 +1872,7 @@ CLASS_HELPER_INTERFACE_ROOT( Panel )
18671872
DEFINE_SCRIPTFUNC( MakeReadyForUse, "" )\
18681873
DEFINE_SCRIPTFUNC( GetName, "" )\
18691874
DEFINE_SCRIPTFUNC( AddTickSignal, "" )\
1875+
DEFINE_SCRIPTFUNC( RemoveTickSignal, "" )\
18701876
\
18711877
DEFINE_SCRIPTFUNC( GetParent, "" )\
18721878
DEFINE_SCRIPTFUNC( SetParent, "" )\

sp/src/game/server/ai_basenpc.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12333,6 +12333,7 @@ BEGIN_ENT_SCRIPTDESC( CAI_BaseNPC, CBaseCombatCharacter, "The base class all NPC
1233312333

1233412334
DEFINE_SCRIPTFUNC( IsCommandable, "Check if the NPC is commandable." )
1233512335
DEFINE_SCRIPTFUNC( IsInPlayerSquad, "Check if the NPC is in the player's squad." )
12336+
DEFINE_SCRIPTFUNC( IsMedic, "Returns true if this NPC is a medic." )
1233612337

1233712338
DEFINE_SCRIPTFUNC_NAMED( VScriptGetCine, "GetCine", "Get the NPC's currently running scripted sequence if it has one." )
1233812339
DEFINE_SCRIPTFUNC( GetScriptState, "Get the NPC's current scripted sequence state." )

sp/src/game/server/baseentity.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10300,8 +10300,9 @@ bool CBaseEntity::ScriptAddOutput( const char *pszOutputName, const char *pszTar
1030010300
const char *CBaseEntity::ScriptGetKeyValue( const char *pszKeyName )
1030110301
{
1030210302
static char szValue[128];
10303-
GetKeyValue( pszKeyName, szValue, sizeof(szValue) );
10304-
return szValue;
10303+
if ( GetKeyValue( pszKeyName, szValue, sizeof(szValue) ) )
10304+
return szValue;
10305+
return NULL;
1030510306
}
1030610307

1030710308
//-----------------------------------------------------------------------------

sp/src/game/server/hl2/npc_citizen17.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,6 @@ ScriptHook_t CNPC_Citizen::g_Hook_SelectModel;
412412

413413
BEGIN_ENT_SCRIPTDESC( CNPC_Citizen, CAI_BaseActor, "npc_citizen from Half-Life 2" )
414414

415-
DEFINE_SCRIPTFUNC( IsMedic, "Returns true if this citizen is a medic." )
416415
DEFINE_SCRIPTFUNC( IsAmmoResupplier, "Returns true if this citizen is an ammo resupplier." )
417416
DEFINE_SCRIPTFUNC( CanHeal, "Returns true if this citizen is a medic or ammo resupplier currently able to heal/give ammo." )
418417

sp/src/vscript/vscript_squirrel.nut

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,14 @@ class CSimpleCallChainer
118118
119119
function PostScriptExecute()
120120
{
121-
local func;
122-
try {
123-
func = scope[prefix];
124-
} catch(e) {
125-
return;
121+
if ( prefix in scope )
122+
{
123+
local func = scope[prefix];
124+
if ( typeof func == "function" )
125+
{
126+
chain.push(func);
127+
}
126128
}
127-
if (typeof(func) != "function")
128-
return;
129-
chain.push(func);
130129
}
131130

132131
function Call()
@@ -569,4 +568,4 @@ if (developer)
569568
__Documentation.RegisterHelp( "Lerp", "float Lerp(float, float, float)", "" );
570569
__Documentation.RegisterHelp( "SimpleSpline", "float SimpleSpline(float)", "" );
571570
}
572-
)vscript";
571+
)vscript";

0 commit comments

Comments
 (0)