From 3908da4bde03a7f18ce517bac602338e4363095e Mon Sep 17 00:00:00 2001 From: mattymatty Date: Tue, 29 Oct 2024 19:04:24 +0100 Subject: [PATCH] only apply ViviKo overrides to Vanilla items --- Nuget.config | 7 +++++++ Plugin/Plugin.csproj | 2 +- Plugin/src/MattyFixes.cs | 2 +- Plugin/src/Patches/ItemPatches.cs | 2 +- Preloader/src/MattyFixes.cs | 15 +++++++-------- Thunderstore/manifest.json | 2 +- 6 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 Nuget.config diff --git a/Nuget.config b/Nuget.config new file mode 100644 index 0000000..8ff292d --- /dev/null +++ b/Nuget.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Plugin/Plugin.csproj b/Plugin/Plugin.csproj index 48df1ec..16019da 100644 --- a/Plugin/Plugin.csproj +++ b/Plugin/Plugin.csproj @@ -4,7 +4,7 @@ MattyFixes $(RootNamespace) Matty's Fixes - 1.1.29 + 1.1.30 GPL-3.0 netstandard2.1 Latest diff --git a/Plugin/src/MattyFixes.cs b/Plugin/src/MattyFixes.cs index 2ddfbc0..c718316 100644 --- a/Plugin/src/MattyFixes.cs +++ b/Plugin/src/MattyFixes.cs @@ -19,7 +19,7 @@ internal partial class MattyFixes : BaseUnityPlugin { public const string GUID = "mattymatty.MattyFixes"; public const string NAME = "Matty's Fixes"; - public const string VERSION = "1.1.29"; + public const string VERSION = "1.1.30"; internal static ManualLogSource Log; internal static MattyFixes Instance { get; private set; } diff --git a/Plugin/src/Patches/ItemPatches.cs b/Plugin/src/Patches/ItemPatches.cs index e7840e0..15a1923 100644 --- a/Plugin/src/Patches/ItemPatches.cs +++ b/Plugin/src/Patches/ItemPatches.cs @@ -102,7 +102,7 @@ private static void RegisterItems(StartOfRound __instance, bool __runOriginal) VertexCache = VertexesExtensions.GlobalPartialCache }); - if (ItemRotations.TryGetValue(item.itemName, out var value)) + if (mod == "Vanilla" && ItemRotations.TryGetValue(item.itemName, out var value)) { item.restingRotation.Set(value[0], value[1], value[2]); item.floorYOffset = (int)Math.Round(value[1]); diff --git a/Preloader/src/MattyFixes.cs b/Preloader/src/MattyFixes.cs index 4238462..fb8eb91 100644 --- a/Preloader/src/MattyFixes.cs +++ b/Preloader/src/MattyFixes.cs @@ -42,34 +42,33 @@ public static void Patch(AssemblyDefinition assembly) var verticalOffsetField = itemDefinition.Fields.FirstOrDefault(f => f.Name == "verticalOffset"); if (verticalOffsetField == null) return; - + var grabbableType = assembly.MainModule.Types.FirstOrDefault(t => t.FullName == "GrabbableObject"); if (grabbableType == null) return; - + var itemPropertiesField = grabbableType.Fields.FirstOrDefault(f => f.Name == "itemProperties"); if (itemPropertiesField == null) return; - + grabbableType.AddField(FieldAttributes.Assembly, "MattyFixes_localVerticalOffset", verticalOffsetField.FieldType, out var localOffsetField, logHandler); - - + + AssemblyAnalyzer.ProcessAssembly(assembly,itemPropertiesField, verticalOffsetField, localOffsetField, out var count); - + grabbableType.AddMethod("Awake",out var awake, MethodAttributes.Private, grabbableType.Module.TypeSystem.Void, logCallback: logHandler); awake.Body.Instructions.Clear(); var ilProcessor = awake.Body.GetILProcessor(); - + ilProcessor.Emit(OpCodes.Ldarg_0); ilProcessor.Emit(OpCodes.Dup); ilProcessor.Emit(OpCodes.Ldfld, itemPropertiesField); ilProcessor.Emit(OpCodes.Ldfld, verticalOffsetField); ilProcessor.Emit(OpCodes.Stfld, localOffsetField); ilProcessor.Emit(OpCodes.Ret); - } if (!PluginConfig.Enabled.Value) diff --git a/Thunderstore/manifest.json b/Thunderstore/manifest.json index 8c8a4d1..983c718 100644 --- a/Thunderstore/manifest.json +++ b/Thunderstore/manifest.json @@ -1,6 +1,6 @@ { "name": "Matty_Fixes", - "version_number": "1.1.29", + "version_number": "1.1.30", "website_url": "https://github.com/mattymatty97/LTC_MattyFixes", "description": "A collection of Fixes for the vanilla game, with focus on vanilla compatibility.", "dependencies": [