diff --git a/Source/Client/MultiplayerGame.cs b/Source/Client/MultiplayerGame.cs index ad9a1780..076f251e 100644 --- a/Source/Client/MultiplayerGame.cs +++ b/Source/Client/MultiplayerGame.cs @@ -123,7 +123,7 @@ public void ChangeRealPlayerFaction(int newFaction) ChangeRealPlayerFaction(Find.FactionManager.GetById(newFaction)); } - public void ChangeRealPlayerFaction(Faction newFaction) + public void ChangeRealPlayerFaction(Faction newFaction, bool regenMapDrawers = true) { Log.Message($"Changing real player faction to {newFaction} from {myFaction}"); @@ -136,7 +136,8 @@ public void ChangeRealPlayerFaction(Faction newFaction) foreach (Map m in Find.Maps) { - m.mapDrawer.RegenerateEverythingNow(); + if (regenMapDrawers) + m.mapDrawer.RegenerateEverythingNow(); foreach (var t in m.listerThings.AllThings) if (t is ThingWithComps tc) diff --git a/Source/Client/Saving/SaveLoad.cs b/Source/Client/Saving/SaveLoad.cs index e9e4a347..3e1b3b76 100644 --- a/Source/Client/Saving/SaveLoad.cs +++ b/Source/Client/Saving/SaveLoad.cs @@ -7,6 +7,7 @@ using System.Threading; using System.Xml; using Multiplayer.Client.Saving; +using Multiplayer.Client.Util; using UnityEngine; using Verse; using Verse.Profile; @@ -45,9 +46,14 @@ public static TempGameData SaveAndReload() mapCmds[ScheduledCommand.Global] = Multiplayer.AsyncWorldTime.cmds; - DeepProfiler.Start("Multiplayer SaveAndReload: Save"); - var gameData = SaveGameData(); - DeepProfiler.End(); + TempGameData gameData; + using (DeepProfilerWrapper.Section("Multiplayer SaveAndReload: Save")) + { + // When reloading in multifaction always save as the spectator faction to ensure determinism + if (Multiplayer.GameComp.multifaction) + Multiplayer.game.ChangeRealPlayerFaction(Multiplayer.WorldComp.spectatorFaction, false); + gameData = SaveGameData(); + } MapDrawerRegenPatch.copyFrom = drawers; WorldGridCachePatch.copyFrom = worldGridSaved; diff --git a/Source/Client/Syncing/ImplSerialization.cs b/Source/Client/Syncing/ImplSerialization.cs index 2bc8bc1d..b01c0b4e 100644 --- a/Source/Client/Syncing/ImplSerialization.cs +++ b/Source/Client/Syncing/ImplSerialization.cs @@ -19,6 +19,8 @@ public static void Init() Multiplayer.serialization.AddExplicitImplType(typeof(IThingHolder)); Multiplayer.serialization.AddExplicitImplType(typeof(IReloadableComp)); Multiplayer.serialization.AddExplicitImplType(typeof(Policy)); - Multiplayer.serialization.AddExplicitImplType(typeof(PawnRoleSelectionWidgetBase)); + + // todo for 1.5 + // Multiplayer.serialization.AddExplicitImplType(typeof(PawnRoleSelectionWidgetBase)); } } diff --git a/Source/Common/Version.cs b/Source/Common/Version.cs index 8c5885a6..5bb57fcc 100644 --- a/Source/Common/Version.cs +++ b/Source/Common/Version.cs @@ -2,8 +2,8 @@ namespace Multiplayer.Common { public static class MpVersion { - public const string Version = "0.10"; - public const int Protocol = 42; + public const string Version = "0.10.1"; + public const int Protocol = 43; public const string ApiAssemblyName = "0MultiplayerAPI";