local only trigger

This commit is contained in:
2025-03-13 20:15:58 +02:00
parent 3f359ed4ec
commit 1843410a4d
2 changed files with 10 additions and 10 deletions

View File

@@ -10,10 +10,10 @@ namespace BoneSync.Data
{ {
internal static class SyncLogger internal static class SyncLogger
{ {
public static void Msg(string message, ConsoleColor color = ConsoleColor.White) public static void Msg(string message, ConsoleColor color = ConsoleColor.White, int frame = 1)
{ {
StackTrace stackTrace = new StackTrace(); StackTrace stackTrace = new StackTrace();
StackFrame stackFrame = stackTrace.GetFrame(1); StackFrame stackFrame = stackTrace.GetFrame(frame);
string methodName = stackFrame.GetMethod().Name; string methodName = stackFrame.GetMethod().Name;
string className = stackFrame.GetMethod().DeclaringType.Name; string className = stackFrame.GetMethod().DeclaringType.Name;
MelonLogger.Msg(color, $"[{className}.{methodName}] {message}"); MelonLogger.Msg(color, $"[{className}.{methodName}] {message}");
@@ -21,18 +21,18 @@ namespace BoneSync.Data
public static void Warning(string message) public static void Warning(string message)
{ {
Msg(message, ConsoleColor.Yellow); Msg(message, ConsoleColor.Yellow, 2);
} }
public static void Error(string message) public static void Error(string message)
{ {
Msg(message, ConsoleColor.Red); Msg(message, ConsoleColor.Red, 2);
} }
internal static void Debug(string v) internal static void Debug(string v)
{ {
#if TRACE #if DEBUG
Msg(v, ConsoleColor.Gray); Msg(v, ConsoleColor.Gray, 2);
#endif #endif
} }
} }

View File

@@ -62,7 +62,7 @@ namespace BoneSync.Patching
[HarmonyPatch(typeof(SceneZone))] [HarmonyPatch(typeof(SceneZone))]
public static class SceneZonePatch public static class SceneZonePatch
{ {
/*[HarmonyPatch(nameof(SceneZone.OnTriggerEnter)), HarmonyPrefix] [HarmonyPatch(nameof(SceneZone.OnTriggerEnter)), HarmonyPrefix]
public static bool EnterPrefix(SceneZone __instance, Collider other) public static bool EnterPrefix(SceneZone __instance, Collider other)
{ {
if (other.CompareTag("Player")) if (other.CompareTag("Player"))
@@ -72,7 +72,7 @@ namespace BoneSync.Patching
return true; return true;
} }
*/
[HarmonyPatch(nameof(SceneZone.OnTriggerExit)), HarmonyPrefix] [HarmonyPatch(nameof(SceneZone.OnTriggerExit)), HarmonyPrefix]
public static bool ExitPrefix(SceneZone __instance, Collider other) public static bool ExitPrefix(SceneZone __instance, Collider other)
{ {
@@ -88,7 +88,7 @@ namespace BoneSync.Patching
[HarmonyPatch(typeof(PlayerTrigger))] [HarmonyPatch(typeof(PlayerTrigger))]
public static class PlayerTriggerPatch public static class PlayerTriggerPatch
{ {
/*[HarmonyPatch(nameof(PlayerTrigger.OnTriggerEnter)), HarmonyPrefix] [HarmonyPatch(nameof(PlayerTrigger.OnTriggerEnter)), HarmonyPrefix]
public static bool EnterPrefix(PlayerTrigger __instance, Collider other) public static bool EnterPrefix(PlayerTrigger __instance, Collider other)
{ {
if (other.CompareTag("Player")) if (other.CompareTag("Player"))
@@ -98,7 +98,7 @@ namespace BoneSync.Patching
} }
return true; return true;
}*/ }
// only patch exit, as we want to allow activating a trigger always // only patch exit, as we want to allow activating a trigger always
[HarmonyPatch(nameof(PlayerTrigger.OnTriggerExit)), HarmonyPrefix] [HarmonyPatch(nameof(PlayerTrigger.OnTriggerExit)), HarmonyPrefix]