More ForceShown fixes

This commit is contained in:
Robin Rolf 2024-01-30 02:51:02 +01:00
parent 477d430a3f
commit bf49b6c923
2 changed files with 10 additions and 6 deletions

View File

@ -345,13 +345,8 @@ private void RemoveObserversShownToDefault(NetworkIdentity changedIdentity, Vect
foreach (NetworkIdentity gridIdentity in tile)
{
if (gridIdentity == changedIdentity)
{
// Don't do anything with yourself
continue;
}
// if the gridIdentity is a player, it can see changedIdentity
// (also yourself! don't need the extra check here)
if (gridIdentity.connectionToClient != null)
{
tempShownToDefaultSet.Remove(gridIdentity.connectionToClient);

View File

@ -154,6 +154,15 @@ public void ForceShown()
// A&B should see each other
Assert.That(a.observers.ContainsKey(b.connectionToClient.connectionId), Is.True);
Assert.That(b.observers.ContainsKey(a.connectionToClient.connectionId), Is.True);
// A&B to default
a.visibility = Visibility.Default;
b.visibility = Visibility.Default;
aoi.LateUpdate();
AssertSelfVisible(a);
AssertSelfVisible(b);
// and they can't see each other anymore
Assert.That(a.observers.ContainsKey(b.connectionToClient.connectionId), Is.False);
Assert.That(b.observers.ContainsKey(a.connectionToClient.connectionId), Is.False);
}
[Test]