Removes obsolete visibility system functions (#5209)

* Removes obsolete visibility system functions

* guh, forgot to add the test

---------

Co-authored-by: plykiya <plykiya@protonmail.com>
This commit is contained in:
Plykiya
2024-06-28 17:30:02 +10:00
committed by GitHub
co-authored by plykiya
parent 08970e745b
commit b8924f3ddf
2 changed files with 5 additions and 24 deletions
@@ -40,12 +40,6 @@ namespace Robust.Server.GameObjects
EntityManager.EntityInitialized -= OnEntityInit;
}
[Obsolete("Use Entity<T> variant")]
public void AddLayer(EntityUid uid, VisibilityComponent component, int layer, bool refresh = true)
{
AddLayer((uid, component), (ushort)layer, refresh);
}
public void AddLayer(Entity<VisibilityComponent?> ent, ushort layer, bool refresh = true)
{
ent.Comp ??= _visibilityQuery.CompOrNull(ent.Owner) ?? AddComp<VisibilityComponent>(ent.Owner);
@@ -59,13 +53,6 @@ namespace Robust.Server.GameObjects
RefreshVisibility(ent);
}
[Obsolete("Use Entity<T> variant")]
public void RemoveLayer(EntityUid uid, VisibilityComponent component, int layer, bool refresh = true)
{
RemoveLayer((uid, component), (ushort)layer, refresh);
}
public void RemoveLayer(Entity<VisibilityComponent?> ent, ushort layer, bool refresh = true)
{
if (!_visibilityQuery.Resolve(ent.Owner, ref ent.Comp, false))
@@ -80,12 +67,6 @@ namespace Robust.Server.GameObjects
RefreshVisibility(ent);
}
[Obsolete("Use Entity<T> variant")]
public void SetLayer(EntityUid uid, VisibilityComponent component, int layer, bool refresh = true)
{
SetLayer((uid, component), (ushort)layer, refresh);
}
public void SetLayer(Entity<VisibilityComponent?> ent, ushort layer, bool refresh = true)
{
ent.Comp ??= _visibilityQuery.CompOrNull(ent.Owner) ?? AddComp<VisibilityComponent>(ent.Owner);
@@ -44,7 +44,7 @@ public sealed partial class VisibilityTest : RobustIntegrationTest
metaComp[i] = server.EntMan.GetComponent<MetaDataComponent>(ent);
visComp[i] = server.EntMan.AddComponent<VisibilityComponent>(ent);
vis.AddLayer(ent, visComp[i], 1 << i);
vis.AddLayer((ent, visComp[i]), (ushort)(1 << i));
if (i > 0)
xforms.SetParent(ent, ents[i - 1]);
}
@@ -62,7 +62,7 @@ public sealed partial class VisibilityTest : RobustIntegrationTest
// Adding a layer to the root entity's mask will apply it to all children
var extraMask = 1 << (N + 1);
mask = RequiredMask | extraMask;
vis.AddLayer(ents[0], visComp[0], extraMask);
vis.AddLayer((ents[0], visComp[0]), (ushort)extraMask);
for (int i = 0; i < N; i++)
{
mask |= 1 << i;
@@ -71,7 +71,7 @@ public sealed partial class VisibilityTest : RobustIntegrationTest
}
// Removing the removes it from all children.
vis.RemoveLayer(ents[0], visComp[0], extraMask);
vis.RemoveLayer((ents[0], visComp[0]), (ushort)extraMask);
mask = RequiredMask;
for (int i = 0; i < N; i++)
{
@@ -101,7 +101,7 @@ public sealed partial class VisibilityTest : RobustIntegrationTest
}
// Re-attaching the entity also updates the masks.
await server.WaitPost(() => xforms.SetParent(ents[split], ents[split-1]));
await server.WaitPost(() => xforms.SetParent(ents[split], ents[split - 1]));
mask = RequiredMask;
for (int i = 0; i < N; i++)
{
@@ -111,7 +111,7 @@ public sealed partial class VisibilityTest : RobustIntegrationTest
}
// Setting a mask on a child does not propagate upwards, only downwards
vis.AddLayer(ents[split], visComp[split], extraMask);
vis.AddLayer((ents[split], visComp[split]), (ushort)extraMask);
mask = RequiredMask;
for (int i = 0; i < split; i++)
{