From 7a761341d628fae607d220e7f6cac682d14b0cfe Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Mon, 11 Jul 2022 15:56:21 +0300 Subject: [PATCH] fix premature deletion of RepInfo --- CTI/Classes/CTI.uc | 6 ++--- CTI/Classes/CTI_RepInfo.uc | 39 +++++++++++++++++++----------- PublicationContent/description.txt | 4 +-- 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/CTI/Classes/CTI.uc b/CTI/Classes/CTI.uc index bb81dce..3ce262f 100644 --- a/CTI/Classes/CTI.uc +++ b/CTI/Classes/CTI.uc @@ -87,7 +87,7 @@ private function PreInit() { case `NO_CONFIG: `Log_Info("Config created"); - + case MaxInt: `Log_Info("Config updated to version"@LatestVersion); break; @@ -154,7 +154,7 @@ private function PostInit() if (KFGI.KFGFxManagerClass != class'KFGameInfo_VersusSurvival'.default.KFGFxManagerClass) { `Log_Warn("Found custom 'KFGFxManagerClass' (" $ KFGI.KFGFxManagerClass $ "), there may be compatibility issues"); - `Log_Warn("If you notice problems, try disabling DLC unlock"); + `Log_Warn("If you notice problems, try disabling UnlockDLC"); } KFGI.KFGFxManagerClass = class'CTI_GFxMoviePlayer_Manager_Versus'; @@ -168,7 +168,7 @@ private function PostInit() if (KFGI.KFGFxManagerClass != class'KFGameInfo'.default.KFGFxManagerClass) { `Log_Warn("Found custom 'KFGFxManagerClass' (" $ KFGI.KFGFxManagerClass $ "), there may be compatibility issues"); - `Log_Warn("If you notice problems, try disabling DLC unlock"); + `Log_Warn("If you notice problems, try disabling UnlockDLC"); } KFGI.KFGFxManagerClass = class'CTI_GFxMoviePlayer_Manager'; diff --git a/CTI/Classes/CTI_RepInfo.uc b/CTI/Classes/CTI_RepInfo.uc index 817a439..868f3fe 100644 --- a/CTI/Classes/CTI_RepInfo.uc +++ b/CTI/Classes/CTI_RepInfo.uc @@ -34,7 +34,7 @@ replication public simulated function bool SafeDestroy() { `Log_Trace(`Location); - + return (bPendingDelete || bDeleteMe || Destroy()); } @@ -138,10 +138,12 @@ private simulated function UpdateNotification(String Title, String Downloading, private reliable client function ClientSync(class WeapDef, optional bool Remove = false) { `Log_Trace(`Location); - + if (WeapDef == None) { `Log_Fatal("WeapDef is:" @ WeapDef); + Cleanup(); + ConsoleCommand("Disconnect"); SafeDestroy(); return; } @@ -187,12 +189,12 @@ private simulated function KeepNotification() private simulated reliable client function ClientSyncFinished() { local KFGameReplicationInfo KFGRI; - + `Log_Trace(`Location); if (WorldInfo.GRI == None) { - `Log_Debug("ClientSyncFinished: WorldInfo.GRI == None"); + `Log_Debug("ClientSyncFinished: Waiting GRI"); NotificationHeaderText = "Waiting for GameReplicationInfo..."; NotificationLeftText = String(++WaitingGRI) $ "s"; SetTimer(1.0f, false, nameof(ClientSyncFinished)); @@ -202,11 +204,13 @@ private simulated reliable client function ClientSyncFinished() KFGRI = KFGameReplicationInfo(WorldInfo.GRI); if (KFGRI == None) { - `Log_Fatal("Incompatible Replication info:" @ WorldInfo.GRI); + `Log_Fatal("Incompatible Replication info:" @ String(WorldInfo.GRI)); ClearTimer(nameof(KeepNotification)); UpdateNotification( - "Error: Incompatible Replication info:" @ WorldInfo.GRI, - "", "", 0); + "Error: Incompatible Replication info:" @ String(WorldInfo.GRI), + "Disconnect...", "", 0); + Cleanup(); + ConsoleCommand("Disconnect"); SafeDestroy(); return; } @@ -217,9 +221,23 @@ private simulated reliable client function ClientSyncFinished() ClearTimer(nameof(KeepNotification)); ShowReadyButton(); + Cleanup(); + SafeDestroy(); } +private reliable server function Cleanup() +{ + `Log_Trace(`Location); + + `Log_Debug("Cleanup"); + if (!CTI.DestroyRepLink(Controller(Owner))) + { + `Log_Debug("Cleanup (forced)"); + SafeDestroy(); + } +} + public reliable server function ServerSync() { `Log_Trace(`Location); @@ -232,13 +250,7 @@ public reliable server function ServerSync() if (SyncSize <= Recieved || WorldInfo.NetMode == NM_StandAlone) { `Log_Debug("ServerSync: SyncFinished"); - ClientSyncFinished(); - - if (!CTI.DestroyRepLink(Controller(Owner))) - { - SafeDestroy(); - } } else { @@ -264,6 +276,5 @@ defaultproperties NotificationHeaderText = "Sync trader items, please wait..." NotificationPercent = 0 - WaitingGRI = 0 } diff --git a/PublicationContent/description.txt b/PublicationContent/description.txt index 7caa9f7..3a9ceef 100644 --- a/PublicationContent/description.txt +++ b/PublicationContent/description.txt @@ -51,8 +51,8 @@ For example: [b]Item=WeaponPack.KFWeapDef_XM25[/b] will add [url=https://steamco 📌 Mutator does not contain custom weapons. You must have the required weapon packs in your subscriptions to be able to add them to the trader. 📌 If you are using this mutator to add weapons, you should [b]not[/b] use mutators from weapon packs (just having them in subscriptions is enough). 📌 Unlike [url=https://steamcommunity.com/sharedfiles/filedetails/?id=2193261170]DLC Weapon Unlocker[/url], a different method is used here. -[url=https://steamcommunity.com/sharedfiles/filedetails/?id=2193261170]DLC Weapon Unlocker[/url] creates clones of DLC weapons and adds them to the trader. This allows you not to replace any classes in the game, so Hunter mutator has better compatibility with other mutators. However, those who have already purchased the DLC will not be able to use their skins on clones. -CTI unlocks DLC weapons differently - it changes the trader filter allowing you to buy original DLC weapons without restrictions. Those who bought the DLC can use their skins and you don't need to update the mutator when new kf2 updates are released - unlocking will work with future weapons as well. However, when you set UnlockDLC=True CTI replaces the [b]KFGFxMoviePlayer_Manager[/b] class, so CTI may not be compatible with mods that replaces this class too. If you notice any compatibility issues, try turning off UnlockDLC. +[url=https://steamcommunity.com/sharedfiles/filedetails/?id=2193261170]DLC Weapon Unlocker[/url] creates clones of DLC weapons and adds them to the trader. This allows you not to replace any classes in the game, so Hunter mutator has better compatibility with other mutators, however you need to update DWU every time kf2 update comes out with new guns. +CTI unlocks DLC weapons differently - it changes the trader filter allowing you to buy original DLC weapons without restrictions. You don't need to update the mutator when new kf2 updates are released - unlocking will work with future weapons as well. However, when you set UnlockDLC=True CTI replaces the [b]KFGFxMoviePlayer_Manager[/b] class, so CTI may not be compatible with mods that replaces this class too. If you notice any compatibility issues, try turning off UnlockDLC. You can use this built-in method or add weapons from [url=https://steamcommunity.com/workshop/filedetails/discussion/2193261170/3046108212603783998]DLC Weapon Unlocker[/url] - choose what suits you best. [h1]Sources[/h1]