force GRI init

This commit is contained in:
GenZmeY 2023-10-20 23:30:45 +03:00
parent 18fc55ce42
commit 6dfbcbb0b7
Signed by: GenZmeY
GPG Key ID: 424DA4BC3CB2CF39

View File

@ -21,6 +21,7 @@ var public bool PendingSync;
var private CTI CTI; var private CTI CTI;
var private E_LogLevel LogLevel; var private E_LogLevel LogLevel;
var private GameReplicationInfo GRI;
var private KFPlayerController KFPC; var private KFPlayerController KFPC;
var private KFPlayerReplicationInfo KFPRI; var private KFPlayerReplicationInfo KFPRI;
var private KFGFxWidget_PartyInGame PartyInGameWidget; var private KFGFxWidget_PartyInGame PartyInGameWidget;
@ -32,6 +33,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;
@ -138,7 +140,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();
@ -146,7 +148,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");
@ -155,7 +157,7 @@ private simulated function Finished()
} }
else else
{ {
`Log_Error("Incompatible Replication info:" @ String(WorldInfo.GRI)); `Log_Error("Incompatible Replication info:" @ String(GRI));
NotifyIncompatibleGRI(); NotifyIncompatibleGRI();
} }
@ -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() private simulated function KFPlayerController GetKFPC()
{ {
`Log_Trace(); `Log_Trace();
@ -388,7 +413,7 @@ private simulated function NotifyIncompatibleGRI()
WriteToChatLocalized( WriteToChatLocalized(
CTI_IncompatibleGRI, CTI_IncompatibleGRI,
class'KFLocalMessage'.default.InteractionColor, class'KFLocalMessage'.default.InteractionColor,
String(WorldInfo.GRI.class)); String(GRI.class));
WriteToChatLocalized( WriteToChatLocalized(
CTI_IncompatibleGRIWarning, CTI_IncompatibleGRIWarning,
class'KFLocalMessage'.default.InteractionColor); class'KFLocalMessage'.default.InteractionColor);
@ -404,5 +429,6 @@ defaultproperties
NotificationPercent = 0 NotificationPercent = 0
WaitingGRI = 0 WaitingGRI = 0
WaitingGRIThreshold = 15
WaitingGRILimit = 30 WaitingGRILimit = 30
} }