quantum-space-buddies/QSB/OrbSync/QSBOrbSlot.cs
Mister_Nebula 45d459d389 cleanup
2020-11-03 21:42:14 +00:00

39 lines
940 B
C#

using QSB.EventsCore;
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);
}
}
}