mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-11 18:41:59 +00:00
39 lines
940 B
C#
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);
|
|
}
|
|
}
|
|
}
|