Skip to content

Commit

Permalink
force GRI init
Browse files Browse the repository at this point in the history
  • Loading branch information
GenZmeY committed Oct 20, 2023
1 parent 18fc55c commit 6dfbcbb
Showing 1 changed file with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions CTI/Classes/CTI_RepInfo.uc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var public bool PendingSync;
var private CTI CTI;
var private E_LogLevel LogLevel;

var private GameReplicationInfo GRI;
var private KFPlayerController KFPC;
var private KFPlayerReplicationInfo KFPRI;
var private KFGFxWidget_PartyInGame PartyInGameWidget;
Expand All @@ -32,6 +33,7 @@ var private String NotificationRightText;
var private int NotificationPercent;

var private int WaitingGRI;
var private int WaitingGRIThreshold;
var private int WaitingGRILimit;

var private ReplicationStruct RepData;
Expand Down Expand Up @@ -138,15 +140,15 @@ private simulated function Finished()

`Log_Trace();

if (WorldInfo.GRI == None && WaitingGRI++ < WaitingGRILimit)
if (GetGRI(WaitingGRI > WaitingGRIThreshold) == None && WaitingGRI++ < WaitingGRILimit)
{
`Log_Debug("Finished: Waiting GRI" @ WaitingGRI);
NotifyWaitingGRI();
SetTimer(1.0f, false, nameof(Finished));
return;
}

KFGRI = KFGameReplicationInfo(WorldInfo.GRI);
KFGRI = KFGameReplicationInfo(GRI);
if (KFGRI != None)
{
`Log_Debug("Finished: Trader.static.OverwriteTraderItems");
Expand All @@ -155,7 +157,7 @@ private simulated function Finished()
}
else
{
`Log_Error("Incompatible Replication info:" @ String(WorldInfo.GRI));
`Log_Error("Incompatible Replication info:" @ String(GRI));
NotifyIncompatibleGRI();
}

Expand Down Expand Up @@ -198,6 +200,29 @@ private simulated function UpdateSkinsDLC()
}
}

private simulated function GameReplicationInfo GetGRI(optional bool ForcedSearch = false)
{
`Log_Trace();

if (GRI == None)
{
GRI = WorldInfo.GRI;
}

if (GRI == None && ForcedSearch)
{
foreach WorldInfo.DynamicActors(class'GameReplicationInfo', GRI) break;
}

if (WorldInfo.GRI == None && GRI != None)
{
`Log_Warn("Force initialization of WorldInfo.GRI" @ String(GRI));
WorldInfo.GRI = GRI;
}

return GRI;
}

private simulated function KFPlayerController GetKFPC()
{
`Log_Trace();
Expand Down Expand Up @@ -388,7 +413,7 @@ private simulated function NotifyIncompatibleGRI()
WriteToChatLocalized(
CTI_IncompatibleGRI,
class'KFLocalMessage'.default.InteractionColor,
String(WorldInfo.GRI.class));
String(GRI.class));
WriteToChatLocalized(
CTI_IncompatibleGRIWarning,
class'KFLocalMessage'.default.InteractionColor);
Expand All @@ -404,5 +429,6 @@ defaultproperties

NotificationPercent = 0
WaitingGRI = 0
WaitingGRIThreshold = 15
WaitingGRILimit = 30
}

0 comments on commit 6dfbcbb

Please sign in to comment.