2022-05-16 20:38:02 +00:00
|
|
|
|
using QSB.EchoesOfTheEye.Ghosts.WorldObjects;
|
|
|
|
|
using QSB.ItemSync.WorldObjects.Items;
|
2022-03-24 20:35:49 +00:00
|
|
|
|
using QSB.Messaging;
|
|
|
|
|
using QSB.Player;
|
2022-03-26 01:54:07 +00:00
|
|
|
|
using QSB.Player.TransformSync;
|
2022-03-26 14:17:40 +00:00
|
|
|
|
using QSB.PlayerBodySetup.Remote;
|
2022-03-24 20:35:49 +00:00
|
|
|
|
using QSB.WorldSync;
|
|
|
|
|
|
|
|
|
|
namespace QSB.EchoesOfTheEye.DreamWorld.Messages;
|
|
|
|
|
|
2022-03-26 01:57:26 +00:00
|
|
|
|
/// <summary>
|
2022-03-26 02:34:21 +00:00
|
|
|
|
/// todo SendInitialState
|
2022-03-26 01:57:26 +00:00
|
|
|
|
/// </summary>
|
2022-03-26 01:54:07 +00:00
|
|
|
|
internal class EnterDreamWorldMessage : QSBWorldObjectMessage<QSBDreamLanternItem>
|
2022-03-24 20:35:49 +00:00
|
|
|
|
{
|
2022-03-26 01:54:07 +00:00
|
|
|
|
static EnterDreamWorldMessage()
|
|
|
|
|
{
|
|
|
|
|
GlobalMessenger.AddListener(OWEvents.EnterDreamWorld, () =>
|
|
|
|
|
{
|
|
|
|
|
if (!PlayerTransformSync.LocalInstance)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Locator.GetDreamWorldController()
|
|
|
|
|
.GetPlayerLantern()
|
|
|
|
|
.GetWorldObject<QSBDreamLanternItem>()
|
|
|
|
|
.SendMessage(new EnterDreamWorldMessage());
|
|
|
|
|
});
|
|
|
|
|
}
|
2022-03-24 20:35:49 +00:00
|
|
|
|
|
2022-03-28 22:56:38 +00:00
|
|
|
|
public override void OnReceiveLocal()
|
|
|
|
|
{
|
|
|
|
|
var player = QSBPlayerManager.LocalPlayer;
|
|
|
|
|
player.InDreamWorld = true;
|
|
|
|
|
player.AssignedSimulationLantern = WorldObject;
|
2022-05-22 05:46:21 +00:00
|
|
|
|
|
2022-05-27 04:39:12 +00:00
|
|
|
|
foreach (var ghost in QSBWorldSync.GetWorldObjects<QSBGhostBrain>())
|
2022-05-22 05:46:21 +00:00
|
|
|
|
{
|
2022-05-27 04:39:12 +00:00
|
|
|
|
ghost.OnEnterDreamWorld(player);
|
2022-05-22 05:46:21 +00:00
|
|
|
|
}
|
2022-03-28 22:56:38 +00:00
|
|
|
|
}
|
2022-03-28 05:06:09 +00:00
|
|
|
|
|
2022-03-24 20:35:49 +00:00
|
|
|
|
public override void OnReceiveRemote()
|
|
|
|
|
{
|
|
|
|
|
var player = QSBPlayerManager.GetPlayer(From);
|
|
|
|
|
player.InDreamWorld = true;
|
2022-03-26 01:54:07 +00:00
|
|
|
|
player.AssignedSimulationLantern = WorldObject;
|
2022-03-26 14:17:40 +00:00
|
|
|
|
|
|
|
|
|
// do the spawn shader
|
2022-03-26 17:14:55 +00:00
|
|
|
|
player.SetVisible(false);
|
2022-03-26 14:17:40 +00:00
|
|
|
|
player.SetVisible(true, DreamWorldSpawnAnimator.DREAMWORLD_SPAWN_TIME);
|
|
|
|
|
player.DreamWorldSpawnAnimator.StartSpawnEffect();
|
2022-05-16 20:38:02 +00:00
|
|
|
|
|
|
|
|
|
if (QSBCore.IsHost)
|
|
|
|
|
{
|
|
|
|
|
foreach (var ghost in QSBWorldSync.GetWorldObjects<QSBGhostBrain>())
|
|
|
|
|
{
|
2022-05-22 05:46:21 +00:00
|
|
|
|
ghost.OnEnterDreamWorld(player);
|
2022-05-27 04:59:10 +00:00
|
|
|
|
ghost.GetEffects().OnSectorOccupantsUpdated();
|
2022-05-16 20:38:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-24 20:35:49 +00:00
|
|
|
|
}
|
|
|
|
|
}
|