diff --git a/Robust.Client/GameStates/PvsOverrideSystem.cs b/Robust.Client/GameStates/PvsOverrideSystem.cs new file mode 100644 index 00000000000..5b3dfc12d09 --- /dev/null +++ b/Robust.Client/GameStates/PvsOverrideSystem.cs @@ -0,0 +1,5 @@ +using Robust.Shared.GameStates; + +namespace Robust.Client.GameStates; + +public sealed partial class PvsOverrideSystem : SharedPvsOverrideSystem; diff --git a/Robust.Server/GameStates/PvsOverrideSystem.cs b/Robust.Server/GameStates/PvsOverrideSystem.cs index bef471af085..187e264c211 100644 --- a/Robust.Server/GameStates/PvsOverrideSystem.cs +++ b/Robust.Server/GameStates/PvsOverrideSystem.cs @@ -5,13 +5,14 @@ using Robust.Shared.Console; using Robust.Shared.Enums; using Robust.Shared.GameObjects; +using Robust.Shared.GameStates; using Robust.Shared.IoC; using Robust.Shared.Player; using Robust.Shared.Utility; namespace Robust.Server.GameStates; -public sealed class PvsOverrideSystem : EntitySystem +public sealed class PvsOverrideSystem : SharedPvsOverrideSystem { [Dependency] private readonly IPlayerManager _player = default!; [Dependency] private readonly IConsoleHost _console = default!; @@ -134,8 +135,10 @@ private void Clear(EntityUid uid) /// Forces the entity, all of its parents, and all of its children to ignore normal PVS range limitations, /// causing them to always be sent to all clients. /// - public void AddGlobalOverride(EntityUid uid) + public override void AddGlobalOverride(EntityUid uid) { + base.AddGlobalOverride(uid); + if (GlobalOverride.Add(uid)) _hasOverride.Add(uid); } @@ -143,8 +146,10 @@ public void AddGlobalOverride(EntityUid uid) /// /// Removes an entity from the global overrides. /// - public void RemoveGlobalOverride(EntityUid uid) + public override void RemoveGlobalOverride(EntityUid uid) { + base.RemoveGlobalOverride(uid); + GlobalOverride.Remove(uid); // Not bothering to clear _hasOverride, as we'd have to check all the other collections, and at that point we // might as well just do that when the entity gets deleted anyways. @@ -203,8 +208,10 @@ public void RemoveForceSend(EntityUid uid, ICommonSession session) /// Forces the entity, all of its parents, and all of its children to ignore normal PVS range limitations for a /// specific session. /// - public void AddSessionOverride(EntityUid uid, ICommonSession session) + public override void AddSessionOverride(EntityUid uid, ICommonSession session) { + base.AddSessionOverride(uid, session); + if (SessionOverrides.GetOrNew(session).Add(uid)) _hasOverride.Add(uid); } @@ -212,8 +219,10 @@ public void AddSessionOverride(EntityUid uid, ICommonSession session) /// /// Removes an entity from a session's overrides. /// - public void RemoveSessionOverride(EntityUid uid, ICommonSession session) + public override void RemoveSessionOverride(EntityUid uid, ICommonSession session) { + base.RemoveSessionOverride(uid, session); + if (!SessionOverrides.TryGetValue(session, out var overrides)) return; @@ -228,8 +237,10 @@ public void RemoveSessionOverride(EntityUid uid, ICommonSession session) /// Forces the entity, all of its parents, and all of its children to ignore normal PVS range limitations, /// causing them to always be sent to all clients. /// - public void AddSessionOverrides(EntityUid uid, Filter filter) + public override void AddSessionOverrides(EntityUid uid, Filter filter) { + base.AddSessionOverrides(uid, filter); + foreach (var session in filter.Recipients) { AddSessionOverride(uid, session); diff --git a/Robust.Shared/GameStates/SharedPvsOverrideSystem.cs b/Robust.Shared/GameStates/SharedPvsOverrideSystem.cs new file mode 100644 index 00000000000..93d76dde7d2 --- /dev/null +++ b/Robust.Shared/GameStates/SharedPvsOverrideSystem.cs @@ -0,0 +1,50 @@ +using Robust.Shared.GameObjects; +using Robust.Shared.Player; + +namespace Robust.Shared.GameStates; + +public abstract class SharedPvsOverrideSystem : EntitySystem +{ + /// + /// Forces the entity, all of its parents, and all of its children to ignore normal PVS range limitations, + /// causing them to always be sent to all clients. + /// + public virtual void AddGlobalOverride(EntityUid uid) + { + + } + + /// + /// Removes an entity from the global overrides. + /// + public virtual void RemoveGlobalOverride(EntityUid uid) + { + + } + + /// + /// Forces the entity, all of its parents, and all of its children to ignore normal PVS range limitations for a + /// specific session. + /// + public virtual void AddSessionOverride(EntityUid uid, ICommonSession session) + { + + } + + /// + /// Removes an entity from a session's overrides. + /// + public virtual void RemoveSessionOverride(EntityUid uid, ICommonSession session) + { + + } + + /// + /// Forces the entity, all of its parents, and all of its children to ignore normal PVS range limitations, + /// causing them to always be sent to all clients. + /// + public virtual void AddSessionOverrides(EntityUid uid, Filter filter) + { + + } +}