98 lines
3.4 KiB
C#
98 lines
3.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using BoneSync.Sync;
|
|
using BoneSync.Sync.Components;
|
|
using HarmonyLib;
|
|
using MelonLoader;
|
|
using StressLevelZero.Interaction;
|
|
|
|
namespace BoneSync.Patching
|
|
{
|
|
/*[HarmonyPatch(typeof(Socket))]
|
|
public static class SocketPatches
|
|
{
|
|
public static void GenericSocketEnterPatch(Socket __instance, Plug plug)
|
|
{
|
|
if (!plug) return;
|
|
MelonLogger.Msg("Plug entered: " + __instance.name + " Plug: " + plug.name);
|
|
Syncable syncable = ObjectSyncCache.GetSyncable(plug);
|
|
if (!syncable) return;
|
|
byte plugId = syncable.GetPlugId(plug);
|
|
byte socketId = syncable.GetSocketId(__instance);
|
|
MelonLogger.Msg("Plug entered: " + __instance.transform.GetPath() + " Plug: " + plug.transform.GetPath() + " ID: " + plugId + " Socket ID: " + socketId);
|
|
|
|
}
|
|
|
|
public static void GenericSocketExitPatch(Socket __instance, Plug plug)
|
|
{
|
|
if (!plug) return;
|
|
MelonLogger.Msg("Plug exited: " + __instance.name + " Plug: " + plug.name);
|
|
Syncable syncable = ObjectSyncCache.GetSyncable(plug);
|
|
if (!syncable) return;
|
|
byte plugId = syncable.GetPlugId(plug);
|
|
byte socketId = syncable.GetSocketId(__instance);
|
|
MelonLogger.Msg("Plug exited: " + __instance.transform.GetPath() + " Plug: " + plug.transform.GetPath() + " ID: " + plugId + " Socket ID: " + socketId);
|
|
}
|
|
|
|
|
|
[HarmonyPatch(nameof(Socket.OnPlugEnter)), HarmonyPostfix]
|
|
public static void SocketEnterPatch(Socket __instance, Plug plug)
|
|
{
|
|
GenericSocketEnterPatch(__instance, plug);
|
|
}
|
|
|
|
[HarmonyPatch(nameof(Socket.OnPlugExit)), HarmonyPostfix]
|
|
public static void SocketExitPatch(Socket __instance, Plug plug)
|
|
{
|
|
GenericSocketExitPatch(__instance, plug);
|
|
}
|
|
}
|
|
|
|
[HarmonyPatch(typeof(MagazineSocket))]
|
|
public static class MagazineSocketPatches
|
|
{
|
|
[HarmonyPatch(nameof(MagazineSocket.OnPlugEnter)), HarmonyPostfix]
|
|
public static void MagazineSocketEnterPatch(MagazineSocket __instance, Plug plug)
|
|
{
|
|
SocketPatches.GenericSocketEnterPatch(__instance, plug);
|
|
}
|
|
|
|
[HarmonyPatch(nameof(MagazineSocket.OnPlugExit)), HarmonyPostfix]
|
|
public static void SocketExitPatch(MagazineSocket __instance, Plug plug)
|
|
{
|
|
SocketPatches.GenericSocketExitPatch(__instance, plug);
|
|
}
|
|
}*/
|
|
|
|
[HarmonyPatch(typeof(AlignPlug))]
|
|
public static class AlignPlugPatches
|
|
{
|
|
[HarmonyPatch(nameof(AlignPlug.InsertPlug)), HarmonyPostfix]
|
|
public static void AlignPlugInsertPatch(AlignPlug __instance, Socket socket)
|
|
{
|
|
MelonLogger.Msg("AlignPlug inserted: " + __instance.transform.GetPath() + " Socket: " + socket.transform.GetPath());
|
|
}
|
|
|
|
[HarmonyPatch(nameof(AlignPlug.EjectPlug)), HarmonyPostfix]
|
|
public static void AlignPlugEjectPatch(AlignPlug __instance)
|
|
{
|
|
MelonLogger.Msg("AlignPlug ejected: " + __instance.transform.GetPath());
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public class PlugPatches
|
|
{
|
|
/*[HarmonyPatch(typeof(Plug))]
|
|
public class PlugPatches
|
|
{
|
|
[HarmonyPatch(nameof(Plug.)), HarmonyPostfix]
|
|
}*/
|
|
}
|
|
}
|