using QSB.ItemSync.WorldObjects.Items;
using QSB.Messaging;
using QSB.Player;
using QSB.Player.TransformSync;
using QSB.WorldSync;
namespace QSB.EchoesOfTheEye.DreamWorld.Messages;
///
/// todo SendInitialState
///
internal class EnterDreamWorldMessage : QSBWorldObjectMessage
{
static EnterDreamWorldMessage()
{
GlobalMessenger.AddListener(OWEvents.EnterDreamWorld, () =>
{
if (!PlayerTransformSync.LocalInstance)
{
return;
}
Locator.GetDreamWorldController()
.GetPlayerLantern()
.GetWorldObject()
.SendMessage(new EnterDreamWorldMessage());
});
}
public override void OnReceiveRemote()
{
var player = QSBPlayerManager.GetPlayer(From);
player.InDreamWorld = true;
player.AssignedSimulationLantern = WorldObject;
}
}