Skip to content

Commit

Permalink
Merge pull request #621 from misternebula/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
misternebula authored Apr 27, 2023
2 parents 4693330 + 68afde4 commit 3928d1b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
14 changes: 12 additions & 2 deletions QSB/QuantumSync/WorldObjects/QSBQuantumObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public override void OnRemoval()
shape.OnShapeActivated -= OnEnable;
shape.OnShapeDeactivated -= OnDisable;
}

QSBPlayerManager.OnRemovePlayer -= OnRemovePlayer;
}

public override async UniTask Init(CancellationToken ct)
Expand Down Expand Up @@ -75,6 +77,14 @@ public override async UniTask Init(CancellationToken ct)
ControllingPlayer = 0u;
IsEnabled = false;
}

QSBPlayerManager.OnRemovePlayer += OnRemovePlayer;
}

private void OnRemovePlayer(PlayerInfo player)
{
_visibleToProbes.Remove(player);
AttachedObject._visibleInProbeSnapshot = _visibleToProbes.Any();
}

public override void SendInitialState(uint to) =>
Expand Down Expand Up @@ -252,7 +262,7 @@ public void OnTakeProbeSnapshot(PlayerInfo player, ProbeCamera.ID cameraId)
_visibleToProbes.Remove(player);
}

AttachedObject._visibleInProbeSnapshot = _visibleToProbes.Any(x => x != null);
AttachedObject._visibleInProbeSnapshot = _visibleToProbes.Any();
}

public void OnRemoveProbeSnapshot(PlayerInfo player)
Expand All @@ -262,7 +272,7 @@ public void OnRemoveProbeSnapshot(PlayerInfo player)
_visibleToProbes.Remove(player);
}

AttachedObject._visibleInProbeSnapshot = _visibleToProbes.Any(x => x != null);
AttachedObject._visibleInProbeSnapshot = _visibleToProbes.Any();
}

public List<PlayerInfo> GetVisibleToProbePlayers() => _visibleToProbes;
Expand Down
3 changes: 3 additions & 0 deletions QSB/ShipSync/ShipManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ private void OnRemovePlayer(PlayerInfo player)
{
new FlyShipMessage(false).Send();
}

_playersInShip.Remove(player);
UpdateElectricalComponent();
}

public override async UniTask BuildWorldObjects(OWScene scene, CancellationToken ct)
Expand Down

0 comments on commit 3928d1b

Please sign in to comment.