Skip to content

Commit

Permalink
Disable PlanetFactory.FlushPools in multiplayer game
Browse files Browse the repository at this point in the history
  • Loading branch information
starfi5h committed Aug 16, 2024
1 parent fd0998b commit efff3e1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions NebulaPatcher/Patches/Dynamic/PlanetFactory_Patch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ namespace NebulaPatcher.Patches.Dynamic;
[HarmonyPatch(typeof(PlanetFactory))]
internal class PlanetFactory_patch
{
[HarmonyPrefix]
[HarmonyPatch(nameof(PlanetFactory.FlushPools))]
public static bool FlushPools_Prefix()
{
// In vanilla, FlushPools is triggered by unload planet event which will happen at different time for each player
// So this optimize pool function is disabled in multiplayer to keep pool in sync
return !Multiplayer.IsActive;
}


[HarmonyPostfix]
[HarmonyPatch(nameof(PlanetFactory.AddPrebuildData))]
public static void AddPrebuildData_Postfix(PlanetFactory __instance, ref int __result)
Expand Down

0 comments on commit efff3e1

Please sign in to comment.