quantum-space-buddies/QSB/ItemSync/Messages/MoveToCarryMessage.cs

41 lines
1.1 KiB
C#
Raw Normal View History

2021-12-26 06:35:32 +00:00
using QSB.ItemSync.WorldObjects.Items;
using QSB.Messaging;
using QSB.Player;
2022-01-26 13:12:22 +00:00
using QSB.Utility;
2021-12-26 06:35:32 +00:00
namespace QSB.ItemSync.Messages
{
internal class MoveToCarryMessage : QSBWorldObjectMessage<IQSBOWItem>
{
public override void OnReceiveRemote()
{
var player = QSBPlayerManager.GetPlayer(From);
var itemType = WorldObject.GetItemType();
player.HeldItem = WorldObject;
var itemSocket = itemType switch
{
ItemType.Scroll => player.ScrollSocket,
ItemType.SharedStone => player.SharedStoneSocket,
ItemType.WarpCore => ((QSBWarpCoreItem)WorldObject).IsVesselCoreType()
? player.VesselCoreSocket
: player.WarpCoreSocket,
ItemType.Lantern => player.SimpleLanternSocket,
ItemType.DreamLantern => player.DreamLanternSocket,
ItemType.SlideReel => player.SlideReelSocket,
ItemType.VisionTorch => player.VisionTorchSocket,
_ => player.ItemSocket,
};
WorldObject.PickUpItem(itemSocket, From);
2022-01-26 13:12:22 +00:00
switch (itemType)
{
case ItemType.Lantern:
DebugLog.DebugWrite($"HOLD LANTERN");
player.AnimationSync.VisibleAnimator.SetTrigger("HoldLantern");
break;
}
2021-12-26 06:35:32 +00:00
}
}
}