diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-11-07 03:53:07 +0000 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-11-07 03:53:07 +0000 |
commit | 35dfd937798d105238db23ea86f90f21be46694b (patch) | |
tree | d0e1ee639bc6177649dbcbde054f1e6094fc054c /Northstar.CustomServers/mod/scripts/vscripts/mp | |
parent | e79a58640e1ef1ea1c3c954aefccd36c3cb55286 (diff) | |
download | NorthstarMods-35dfd937798d105238db23ea86f90f21be46694b.tar.gz NorthstarMods-35dfd937798d105238db23ea86f90f21be46694b.zip |
code cleanup, xp, postgame and some small changes
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/mp')
4 files changed, 146 insertions, 1 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut index c42899e3..cdefd8c8 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut @@ -220,6 +220,9 @@ void function CodeCallback_OnPlayerRespawned( entity player ) Loadouts_TryGivePilotLoadout( player ) SetHumanRagdollImpactTable( player ) + + foreach ( entity weapon in player.GetMainWeapons() ) + weapon.SetProScreenOwner( player ) foreach ( void functionref( entity ) callback in svGlobal.onPlayerRespawnedCallbacks ) callback( player ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_changemap.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_changemap.nut index 95d7492e..94fda4d7 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_changemap.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_changemap.nut @@ -7,6 +7,9 @@ void function CodeCallback_MatchIsOver() else SetUIVar( level, "putPlayerInMatchmakingAfterDelay", false ) + AddCreditsForXPGained() + PopulatePostgameData() + if ( ShouldReturnToLobby() ) { SetCurrentPlaylist( "private_match" ) // needed for private lobby to load @@ -22,3 +25,73 @@ void function CodeCallback_MatchIsOver() GameRules_ChangeMap( "mp_lobby", GAMETYPE ) #endif // #if DEV } + +void function PopulatePostgameData() +{ + // something's busted here because this isn't showing automatically on match end, ag + foreach ( entity player in GetPlayerArray() ) + { + int teams = GetCurrentPlaylistVarInt( "max_teams", 2 ) + bool standardTeams = teams != 2 + + int enumModeIndex = 0 + int enumMapIndex = 0 + + try + { + enumModeIndex = PersistenceGetEnumIndexForItemName( "gamemodes", GAMETYPE ) + enumMapIndex = PersistenceGetEnumIndexForItemName( "maps", GetMapName() ) + } + catch( ex ) {} + + player.SetPersistentVar( "postGameData.myTeam", player.GetTeam() ) + player.SetPersistentVar( "postGameData.myXuid", player.GetUID() ) + player.SetPersistentVar( "postGameData.gameMode", PersistenceGetEnumIndexForItemName( "gamemodes", GAMETYPE ) ) + player.SetPersistentVar( "postGameData.map", PersistenceGetEnumIndexForItemName( "maps", GetMapName() ) ) + player.SetPersistentVar( "postGameData.teams", standardTeams ) + player.SetPersistentVar( "postGameData.maxTeamSize", teams ) + player.SetPersistentVar( "postGameData.privateMatch", true ) + player.SetPersistentVar( "postGameData.ranked", true ) + player.SetPersistentVar( "postGameData.hadMatchLossProtection", false ) + + player.SetPersistentVar( "isFDPostGameScoreboardValid", GAMETYPE == FD ) + + if ( standardTeams ) + { + if ( player.GetTeam() == TEAM_MILITIA ) + { + player.SetPersistentVar( "postGameData.factionMCOR", GetFactionChoice( player ) ) + player.SetPersistentVar( "postGameData.factionIMC", GetEnemyFaction( player ) ) + } + else + { + player.SetPersistentVar( "postGameData.factionIMC", GetFactionChoice( player ) ) + player.SetPersistentVar( "postGameData.factionMCOR", GetEnemyFaction( player ) ) + } + + player.SetPersistentVar( "postGameData.scoreMCOR", GameRules_GetTeamScore( TEAM_MILITIA ) ) + player.SetPersistentVar( "postGameData.scoreIMC", GameRules_GetTeamScore( TEAM_IMC ) ) + } + else + { + player.SetPersistentVar( "postGameData.factionMCOR", GetFactionChoice( player ) ) + player.SetPersistentVar( "postGameData.scoreMCOR", GameRules_GetTeamScore( player.GetTeam() ) ) + } + + array<entity> otherPlayers = GetPlayerArray() + array<int> scoreTypes = GameMode_GetScoreboardColumnScoreTypes( GAMETYPE ) + int persistenceArrayCount = PersistenceGetArrayCount( "postGameData.players" ) + for ( int i = 0; i < min( otherPlayers.len(), persistenceArrayCount ); i++ ) + { + player.SetPersistentVar( "postGameData.players[" + i + "].team", otherPlayers[ i ].GetTeam() ) + player.SetPersistentVar( "postGameData.players[" + i + "].name", otherPlayers[ i ].GetPlayerName() ) + player.SetPersistentVar( "postGameData.players[" + i + "].xuid", otherPlayers[ i ].GetUID() ) + player.SetPersistentVar( "postGameData.players[" + i + "].callsignIconIndex", otherPlayers[ i ].GetPersistentVarAsInt( "activeCallsignIconIndex" ) ) + + for ( int j = 0; j < scoreTypes.len(); j++ ) + player.SetPersistentVar( "postGameData.players[" + i + "].scores[" + j + "]", otherPlayers[ i ].GetPlayerGameStat( scoreTypes[ j ] ) ) + } + + player.SetPersistentVar( "isPostGameScoreboardValid", true ) + } +}
\ No newline at end of file diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut index 238eab1d..3421419c 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut @@ -17,6 +17,7 @@ struct { void function Score_Init() { + SvXP_Init() AddCallback_OnClientConnected( InitPlayerForScoreEvents ) } diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/pintelemetry.gnut b/Northstar.CustomServers/mod/scripts/vscripts/mp/pintelemetry.gnut index 37b89169..fd4808de 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/pintelemetry.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/pintelemetry.gnut @@ -1 +1,69 @@ -//fuck
\ No newline at end of file +// all stubs because we don't really need this +// if we actually ever want to mess with stats stuff, code already calls all this + +global function PIN_Init +global function PIN_BuyItemWithRealMoney +global function PIN_BuyItem +global function PIN_GiveItem +global function PIN_GiveCredits +global function PIN_ConsumeItem +global function PIN_AddToPlayerCountStat +global function PIN_PlayerAbility +global function PIN_PlayerAbilityReady +global function PIN_DamageDone +global function PIN_PlayerRodeoedEnemyTitanToCompletion + +void function PIN_Init() +{ + +} + +void function PIN_BuyItemWithRealMoney( entity player, bool _0, string name, int cost ) +{ + +} + +void function PIN_BuyItem( entity player, bool _0, string name, int cost ) +{ + +} + +void function PIN_GiveItem( entity player, bool _0, string name, int count ) +{ + +} + +void function PIN_GiveCredits( entity player, int count ) +{ + +} + +void function PIN_ConsumeItem( entity player, string name ) +{ + +} + +void function PIN_AddToPlayerCountStat( entity player, string name ) +{ + +} + +void function PIN_PlayerAbility( entity player, string name, string action, table args, float duration = 0 ) +{ + +} + +void function PIN_PlayerAbilityReady( entity player, string action ) +{ + +} + +void function PIN_DamageDone( entity player, entity victim, var damageInfo ) +{ + +} + +void function PIN_PlayerRodeoedEnemyTitanToCompletion( entity player, entity titan, bool playerHadBattery ) +{ + +}
\ No newline at end of file |