67 lines
1.7 KiB
Ucode
67 lines
1.7 KiB
Ucode
// This class is required to replicate player (speaker) names of KF_PlayerDialogue
|
|
|
|
class PlayerDialogueReplicationInfo extends ReplicationInfo;
|
|
|
|
var name DialogueActorName;
|
|
var int DlgIndex;
|
|
var PlayerReplicationInfo SpeakerPRI;
|
|
|
|
var private int NumTries;
|
|
|
|
replication {
|
|
reliable if ( bNetInitial && Role == ROLE_Authority )
|
|
DialogueActorName;
|
|
|
|
reliable if ( bNetDirty && Role == ROLE_Authority )
|
|
DlgIndex, SpeakerPRI;
|
|
}
|
|
|
|
simulated function PostNetReceive()
|
|
{
|
|
NumTries = 10; // try 10 times to find diealogue, then - give up
|
|
Timer();
|
|
}
|
|
|
|
simulated function Timer()
|
|
{
|
|
local KFPlayerController_Story MyPC;
|
|
local HUD_StoryMode MyHUD;
|
|
local int HUDDlgIndex;
|
|
local KF_DialogueSpot NewDlg;
|
|
|
|
SetTimer(0, false);
|
|
|
|
MyPC = KFPlayerController_Story(Level.GetLocalPlayerController());
|
|
if ( MyPC == none )
|
|
return;
|
|
|
|
MyHUD = HUD_StoryMode(MyPC.MyHUD);
|
|
if ( MyHUD == none )
|
|
return;
|
|
|
|
NewDlg = MyHUD.FindDialogueActor(DialogueActorName);
|
|
if(NewDlg == none)
|
|
{
|
|
log("Warning - could not find Dialogue Actor of name : "@DialogueActorName@" Aborting HUD Render. ", 'PlayerDialogueReplicationInfo');
|
|
return;
|
|
}
|
|
|
|
if(!MyHUD.FindExistingDialogue(NewDlg.Dialogues[DlgIndex].Display.Dialogue_text,HUDDlgIndex)) {
|
|
// try again later - maybe KFPlayerController_Story.ClientShowStoryDialogue() isn't replicated yet
|
|
if ( NumTries > 0) {
|
|
SetTimer(0.1, false);
|
|
NumTries--;
|
|
}
|
|
return;
|
|
}
|
|
|
|
MyHUD.Dialogues[HUDDlgIndex].Speaker = SpeakerPRI.PlayerName;
|
|
MyHUD.Dialogues[HUDDlgIndex].Portrait = SpeakerPRI.GetPortrait();
|
|
}
|
|
|
|
defaultproperties
|
|
{
|
|
NetUpdateFrequency=5.000000
|
|
bNetNotify=True
|
|
}
|