mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-21 18:40:03 +00:00
improve QSBGeyser slighty
This commit is contained in:
parent
0b018ab788
commit
15728f0ca2
@ -8,21 +8,33 @@ namespace QSB.GeyserSync.WorldObjects
|
||||
{
|
||||
public override void Init()
|
||||
{
|
||||
AttachedObject.OnGeyserActivateEvent += () => HandleEvent(true);
|
||||
AttachedObject.OnGeyserDeactivateEvent += () => HandleEvent(false);
|
||||
if (QSBCore.IsHost)
|
||||
{
|
||||
AttachedObject.OnGeyserActivateEvent += OnActivate;
|
||||
AttachedObject.OnGeyserDeactivateEvent += OnDeactivate;
|
||||
}
|
||||
}
|
||||
|
||||
public override void SendResyncInfo(uint to) =>
|
||||
HandleEvent(AttachedObject._isActive);
|
||||
|
||||
private void HandleEvent(bool state)
|
||||
public override void OnRemoval()
|
||||
{
|
||||
if (QSBCore.IsHost)
|
||||
{
|
||||
this.SendMessage(new GeyserMessage(state));
|
||||
AttachedObject.OnGeyserActivateEvent -= OnActivate;
|
||||
AttachedObject.OnGeyserDeactivateEvent -= OnDeactivate;
|
||||
}
|
||||
}
|
||||
|
||||
public override void SendResyncInfo(uint to)
|
||||
{
|
||||
if (QSBCore.IsHost)
|
||||
{
|
||||
this.SendMessage(new GeyserMessage(AttachedObject._isActive));
|
||||
}
|
||||
}
|
||||
|
||||
private void OnActivate() => this.SendMessage(new GeyserMessage(true));
|
||||
private void OnDeactivate() => this.SendMessage(new GeyserMessage(false));
|
||||
|
||||
public void SetState(bool state)
|
||||
{
|
||||
if (AttachedObject._isActive == state)
|
||||
|
Loading…
x
Reference in New Issue
Block a user