2022-04-01 21:51:03 +01:00

30 lines
987 B
C#

using QSB.CampfireSync.WorldObjects;
using QSB.ItemSync.WorldObjects.Items;
using QSB.Messaging;
using QSB.Player;
using QSB.WorldSync;
namespace QSB.CampfireSync.Messages;
internal class BurnSlideReelMessage : QSBWorldObjectMessage<QSBSlideReelItem, int>
{
public BurnSlideReelMessage(QSBCampfire campfire) : base(campfire.ObjectId) { }
public override void OnReceiveRemote()
{
var campfire = QSBWorldSync.GetWorldObject<QSBCampfire>(Data).AttachedObject;
var fromPlayer = QSBPlayerManager.GetPlayer(From);
WorldObject.DropItem(
campfire._burnedSlideReelSocket.position,
campfire._burnedSlideReelSocket.up,
campfire._burnedSlideReelSocket,
campfire._sector, null);
fromPlayer.HeldItem = null;
fromPlayer.AnimationSync.VisibleAnimator.SetTrigger("DropHeldItem");
WorldObject.AttachedObject.Burn();
campfire.SetDropSlideReelMode(false);
campfire._hasBurnedSlideReel = true;
campfire._oneShotAudio.PlayOneShot(AudioType.TH_Campfire_Ignite, 1f);
}
}