2020-09-22 21:00:56 +01:00

39 lines
936 B
C#

using QSB.Events;
using QSB.WorldSync;
namespace QSB.OrbSync
{
public class QSBOrbSlot : WorldObject
{
public NomaiInterfaceSlot InterfaceSlot { get; private set; }
private bool _initialized;
public void Init(NomaiInterfaceSlot slot, int id)
{
ObjectId = id;
InterfaceSlot = slot;
_initialized = true;
WorldRegistry.AddObject(this);
}
public void HandleEvent(bool state)
{
if (QSB.HasWokenUp)
{
GlobalMessenger<int, bool>.FireEvent(EventNames.QSBOrbSlot, ObjectId, state);
}
}
public void SetState(bool state)
{
if (!_initialized)
{
return;
}
var ev = state ? "OnSlotActivated" : "OnSlotDeactivated";
WorldRegistry.RaiseEvent(InterfaceSlot, ev);
}
}
}