aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts
diff options
context:
space:
mode:
authorzxcPandora <81985226+zxcPandora@users.noreply.github.com>2022-08-01 02:48:34 +0800
committerGitHub <noreply@github.com>2022-07-31 20:48:34 +0200
commitff279c0a1e36308c199f13f1edd93775ed79225a (patch)
treed1e38431efd8dd281239755db3eefdc4b4aa3eea /Northstar.CustomServers/mod/scripts/vscripts
parent960e64fbecfbf62f32df0d4d69332edbd230f1de (diff)
downloadNorthstarMods-ff279c0a1e36308c199f13f1edd93775ed79225a.tar.gz
NorthstarMods-ff279c0a1e36308c199f13f1edd93775ed79225a.zip
[FD]Fix unlimited ammo setting (#459)
* Fix unlimited ammo setting
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut30
1 files changed, 29 insertions, 1 deletions
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<entity> weapons = player.GetMainWeapons()
+ foreach ( entity weaponEnt in weapons )
+ {
+ if ( weaponEnt.GetWeaponType() != WT_ANTITITAN )
+ continue
+
+ if( !weaponEnt.HasMod( "at_unlimited_ammo" ) )
+ {
+ array<string> mods = weaponEnt.GetMods()
+ mods.append( "at_unlimited_ammo" )
+ weaponEnt.SetMods( mods )
+ }
+ }
+}
+
void function FD_TeamReserveDepositOrWithdrawCallback( entity player, string action, int amount )
{
switch( action )