Skip to content

Commit

Permalink
2.9.2 fixes (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hazzer authored Jun 2, 2024
1 parent a1e1060 commit 5f00c3c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 35 deletions.
Binary file modified 1.5/Assemblies/Locks.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@
<downloadUrl>https://github.com/pardeike/HarmonyRimWorld/releases/latest</downloadUrl>
</li>
</modDependencies>
<description>Version 2.9.1\nThis addon adds Lock command on every door.\n - Left-click to lock toggle.\n - Right click for more options\n - Alternatively you can use "Lock" inspector tab\n\nNote: Door lock must be flicked by colonist.</description>
<description>Version 2.9.2\nThis addon adds Lock command on every door.\n - Left-click to lock toggle.\n - Right click for more options\n - Alternatively you can use "Lock" inspector tab\n\nNote: Door lock must be flicked by colonist.</description>
</ModMetaData>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</p>
<p align="center">
<a href="https://github.com/Aviuz/Locks/releases">
<img src="https://img.shields.io/badge/version-2.9.1-blue.svg?style=flat" alt="v2.9.1" />
<img src="https://img.shields.io/badge/version-2.9.2-blue.svg?style=flat" alt="v2.9.2" />
</a>
</p>

Expand Down
47 changes: 14 additions & 33 deletions Source/CompatibilityPatches/DoorsExpanded.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,19 @@

namespace Locks.CompatibilityPatches
{
class DoorsExpanded
class DoorsExpanded
{
public static void Init()
{
public static void Init()
{
var mod = LoadedModManager.RunningMods.FirstOrDefault(m => m.Name == "Doors Expanded (Dev)" || m.Name == "Doors Expanded");
if (mod != null)
{
var doorDef = AccessTools.Method("DoorsExpanded.Building_DoorExpanded:PawnCanOpen");
if (doorDef != null)
{
var harmony = new Harmony("Harmony_Locks_DoorsExpanded");
harmony.Patch(doorDef, transpiler: new HarmonyMethod(typeof(DoorsExpanded).GetMethod("DoorsExpandedTranspiler")));
Log.Message("Locks: Doors expanded patched");
}
else
{
Log.Error("Locks: found doors expanded but can't find door expanded building def");
}
}
else
{
Log.Message("Locks: Doors expanded not found ");
}
}

public static IEnumerable<CodeInstruction> DoorsExpandedTranspiler(ILGenerator gen, MethodBase mBase, IEnumerable<CodeInstruction> instr)
{
yield return new CodeInstruction(OpCodes.Ldarg_0);
yield return new CodeInstruction(OpCodes.Ldarg_1);
yield return new CodeInstruction(OpCodes.Call, typeof(LockUtility).GetMethod("PawnCanOpen"));
yield return new CodeInstruction(OpCodes.Ret);
}

var mod = LoadedModManager.RunningMods.FirstOrDefault(m => m.Name == "Doors Expanded (Dev)" || m.Name == "Doors Expanded");
if (mod != null)
{
Log.Message("Locks: Doors expanded found");
}
else
{
Log.Message("Locks: Doors expanded not found ");
}
}
}
}
}
2 changes: 2 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Changelog:
2.9.2
- Doors Expanded fixes
2.9.1
- Reverted back files version for Rimworld 1.4
- Future new futures will be only for Rimworld 1.5+
Expand Down

0 comments on commit 5f00c3c

Please sign in to comment.