2022-10-04 22:52:29 -04:00
|
|
|
|
using Cysharp.Threading.Tasks;
|
|
|
|
|
using QSB.EchoesOfTheEye.DreamLantern.Messages;
|
2022-04-13 23:30:59 -07:00
|
|
|
|
using QSB.Messaging;
|
|
|
|
|
using QSB.WorldSync;
|
2022-10-04 22:52:29 -04:00
|
|
|
|
using System.Threading;
|
2022-04-13 23:30:59 -07:00
|
|
|
|
|
|
|
|
|
namespace QSB.EchoesOfTheEye.DreamLantern.WorldObjects;
|
|
|
|
|
|
2022-10-04 22:52:29 -04:00
|
|
|
|
public class QSBDreamLanternController : WorldObject<DreamLanternController>
|
2022-04-13 23:30:59 -07:00
|
|
|
|
{
|
2022-10-04 22:52:29 -04:00
|
|
|
|
public DreamLanternItem DreamLanternItem { get; private set; }
|
|
|
|
|
|
|
|
|
|
public override async UniTask Init(CancellationToken ct)
|
|
|
|
|
{
|
|
|
|
|
// Ghosts don't have the item and instead the effects are controlled by GhostEffects
|
|
|
|
|
if (!IsGhostLantern)
|
|
|
|
|
{
|
|
|
|
|
DreamLanternItem = AttachedObject.GetComponent<DreamLanternItem>();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-13 23:30:59 -07:00
|
|
|
|
public override void SendInitialState(uint to)
|
|
|
|
|
{
|
|
|
|
|
this.SendMessage(new SetLitMessage(AttachedObject._lit) { To = to });
|
|
|
|
|
this.SendMessage(new SetConcealedMessage(AttachedObject._concealed) { To = to });
|
|
|
|
|
this.SendMessage(new SetFocusMessage(AttachedObject._focus) { To = to });
|
|
|
|
|
this.SendMessage(new SetRangeMessage(AttachedObject._minRange, AttachedObject._maxRange) { To = to });
|
|
|
|
|
}
|
2022-08-28 13:51:33 -07:00
|
|
|
|
|
|
|
|
|
public bool IsGhostLantern => AttachedObject.name == "GhostLantern"; // it's as shrimple as that
|
2022-04-13 23:30:59 -07:00
|
|
|
|
}
|