SlideReelSocket.RemoveFromSocket

This commit is contained in:
JohnCorby 2022-03-23 21:44:21 -07:00
parent 7b9036f3d0
commit edfa31d73e
2 changed files with 21 additions and 2 deletions

View File

@ -44,10 +44,10 @@ internal class SocketItemMessage : QSBMessage<(SocketMessageType Type, int Socke
return; return;
} }
qsbItemSocket.RemoveFromSocket();
var player = QSBPlayerManager.GetPlayer(From); var player = QSBPlayerManager.GetPlayer(From);
player.HeldItem = qsbItem; player.HeldItem = qsbItem;
qsbItemSocket.RemoveFromSocket();
return; return;
} }
case SocketMessageType.CompleteUnsocket: case SocketMessageType.CompleteUnsocket:

View File

@ -1,5 +1,7 @@
using HarmonyLib; using HarmonyLib;
using QSB.Patches; using QSB.Patches;
using QSB.Player;
using System.Linq;
using UnityEngine; using UnityEngine;
namespace QSB.ItemSync.Patches; namespace QSB.ItemSync.Patches;
@ -150,5 +152,22 @@ internal class ItemRemotePatches : QSBPatch
return false; return false;
} }
[HarmonyPrefix]
[HarmonyPatch(typeof(SlideReelSocket), nameof(SlideReelSocket.RemoveFromSocket))]
private static bool SlideReelSocket_RemoveFromSocket(SlideReelSocket __instance, ref OWItem __result)
{
if (!Remote)
{
return true;
}
var socketedItem = (SlideReelItem)__instance._socketedItem;
var player = QSBPlayerManager.PlayerList.First(x => x.HeldItem.AttachedObject == socketedItem);
socketedItem.SetSocketLocalDir(__instance.CalcCorrectUnsocketDir(player.Camera.transform));
__result = OWItemSocket_RemoveFromSocket(__instance);
return false;
}
#endregion #endregion
} }