DungeonGenerationPlus_Letha.../DunGenPlus/DunGenPlus/Patches/TileProxyPatch.cs
LadyAliceMargatroid 8e30a1b6e6 Implemented TileExtender
Fixed error spam with DoorwaySisters
Added GenericScriptingParent
Added failsafe to GlobalProp algorithm
Removed DoorwayCleanup
2025-02-10 12:36:57 -08:00

42 lines
1.4 KiB
C#

using DunGen;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HarmonyLib;
using DunGenPlus.Collections;
using UnityEngine;
namespace DunGenPlus.Patches {
internal class TileProxyPatch {
public static Dictionary<TileProxy, TileExtenderProxy> TileExtenderProxyDictionary = new Dictionary<TileProxy, TileExtenderProxy>();
public static void ResetDictionary(){
TileExtenderProxyDictionary.Clear();
}
public static TileExtenderProxy GetTileExtenderProxy(TileProxy proxy){
return TileExtenderProxyDictionary[proxy];
}
public static void AddTileExtenderProxy(TileProxy tileProxy, TileExtenderProxy tileExtenderProxy){
TileExtenderProxyDictionary.Add(tileProxy, tileExtenderProxy);
}
[HarmonyPatch(typeof(TileProxy), MethodType.Constructor, new Type[] { typeof(GameObject), typeof(bool), typeof(Vector3) })]
[HarmonyPostfix]
public static void TileProxyConstructorNewPatch(ref TileProxy __instance){
AddTileExtenderProxy(__instance, new TileExtenderProxy(__instance));
}
[HarmonyPatch(typeof(TileProxy), MethodType.Constructor, new Type[] { typeof(TileProxy) })]
[HarmonyPostfix]
public static void TileProxyConstructorExistingPatch(ref TileProxy __instance, TileProxy existingTile){
AddTileExtenderProxy(__instance, new TileExtenderProxy(__instance, GetTileExtenderProxy(existingTile)));
}
}
}