try to force init WorldInfo.GRI if possible

This commit is contained in:
GenZmeY 2023-10-08 21:38:55 +03:00
parent 2b45b7ae56
commit e0f6ab61b0
Signed by: GenZmeY
GPG Key ID: 424DA4BC3CB2CF39

View File

@ -19,6 +19,7 @@ var public bool PendingSync;
var private LTI LTI; var private LTI LTI;
var private E_LogLevel LogLevel; var private E_LogLevel LogLevel;
var private GameReplicationInfo GRI;
var private KFPlayerController KFPC; var private KFPlayerController KFPC;
var private KFGFxWidget_PartyInGame PartyInGameWidget; var private KFGFxWidget_PartyInGame PartyInGameWidget;
var private GFxObject Notification; var private GFxObject Notification;
@ -29,6 +30,7 @@ var private String NotificationRightText;
var private int NotificationPercent; var private int NotificationPercent;
var private int WaitingGRI; var private int WaitingGRI;
var private int WaitingGRIThreshold;
var private int WaitingGRILimit; var private int WaitingGRILimit;
var private ReplicationStruct RepData; var private ReplicationStruct RepData;
@ -131,7 +133,7 @@ private simulated function Finished()
`Log_Trace(); `Log_Trace();
if (WorldInfo.GRI == None && WaitingGRI++ < WaitingGRILimit) if (GetGRI(WaitingGRI > WaitingGRIThreshold) == None && WaitingGRI++ < WaitingGRILimit)
{ {
`Log_Debug("Finished: Waiting GRI" @ WaitingGRI); `Log_Debug("Finished: Waiting GRI" @ WaitingGRI);
NotifyWaitingGRI(); NotifyWaitingGRI();
@ -139,7 +141,7 @@ private simulated function Finished()
return; return;
} }
KFGRI = KFGameReplicationInfo(WorldInfo.GRI); KFGRI = KFGameReplicationInfo(GRI);
if (KFGRI != None) if (KFGRI != None)
{ {
`Log_Debug("Finished: Trader.static.OverwriteTraderItems"); `Log_Debug("Finished: Trader.static.OverwriteTraderItems");
@ -148,7 +150,7 @@ private simulated function Finished()
} }
else else
{ {
`Log_Error("Incompatible Replication info:" @ String(WorldInfo.GRI)); `Log_Error("Incompatible Replication info:" @ String(GRI));
NotifyIncompatibleGRI(); NotifyIncompatibleGRI();
} }
@ -156,6 +158,29 @@ private simulated function Finished()
ClientCleanup(); ClientCleanup();
} }
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() private simulated function KFPlayerController GetKFPC()
{ {
`Log_Trace(); `Log_Trace();
@ -332,7 +357,7 @@ private simulated function NotifyIncompatibleGRI()
WriteToChatLocalized( WriteToChatLocalized(
LTI_IncompatibleGRI, LTI_IncompatibleGRI,
class'KFLocalMessage'.default.InteractionColor, class'KFLocalMessage'.default.InteractionColor,
String(WorldInfo.GRI.class)); String(GRI.class));
WriteToChatLocalized( WriteToChatLocalized(
LTI_IncompatibleGRIWarning, LTI_IncompatibleGRIWarning,
class'KFLocalMessage'.default.InteractionColor); class'KFLocalMessage'.default.InteractionColor);
@ -348,5 +373,6 @@ defaultproperties
NotificationPercent = 0 NotificationPercent = 0
WaitingGRI = 0 WaitingGRI = 0
WaitingGRILimit = 30 WaitingGRIThreshold = 10
WaitingGRILimit = 20
} }