Skip to content

Commit

Permalink
only apply ViviKo overrides to Vanilla items
Browse files Browse the repository at this point in the history
  • Loading branch information
mattymatty97 committed Oct 29, 2024
1 parent c9041d4 commit 3908da4
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
7 changes: 7 additions & 0 deletions Nuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="BepInEx" value="https://nuget.bepinex.dev/v3/index.json" />
<add key="AAron Thunderstore" value="https://nuget.windows10ce.com/nuget/v3/index.json" />
</packageSources>
</configuration>
2 changes: 1 addition & 1 deletion Plugin/Plugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<RootNamespace>MattyFixes</RootNamespace>
<AssemblyName>$(RootNamespace)</AssemblyName>
<Product>Matty's Fixes</Product>
<Version>1.1.29</Version>
<Version>1.1.30</Version>
<PackageLicenseExpression>GPL-3.0</PackageLicenseExpression>
<TargetFramework>netstandard2.1</TargetFramework>
<LangVersion>Latest</LangVersion>
Expand Down
2 changes: 1 addition & 1 deletion Plugin/src/MattyFixes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
2 changes: 1 addition & 1 deletion Plugin/src/Patches/ItemPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
15 changes: 7 additions & 8 deletions Preloader/src/MattyFixes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Thunderstore/manifest.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down

0 comments on commit 3908da4

Please sign in to comment.