From ff279c0a1e36308c199f13f1edd93775ed79225a Mon Sep 17 00:00:00 2001 From: zxcPandora <81985226+zxcPandora@users.noreply.github.com> Date: Mon, 1 Aug 2022 02:48:34 +0800 Subject: [FD]Fix unlimited ammo setting (#459) * Fix unlimited ammo setting --- .../scripts/vscripts/gamemodes/_gamemode_fd.nut | 30 +++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut index f177f1ca..674d08df 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut @@ -73,6 +73,7 @@ void function GamemodeFD_Init() AddCallback_GameStateEnter( eGameState.Playing, startMainGameLoop ) AddCallback_OnRoundEndCleanup( FD_NPCCleanup ) AddCallback_OnClientConnected( GamemodeFD_InitPlayer ) + AddCallback_OnPlayerGetsNewPilotLoadout( FD_OnPlayerGetsNewPilotLoadout ) //Damage Callbacks AddDamageByCallback( "player", FD_DamageByPlayerCallback) @@ -111,7 +112,10 @@ void function FD_PlayerRespawnCallback( entity player ) { if( player in file.players ) file.players[player].lastRespawn = Time() - + + if( GetCurrentPlaylistVarInt( "fd_at_unlimited_ammo", 1 ) ) + FD_GivePlayerInfiniteAntiTitanAmmo( player ) + if ( !file.playersHaveTitans ) { // why in the fuck do i need to WaitFrame() here, this sucks @@ -119,6 +123,7 @@ void function FD_PlayerRespawnCallback( entity player ) } } + void function PlayerEarnMeter_SetMode_Threaded( entity player, int mode ) { WaitFrame() @@ -126,6 +131,29 @@ void function PlayerEarnMeter_SetMode_Threaded( entity player, int mode ) PlayerEarnMeter_SetMode( player, mode ) } +void function FD_OnPlayerGetsNewPilotLoadout( entity player, PilotLoadoutDef loadout ) +{ + if( GetCurrentPlaylistVarInt( "fd_at_unlimited_ammo", 1 ) ) + FD_GivePlayerInfiniteAntiTitanAmmo( player ) +} + +void function FD_GivePlayerInfiniteAntiTitanAmmo( entity player ) +{ + array weapons = player.GetMainWeapons() + foreach ( entity weaponEnt in weapons ) + { + if ( weaponEnt.GetWeaponType() != WT_ANTITITAN ) + continue + + if( !weaponEnt.HasMod( "at_unlimited_ammo" ) ) + { + array mods = weaponEnt.GetMods() + mods.append( "at_unlimited_ammo" ) + weaponEnt.SetMods( mods ) + } + } +} + void function FD_TeamReserveDepositOrWithdrawCallback( entity player, string action, int amount ) { switch( action ) -- cgit v1.2.3