From c33765a988cef4d23e9f8a1098162ba68a22e6d0 Mon Sep 17 00:00:00 2001 From: hummusbird Date: Mon, 3 Jan 2022 23:30:38 +0000 Subject: Fix changing loadouts bypassing restricted weapons (#52) * Fix changing loadouts bypassing restricted weapons Changing loadouts currently ignores the restricted weapon list. * Update _disallowed_weapons.gnut * accidental spaces --- .../mod/scripts/vscripts/_disallowed_weapons.gnut | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'Northstar.Custom/mod/scripts/vscripts') diff --git a/Northstar.Custom/mod/scripts/vscripts/_disallowed_weapons.gnut b/Northstar.Custom/mod/scripts/vscripts/_disallowed_weapons.gnut index 8dc0300f7..10eef575a 100644 --- a/Northstar.Custom/mod/scripts/vscripts/_disallowed_weapons.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/_disallowed_weapons.gnut @@ -9,7 +9,8 @@ struct { void function DisallowedWeapons_Init() { UpdateDisallowedWeaponList() - AddCallback_OnPlayerRespawned( ReplacePlayerWeaponsForSpawn ) + AddCallback_OnPlayerRespawned( ReplacePlayerWeapons ) + AddCallback_OnPlayerGetsNewPilotLoadout( ReplacePlayerWeaponsForLoadoutChange ) } void function UpdateDisallowedWeaponList() @@ -25,7 +26,7 @@ void function UpdateDisallowedWeaponList() file.disallowedWeaponReplacement = GetConVarString( "ns_disallowed_weapon_primary_replacement" ) } -void function ReplacePlayerWeaponsForSpawn( entity player ) +void function ReplacePlayerWeapons( entity player ) { UpdateDisallowedWeaponList() if ( file.disallowedWeapons.len() == 0 ) @@ -45,4 +46,9 @@ void function ReplacePlayerWeaponsForSpawn( entity player ) if ( hadDisallowedWeapon ) SendHudMessage( player, "Restricted weapons were removed", -1, 0.4, 255, 255, 255, 255, 0.15, 3.0, 0.5 ) -} \ No newline at end of file +} + +void function ReplacePlayerWeaponsForLoadoutChange( entity player, PilotLoadoutDef loadout ) +{ + ReplacePlayerWeapons( player ) +} -- cgit v1.2.3