diff --git a/About/About.xml b/About/About.xml index abc55fe..e78fd91 100755 --- a/About/About.xml +++ b/About/About.xml @@ -2,9 +2,9 @@ rwmt.MultiplayerCompatibility Multiplayer Compatibility - notfood + RimWorld Multiplayer Team -
  • 1.4
  • +
  • 1.5
  • Miscellaneous patches to make Multiplayer work Mod Support: diff --git a/Source/DebugActions.cs b/Source/DebugActions.cs index 1985a68..f55d21b 100644 --- a/Source/DebugActions.cs +++ b/Source/DebugActions.cs @@ -10,6 +10,7 @@ using HarmonyLib; using RimWorld; using RimWorld.Planet; +using LudeonTK; using UnityEngine; using Verse; using Random = System.Random; @@ -456,4 +457,4 @@ private static bool IsOverrideOfAny(MethodInfo method, HashSet possi #endregion } -} \ No newline at end of file +} diff --git a/Source/Mods/BiotechExpansionMythic.cs b/Source/Mods/BiotechExpansionMythic.cs index 945aab6..394c1ae 100644 --- a/Source/Mods/BiotechExpansionMythic.cs +++ b/Source/Mods/BiotechExpansionMythic.cs @@ -41,7 +41,7 @@ private static void LatePatch() { foreach (var typeName in new[] { "BTE_MY.GeneGizmo_ResourceAurum", "BTE_MY.GeneGizmo_ResourceReverence" }) { - MpCompat.harmony.Patch(AccessTools.DeclaredMethod($"{typeName}:{nameof(GeneGizmo_Resource.DrawLabel)}"), + MpCompat.harmony.Patch(AccessTools.DeclaredMethod($"{typeName}:{nameof(GeneGizmo_Resource.DrawHeader)}"), prefix: new HarmonyMethod(typeof(BiotechExpansionMythic), nameof(PreDrawLabel))); } } diff --git a/Source/Mods/RimFridge.cs b/Source/Mods/RimFridge.cs index ccf29c4..cdd21b3 100644 --- a/Source/Mods/RimFridge.cs +++ b/Source/Mods/RimFridge.cs @@ -26,7 +26,7 @@ public RimFridgeCompat(ModContentPack mod) dialogType = AccessTools.TypeByName("RimFridge.Dialog_RenameFridge"); fridgeField = AccessTools.FieldRefAccess(dialogType, "fridge"); - MP.RegisterSyncWorker(SyncFridgeName, dialogType); + MP.RegisterSyncWorker(SyncFridgeName, dialogType); MP.RegisterSyncMethod(dialogType, "SetName"); } @@ -36,13 +36,13 @@ public RimFridgeCompat(ModContentPack mod) } } - private static void SyncFridgeName(SyncWorker sync, ref Dialog_Rename dialog) + private static void SyncFridgeName(SyncWorker sync, ref object dialog) { if (sync.isWriting) sync.Write(fridgeField(dialog)); else { - dialog = (Dialog_Rename)FormatterServices.GetUninitializedObject(dialogType); + dialog = FormatterServices.GetUninitializedObject(dialogType); fridgeField(dialog) = sync.Read(); } } diff --git a/Source/Mods/SignsAndComments.cs b/Source/Mods/SignsAndComments.cs index 4c75182..372326b 100644 --- a/Source/Mods/SignsAndComments.cs +++ b/Source/Mods/SignsAndComments.cs @@ -13,8 +13,8 @@ namespace Multiplayer.Compat public class SignsAndComments { private static ConstructorInfo renameSignDialogCtor; - private static AccessTools.FieldRef dialogColorField; - private static AccessTools.FieldRef dialogSignCompField; + private static AccessTools.FieldRef dialogColorField; + private static AccessTools.FieldRef dialogSignCompField; public SignsAndComments(ModContentPack mod) { @@ -33,11 +33,11 @@ public SignsAndComments(ModContentPack mod) dialogColorField = AccessTools.FieldRefAccess(renameDialogType, "curColor"); dialogSignCompField = AccessTools.FieldRefAccess(renameDialogType, "signComp"); - MP.RegisterSyncMethod(renameDialogType, nameof(Dialog_Rename.SetName)); - MP.RegisterSyncWorker(SyncRenameSignDialog, renameDialogType); + MP.RegisterSyncMethod(renameDialogType, nameof(IRenameable.RenamableLabel)); + MP.RegisterSyncWorker(SyncRenameSignDialog, renameDialogType); } - private static void SyncRenameSignDialog(SyncWorker sync, ref Dialog_Rename dialog) + private static void SyncRenameSignDialog(SyncWorker sync, ref object dialog) { if (sync.isWriting) { @@ -49,7 +49,7 @@ private static void SyncRenameSignDialog(SyncWorker sync, ref Dialog_Rename dial var comp = sync.Read(); var color = sync.Read(); - dialog = (Dialog_Rename)renameSignDialogCtor.Invoke(new object[] { comp }); + dialog = renameSignDialogCtor.Invoke(new object[] { comp }); dialogColorField(dialog) = color; } } diff --git a/Source/Mods/VanillaExpandedFramework.cs b/Source/Mods/VanillaExpandedFramework.cs index 2d54d43..62b2507 100644 --- a/Source/Mods/VanillaExpandedFramework.cs +++ b/Source/Mods/VanillaExpandedFramework.cs @@ -1214,37 +1214,6 @@ private static void PatchDoorTeleporter() renameDoorTeleporterDialogThingField = AccessTools.FieldRefAccess(renameDoorTeleporterDialogType, "DoorTeleporter"); PatchingUtilities.PatchPushPopRand(renameDoorTeleporterDialogConstructor); - MP.RegisterSyncWorker(SyncDialogRenameDoorTeleporter, renameDoorTeleporterDialogType); - MP.RegisterSyncMethod(renameDoorTeleporterDialogType, nameof(Dialog_Rename.SetName)) - // Since we sync the "SetName" method and nothing else, it'll leave the dialog open for - // players who didn't click the button to rename it - we need to manually close it. - .SetPostInvoke((dialog, _) => - { - if (dialog is Window w) - Find.WindowStack.TryRemove(w); - }); - } - - private static void SyncDialogRenameDoorTeleporter(SyncWorker sync, ref Dialog_Rename dialog) - { - if (sync.isWriting) - { - sync.Write(renameDoorTeleporterDialogThingField(dialog)); - sync.Write(dialog.curName); - } - else - { - var doorTeleporter = sync.Read(); - var name = sync.Read(); - - // The dialog may be already open - dialog = Find.WindowStack.Windows.FirstOrDefault(x => x.GetType() == renameDoorTeleporterDialogType) as Dialog_Rename; - // If the dialog is not open, or the open dialog is for a different door - create a new dialog instead - if (dialog == null || renameDoorTeleporterDialogThingField(dialog) != doorTeleporter) - dialog = (Dialog_Rename)renameDoorTeleporterDialogConstructor.Invoke(new object[] { doorTeleporter }); - - dialog.curName = name; - } } #endregion diff --git a/Source/Multiplayer_Compat.csproj b/Source/Multiplayer_Compat.csproj index 741f6c7..a640009 100644 --- a/Source/Multiplayer_Compat.csproj +++ b/Source/Multiplayer_Compat.csproj @@ -15,7 +15,7 @@ - 2.2.* + 2.3.* runtime @@ -23,11 +23,11 @@ runtime - 1.4.* + 1.5.* runtime - 1.0.* + 2.2.* all diff --git a/Source_Referenced/Multiplayer_Compat_Referenced.csproj b/Source_Referenced/Multiplayer_Compat_Referenced.csproj index 54ca41e..e2f4183 100644 --- a/Source_Referenced/Multiplayer_Compat_Referenced.csproj +++ b/Source_Referenced/Multiplayer_Compat_Referenced.csproj @@ -19,7 +19,7 @@ false - 2.2.* + 2.3.* runtime @@ -27,11 +27,11 @@ runtime - 1.4.* + 1.5.* runtime - 1.0.* + 2.2.* all diff --git a/release_bundler.sh b/release_bundler.sh index a3b1221..c824a91 100755 --- a/release_bundler.sh +++ b/release_bundler.sh @@ -2,11 +2,7 @@ set -e -cd Source dotnet build -c Release -cd ../Source_Referenced -dotnet build -c Release -cd .. rm -rf Multiplayer-Compatibility/ mkdir -p Multiplayer-Compatibility