Skip to content

Commit fe74e8a

Browse files
committed
return weapon handle in GiveWeapon script function
for convenience if you want to edit the given weapon, so you dont have to do GetInventoryTable bs
1 parent ce83282 commit fe74e8a

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/game/server/swarm/asw_marine.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3476,13 +3476,13 @@ void CASW_Marine::ScriptGiveAmmo( int iCount, int iAmmoIndex )
34763476
GiveAmmo( iCount, iAmmoIndex, false );
34773477
}
34783478

3479-
void CASW_Marine::ScriptGiveWeapon( const char *pszName, int slot )
3479+
HSCRIPT CASW_Marine::ScriptGiveWeapon( const char *pszName, int slot )
34803480
{
34813481
CASW_Weapon* pWeapon = dynamic_cast<CASW_Weapon*>(Weapon_Create(pszName));
34823482
if ( !pWeapon )
34833483
{
34843484
Msg( "NULL Ent in GiveWeapon!\n" );
3485-
return;
3485+
return NULL;
34863486
}
34873487

34883488
int weaponIndex = GetWeaponPositionForPickup( pWeapon->GetClassname(), pWeapon->m_bIsTemporaryPickup );
@@ -3505,6 +3505,8 @@ void CASW_Marine::ScriptGiveWeapon( const char *pszName, int slot )
35053505
int iClips = GetAmmoDef()->MaxCarry( pWeapon->GetPrimaryAmmoType(), this );
35063506
GiveAmmo( iClips, pWeapon->GetPrimaryAmmoType(), true );
35073507
}
3508+
3509+
return ToHScript( pWeapon );
35083510
}
35093511

35103512
bool CASW_Marine::ScriptDropWeapon( int iWeaponIndex )

src/game/server/swarm/asw_marine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ class CASW_Marine : public CASW_VPhysics_NPC, public IASWPlayerAnimStateHelpers,
549549
int m_nIndexActWeapBeforeTempPickup;
550550

551551
void ScriptGiveAmmo( int iCount, int iAmmoIndex );
552-
void ScriptGiveWeapon( const char *pszName, int slot );
552+
HSCRIPT ScriptGiveWeapon( const char *pszName, int slot );
553553
bool ScriptDropWeapon( int iWeaponIndex );
554554
bool ScriptRemoveWeapon( int iWeaponIndex );
555555
bool ScriptSwitchWeapon( int iWeaponIndex );

0 commit comments

Comments
 (0)