From f6d204861ca6a28821601379f6b11bbd10ea82fb Mon Sep 17 00:00:00 2001 From: SokyranTheDragon <36712560+SokyranTheDragon@users.noreply.github.com> Date: Tue, 6 Feb 2024 01:49:41 +0100 Subject: [PATCH] Fix warnings (#425) * Fix compiler warnings - Pause locks were made obsolete, but moving from them would require extra work and time - disabling warning for it. - Fields marked with `MpCompatSyncField` are considered never assigned to if private or internal. Can be fixed by making them public or protected (including private protected and internal protected). Both public and protected internal would allow them to be accessed from other types, while protected and private protected would be basically identical (due to us never needing to make a subtype of any of our patch types). * Include SimpleSidearms change as well --- Source/DialogUtilities.cs | 2 ++ Source/Mods/SimpleSidearms.cs | 2 +- Source/Mods/VanillaFactionsTribal.cs | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/DialogUtilities.cs b/Source/DialogUtilities.cs index 6cba2997..9f1638a5 100644 --- a/Source/DialogUtilities.cs +++ b/Source/DialogUtilities.cs @@ -91,7 +91,9 @@ public static void InitializeDialogPauseLock() { if (isPauseLockInitialized) return; +#pragma warning disable CS0618 // Type or member is obsolete MP.RegisterPauseLock(IsPausingDialogOpen); +#pragma warning restore CS0618 // Type or member is obsolete isPauseLockInitialized = true; } diff --git a/Source/Mods/SimpleSidearms.cs b/Source/Mods/SimpleSidearms.cs index 65675bbc..bf9760ca 100644 --- a/Source/Mods/SimpleSidearms.cs +++ b/Source/Mods/SimpleSidearms.cs @@ -16,7 +16,7 @@ public class SimpleSidearmsCompat { // TODO: Suggest the author to encapsulate this, would simplify things so much [MpCompatSyncField("SimpleSidearms.rimworld.CompSidearmMemory", "primaryWeaponMode")] - private static ISyncField primaryWeaponModeSyncField; + protected static ISyncField primaryWeaponModeSyncField; public SimpleSidearmsCompat(ModContentPack mod) { diff --git a/Source/Mods/VanillaFactionsTribal.cs b/Source/Mods/VanillaFactionsTribal.cs index 93361740..588ada1c 100644 --- a/Source/Mods/VanillaFactionsTribal.cs +++ b/Source/Mods/VanillaFactionsTribal.cs @@ -71,9 +71,9 @@ public VanillaFactionsTribal(ModContentPack mod) // GameComponent_Tribals private static AccessTools.FieldRef tribalsGameCompInstance; [MpCompatSyncField("VFETribals.GameComponent_Tribals", "ethos")] - private static ISyncField tribalsGameCompEthosField; + protected static ISyncField tribalsGameCompEthosField; [MpCompatSyncField("VFETribals.GameComponent_Tribals", "ethosLocked")] - private static ISyncField tribalsGameCompEthosLockedField; + protected static ISyncField tribalsGameCompEthosLockedField; // Window_CustomizeCornerstones private static Type customizeCornerstonesWindowType;