aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhummusbird <hummusbirb@gmail.com>2022-01-03 23:30:38 +0000
committerGitHub <noreply@github.com>2022-01-03 20:30:38 -0300
commitc33765a988cef4d23e9f8a1098162ba68a22e6d0 (patch)
treec025a51a12812d236debae67f5769f750cb83a80
parente6fe22fca4550581445054d6e9f9ffd93474f8a6 (diff)
downloadNorthstarMods-c33765a988cef4d23e9f8a1098162ba68a22e6d0.tar.gz
NorthstarMods-c33765a988cef4d23e9f8a1098162ba68a22e6d0.zip
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
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/_disallowed_weapons.gnut12
1 files changed, 9 insertions, 3 deletions
diff --git a/Northstar.Custom/mod/scripts/vscripts/_disallowed_weapons.gnut b/Northstar.Custom/mod/scripts/vscripts/_disallowed_weapons.gnut
index 8dc0300f..10eef575 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 )
+}