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 6ea121cdc5
Signed by: GenZmeY
GPG Key ID: 424DA4BC3CB2CF39

View File

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