Fixed Loadstone compability to properly target version 16 and 17+
This commit is contained in:
parent
ef4ce26491
commit
b472d9db59
|
@ -68,7 +68,8 @@
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Patch.cs" />
|
<Compile Include="PatchVer16.cs" />
|
||||||
|
<Compile Include="PatchVer17.cs" />
|
||||||
<Compile Include="Plugin.cs" />
|
<Compile Include="Plugin.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
using DunGen.Graph;
|
||||||
|
using DunGen;
|
||||||
|
using DunGenPlus.Collections;
|
||||||
|
using DunGenPlus;
|
||||||
|
using HarmonyLib;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace LoadstoneNighty {
|
||||||
|
|
||||||
|
// patch 16 and below probably requires me to patch the function no matter what
|
||||||
|
public class PatchVer16 {
|
||||||
|
|
||||||
|
public static void Activate(){
|
||||||
|
try {
|
||||||
|
Plugin.Instance.harmony.PatchAll(typeof(PatchVer16));
|
||||||
|
} catch {
|
||||||
|
|
||||||
|
}
|
||||||
|
Plugin.logger.LogInfo($"FromProxyEnd function has been patched!");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPrefix]
|
||||||
|
[HarmonyPatch(typeof(Loadstone.Patches.FromProxyPatches), "FromProxyEnd")]
|
||||||
|
public static void FromProxyEndPatch(Dictionary<TileProxy, Tile> dictionary){
|
||||||
|
DunGenPlus.API.AddTileToMainPathDictionary(dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,20 +1,23 @@
|
||||||
using System;
|
using DunGen.Graph;
|
||||||
|
using DunGen;
|
||||||
|
using DunGenPlus.Collections;
|
||||||
|
using DunGenPlus;
|
||||||
|
using HarmonyLib;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using DunGen;
|
|
||||||
using DunGen.Graph;
|
|
||||||
using DunGenPlus;
|
|
||||||
using DunGenPlus.Collections;
|
|
||||||
using HarmonyLib;
|
|
||||||
|
|
||||||
namespace LoadstoneNighty {
|
namespace LoadstoneNighty {
|
||||||
|
|
||||||
public class Patch {
|
|
||||||
|
// patch 17 has the patch functions for me to use
|
||||||
|
public class PatchVer17 {
|
||||||
|
|
||||||
public static void Activate(){
|
public static void Activate(){
|
||||||
Loadstone.Patches.DungenOptimizationPatches.tileCollectors.Add(GetTiles);
|
Loadstone.Patches.DungenOptimizationPatches.tileCollectors.Add(GetTiles);
|
||||||
|
Plugin.logger.LogInfo($"DungenOptimizationPatches function has been patched!");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static HashSet<Tile> GetTiles(DungeonGenerator generator) {
|
private static HashSet<Tile> GetTiles(DungeonGenerator generator) {
|
|
@ -20,8 +20,8 @@ namespace LoadstoneNighty {
|
||||||
private const string modName = "Dungeon Generation Plus Loadstone Patch";
|
private const string modName = "Dungeon Generation Plus Loadstone Patch";
|
||||||
private const string modVersion = "1.0.0";
|
private const string modVersion = "1.0.0";
|
||||||
|
|
||||||
public const string targetModGUID = "com.adibtw.loadstone.Nightly";
|
public const string targetModGUID = "com.adibtw.loadstone";
|
||||||
public const string targetModVersion = "0.1.16";
|
public const string targetModVersion = "0.1.17";
|
||||||
|
|
||||||
public readonly Harmony harmony = new Harmony(modGUID);
|
public readonly Harmony harmony = new Harmony(modGUID);
|
||||||
public static Plugin Instance {get; private set;}
|
public static Plugin Instance {get; private set;}
|
||||||
|
@ -32,9 +32,12 @@ namespace LoadstoneNighty {
|
||||||
|
|
||||||
logger = BepInEx.Logging.Logger.CreateLogSource(modGUID);
|
logger = BepInEx.Logging.Logger.CreateLogSource(modGUID);
|
||||||
|
|
||||||
var modLoaded = Chainloader.PluginInfos.ContainsKey(targetModGUID);
|
var modLoaded = Chainloader.PluginInfos.ContainsKey(targetModGUID);
|
||||||
if (!modLoaded) return;
|
if (!modLoaded) return;
|
||||||
|
|
||||||
|
logger.LogInfo($"Plugin {modName} has been added!");
|
||||||
|
PatchVer16.Activate();
|
||||||
|
|
||||||
bool validVersion;
|
bool validVersion;
|
||||||
var pluginInfo = Chainloader.PluginInfos[targetModGUID];
|
var pluginInfo = Chainloader.PluginInfos[targetModGUID];
|
||||||
var loadedVersion = pluginInfo.Metadata.Version;
|
var loadedVersion = pluginInfo.Metadata.Version;
|
||||||
|
@ -46,15 +49,7 @@ namespace LoadstoneNighty {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (validVersion){
|
if (validVersion){
|
||||||
logger.LogInfo($"Plugin {modName} has been added!");
|
PatchVer17.Activate();
|
||||||
|
|
||||||
try {
|
|
||||||
harmony.PatchAll(typeof(Patch));
|
|
||||||
} catch {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Patch.Activate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue