aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts/conversation/_faction_dialogue.gnut
blob: ccb5cd6ebba1b82a21b4356927c20a40ecc652db (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
46
global function FactionDialogue_Init
global function InitFactionDialoguePersistence
global function PlayFactionDialogueToPlayer
global function PlayFactionDialogueToTeam
global function PlayFactionDialogueToTeamExceptPlayer

void function FactionDialogue_Init()
{
	AddCallback_OnClientConnected( AssignEnemyFactionToPlayer )
}

void function InitFactionDialoguePersistence( entity player )
{
	// doesn't seem to be used? required to compile tho
}

void function PlayFactionDialogueToPlayer( string conversationType, entity player )
{
	#if !FACTION_DIALOGUE_ENABLED
		return
	#endif
	
	if ( !ShouldPlayFactionDialogue( conversationType, player ) )
		return
	
	int conversationIndex = GetConversationIndex( conversationType )
	Remote_CallFunction_NonReplay( player, "ServerCallback_PlayFactionDialogue", conversationIndex )
}

void function PlayFactionDialogueToTeam( string conversationType, int team )
{
	foreach ( entity player in GetPlayerArrayOfTeam( team ) ) 
		PlayFactionDialogueToPlayer( conversationType, player )
}

void function PlayFactionDialogueToTeamExceptPlayer( string conversationType, int team, entity except )
{
	foreach ( entity player in GetPlayerArrayOfTeam( team ) ) 
		if ( player != except )
			PlayFactionDialogueToPlayer( conversationType, player ) 
}

void function AssignEnemyFactionToPlayer( entity player )
{
	AssignEnemyFaction( player, expect string( player.GetPersistentVar( "factionChoice" ) ) )
}