aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts/conversation/_battle_chatter.gnut
blob: 842c7f618020b2243f02815616a17c33132158a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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 GetPlayerArrayOfTeam( player.GetTeam() ) )
		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() )
	}
}