aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod
diff options
context:
space:
mode:
Diffstat (limited to 'Northstar.CustomServers/mod')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut53
1 files changed, 40 insertions, 13 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut
index c31bcac4..36ebeecf 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut
@@ -46,6 +46,7 @@ struct {
float harvesterDamageTaken
table<entity,player_struct_fd> players
entity harvester_info
+ bool playersHaveTitans = false
}file
void function GamemodeFD_Init()
@@ -63,6 +64,7 @@ void function GamemodeFD_Init()
Riff_ForceBoostAvailability( eBoostAvailability.Disabled )
PlayerEarnMeter_SetEnabled( false )
SetShouldUsePickLoadoutScreen( true )
+ TeamTitanSelectMenu_Init() // show the titan select menu in this mode
//general Callbacks
AddCallback_EntitiesDidLoad( LoadEntities )
@@ -80,7 +82,7 @@ void function GamemodeFD_Init()
//Spawn Callbacks
AddSpawnCallback( "npc_titan", HealthScaleByDifficulty )
AddSpawnCallback( "npc_super_spectre", HealthScaleByDifficulty )
- AddSpawnCallback( "player", FD_PlayerRespawnCallback )
+ AddCallback_OnPlayerRespawned( FD_PlayerRespawnCallback )
AddSpawnCallback("npc_turret_sentry", AddTurretSentry )
//death Callbacks
AddCallback_OnNPCKilled( OnNpcDeath )
@@ -108,8 +110,19 @@ void function FD_PlayerRespawnCallback( entity player )
{
if( player in file.players )
file.players[player].lastRespawn = Time()
+
+ if ( !file.playersHaveTitans )
+ {
+ // why in the fuck do i need to WaitFrame() here, this sucks
+ thread PlayerEarnMeter_SetMode_Threaded( player, 0 )
+ }
+}
- Highlight_SetFriendlyHighlight( player, "sp_friendly_hero" )
+void function PlayerEarnMeter_SetMode_Threaded( entity player, int mode )
+{
+ WaitFrame()
+ if ( IsValid( player ) )
+ PlayerEarnMeter_SetMode( player, mode )
}
void function FD_TeamReserveDepositOrWithdrawCallback( entity player, string action, int amount )
@@ -163,15 +176,25 @@ void function GamemodeFD_InitPlayer( entity player )
data.diedThisRound = false
file.players[player] <- data
thread SetTurretSettings_threaded( player )
- if( GetGlobalNetInt( "FD_currentWave" ) > 1 )
- PlayerEarnMeter_AddEarnedAndOwned( player, 1.0, 1.0 )
+ // only start the highlight when we start playing, not during dropship
+ if ( GetGameState() >= eGameState.Playing )
+ Highlight_SetFriendlyHighlight( player, "sp_friendly_hero" )
- if ( GetGlobalNetInt( "FD_currentWave" ) != 0 )
- DisableTitanSelectionForPlayer( player ) // this might need moving to when they exit the titan selection UI when we do that
- else
- EnableTitanSelectionForPlayer( player )
+ if( file.playersHaveTitans ) // first wave is index 0
+ {
+ PlayerEarnMeter_AddEarnedAndOwned( player, 1.0, 1.0 )
+ }
+ // unfortunate that i cant seem to find a nice callback for them exiting that menu but thisll have to do
+ thread TryDisableTitanSelectionForPlayerAfterDelay( player, TEAM_TITAN_SELECT_DURATION_MIDGAME )
+}
+void function TryDisableTitanSelectionForPlayerAfterDelay( entity player, float waitAmount )
+{
+ wait waitAmount
+ if ( file.playersHaveTitans )
+ DisableTitanSelectionForPlayer( player )
}
+
void function SetTurretSettings_threaded( entity player )
{ //has to be delayed because PlayerConnect callbacks get called in wrong order
WaitFrame()
@@ -288,6 +311,10 @@ bool function useShieldBoost( entity player, array<string> args )
void function startMainGameLoop()
{
+ // only start the highlight when we start playing, not during dropship
+ foreach ( entity player in GetPlayerArray() )
+ Highlight_SetFriendlyHighlight( player, "sp_friendly_hero" )
+
thread mainGameLoop()
}
@@ -307,17 +334,16 @@ void function mainGameLoop()
showShop = true
foreach( entity player in GetPlayerArray() )
{
+ PlayerEarnMeter_SetMode( player, 1 ) // show the earn meter
PlayerEarnMeter_AddEarnedAndOwned( player, 1.0, 1.0 )
}
+ file.playersHaveTitans = true
DisableTitanSelection()
}
- else if( i + 1 == waveEvents.len() )
- {
- EnableTitanSelection()
- }
-
}
+ // end of game
+ EnableTitanSelection()
}
@@ -649,6 +675,7 @@ bool function runWave( int waveIndex, bool shouldDoBuyTime )
PlayFactionDialogueToPlayer( "fd_wavePayoutAddtnl", player )
AddPlayerScore( player, "FDTeamWave" )
AddMoneyToPlayer( player, GetCurrentPlaylistVarInt( "fd_money_per_round", 600 ) )
+ // is this in the right place? do we want to be adding for each player?
// this function is called "Set" but in reality it is "Add"
SetJoinInProgressBonus( GetCurrentPlaylistVarInt( "fd_money_per_round" ,600 ) )
EmitSoundOnEntityOnlyToPlayer( player, player, "HUD_MP_BountyHunt_BankBonusPts_Deposit_Start_1P" )