From d8d717c53a64be002e3166b415ada193a917f593 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Fri, 23 Aug 2024 21:41:30 +0200 Subject: [PATCH] Add failed builderdecoration --- .../SupermarketTogether/BuilderDecoration.cs | 66 +++++++++++++++++++ .../SupermarketTogether.csproj | 4 ++ 2 files changed, 70 insertions(+) create mode 100644 Projects/SupermarketTogether/SupermarketTogether/BuilderDecoration.cs diff --git a/Projects/SupermarketTogether/SupermarketTogether/BuilderDecoration.cs b/Projects/SupermarketTogether/SupermarketTogether/BuilderDecoration.cs new file mode 100644 index 0000000..df627b3 --- /dev/null +++ b/Projects/SupermarketTogether/SupermarketTogether/BuilderDecoration.cs @@ -0,0 +1,66 @@ +using System; +using System.Diagnostics; +using HarmonyLib; +using HutongGames.PlayMaker.Actions; +using UnityEngine; + +namespace DavesPhatStore { + [HarmonyPatch] + public class BuilderDecoration { + // private static Transform lastValidPosition = null; + + // [HarmonyPostfix] + // [HarmonyPatch(typeof(Builder_Decoration), "Update")] + // public static void Update(Builder_Decoration __instance) { + // var instanceT = Traverse.Create(__instance); + // var dummyOBJ = instanceT.Field("dummyOBJ").GetValue(); + // if (dummyOBJ == null) { + // Console.WriteLine("No dummyOBJ"); + // return; + // } + + // var canPlace = instanceT.Field("canPlace").GetValue(); + // if (canPlace) { + // Console.WriteLine($"Can place at {dummyOBJ.transform}"); + // lastValidPosition = dummyOBJ.transform; + // } else { + // Console.WriteLine($"Cannot place, reverting to {lastValidPosition.position}"); + // dummyOBJ.transform.position = lastValidPosition.position; + // } + // } + + // [HarmonyPrefix] + // [HarmonyPatch(typeof(NetworkSpawner), "UserCode_CmdSpawn__Int32__Vector3__Vector3")] + // public static void UserCode_CmdSpawn__Int32__Vector3__Vector3(ref int prefabID, ref Vector3 pos, ref Vector3 rot) { + // Console.WriteLine(new StackTrace().ToString()); + // Console.WriteLine($"Spawning {prefabID} at {pos.ToString()} with rot {rot.ToString()}"); + // } + + // [HarmonyPrefix] + // [HarmonyPatch(typeof(NetworkSpawner), "CmdSpawn")] + // public static void CmdSpawn(ref int prefabID, ref Vector3 pos, ref Vector3 rot) { + // Console.WriteLine(new StackTrace().ToString()); + // Console.WriteLine($"Spawning {prefabID} at {pos.ToString()} with rot {rot.ToString()}"); + // } + + // [HarmonyPrefix] + // [HarmonyPatch(typeof(CallMethod), "DoMethodCall")] + // public static void DoMethodCall(CallMethod __instance) { + // var traverse = Traverse.Create(__instance); + // Console.WriteLine($"DoMethodCall cachedMethodInfo: {traverse.Field("cachedMethodInfo").GetValue()}"); + // Console.WriteLine($"DoMethodCall cachedBehaviour: {traverse.Field("cachedBehaviour").GetValue()}"); + // Console.WriteLine($"DoMethodCall parameters: {traverse.Field("parameters").GetValue()}"); + // Console.WriteLine(new StackTrace().ToString()); + // } + + // [HarmonyPostfix] + // [HarmonyPatch(typeof(CallMethod), "DoMethodCall")] + // public static void PostDoMethodCall(CallMethod __instance) { + // var traverse = Traverse.Create(__instance); + // Console.WriteLine($"DoMethodCall cachedMethodInfo: {traverse.Field("cachedMethodInfo").GetValue()}"); + // Console.WriteLine($"DoMethodCall cachedBehaviour: {traverse.Field("cachedBehaviour").GetValue()}"); + // Console.WriteLine($"DoMethodCall parameters: {traverse.Field("parameters").GetValue()}"); + // Console.WriteLine(new StackTrace().ToString()); + // } + } +} \ No newline at end of file diff --git a/Projects/SupermarketTogether/SupermarketTogether/SupermarketTogether.csproj b/Projects/SupermarketTogether/SupermarketTogether/SupermarketTogether.csproj index 0a5ee07..2a8f187 100644 --- a/Projects/SupermarketTogether/SupermarketTogether/SupermarketTogether.csproj +++ b/Projects/SupermarketTogether/SupermarketTogether/SupermarketTogether.csproj @@ -41,6 +41,7 @@ + @@ -64,6 +65,9 @@ $(GAME_MANAGED)/Mirror.dll + + $(GAME_MANAGED)/PlayMaker.dll +