global function BattleChatter_Init global function PlayBattleChatterLine global function TryPlayWeaponBattleChatterLine void function BattleChatter_Init() { AddCallback_OnPlayerGetsNewPilotLoadout( UpdatePlayerVoiceIndex ) } void function PlayBattleChatterLine( entity player, string conversationType ) { int conversationIndex = GetConversationIndex( conversationType ) foreach( entity otherPlayer in GetPlayerArray() ) if ( ShouldPlayBattleChatter( conversationType, otherPlayer, player ) && player != otherPlayer ) Remote_CallFunction_Replay( otherPlayer, "ServerCallback_PlayBattleChatter", conversationIndex, player.GetEncodedEHandle() ) } void function TryPlayWeaponBattleChatterLine( entity player, entity weapon ) { var chatterEvent = weapon.GetWeaponInfoFileKeyField( "battle_chatter_event" ) if ( chatterEvent == null ) return expect string( chatterEvent ) PlayBattleChatterLine( player, chatterEvent ) } void function UpdatePlayerVoiceIndex( entity player, PilotLoadoutDef voiceIndex ) { if ( IsPlayerFemale( player ) ) { if ( player.IsMechanical() ) player.SetPlayerNetInt( "battleChatterVoiceIndex", SelectRandomAndroidFemaleBattleChatterVoice() ) else player.SetPlayerNetInt( "battleChatterVoiceIndex", SelectRandomFemaleBattleChatterVoice() ) } else { if ( player.IsMechanical() ) player.SetPlayerNetInt( "battleChatterVoiceIndex", SelectRandomAndroidMaleBattleChatterVoice() ) else player.SetPlayerNetInt( "battleChatterVoiceIndex", SelectRandomMaleBattleChatterVoice() ) } }