mirror of
https://github.com/celisej567/source-sdk-2013.git
synced 2026-09-23 20:09:45 +03:00
Clientside vscript additions:
Added C_BaseCombatCharacter script desc Added boundary checks for script funcs
This commit is contained in:
@@ -178,3 +178,39 @@ BEGIN_PREDICTION_DATA( C_BaseCombatCharacter )
|
||||
DEFINE_PRED_ARRAY( m_hMyWeapons, FIELD_EHANDLE, MAX_WEAPONS, FTYPEDESC_INSENDTABLE ),
|
||||
|
||||
END_PREDICTION_DATA()
|
||||
|
||||
#ifdef MAPBASE_VSCRIPT
|
||||
|
||||
BEGIN_ENT_SCRIPTDESC( C_BaseCombatCharacter, CBaseEntity, "" )
|
||||
DEFINE_SCRIPTFUNC_NAMED( ScriptGetAmmoCount, "GetAmmoCount", "" )
|
||||
DEFINE_SCRIPTFUNC_NAMED( ScriptGetActiveWeapon, "GetActiveWeapon", "" )
|
||||
DEFINE_SCRIPTFUNC_NAMED( ScriptGetWeapon, "GetWeapon", "" )
|
||||
END_SCRIPTDESC();
|
||||
|
||||
|
||||
int C_BaseCombatCharacter::ScriptGetAmmoCount( int i )
|
||||
{
|
||||
Assert( i == -1 || i < MAX_AMMO_SLOTS );
|
||||
|
||||
if ( i < 0 || i >= MAX_AMMO_SLOTS )
|
||||
return NULL;
|
||||
|
||||
return GetAmmoCount( i );
|
||||
}
|
||||
|
||||
HSCRIPT C_BaseCombatCharacter::ScriptGetActiveWeapon()
|
||||
{
|
||||
return ToHScript( GetActiveWeapon() );
|
||||
}
|
||||
|
||||
HSCRIPT C_BaseCombatCharacter::ScriptGetWeapon( int i )
|
||||
{
|
||||
Assert( i >= 0 && i < MAX_WEAPONS );
|
||||
|
||||
if ( i < 0 || i >= MAX_WEAPONS )
|
||||
return NULL;
|
||||
|
||||
return ToHScript( GetWeapon(i) );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user