diff --git a/Content.Server/Singularity/EntitySystems/SingularityGeneratorSystem.cs b/Content.Server/Singularity/EntitySystems/SingularityGeneratorSystem.cs index cfca86bf4af7d4..95722449b87799 100644 --- a/Content.Server/Singularity/EntitySystems/SingularityGeneratorSystem.cs +++ b/Content.Server/Singularity/EntitySystems/SingularityGeneratorSystem.cs @@ -1,10 +1,7 @@ -using System.Diagnostics; using Content.Server.ParticleAccelerator.Components; -using Content.Server.Popups; -using Content.Server.Singularity.Components; -using Content.Shared.Emag.Systems; using Content.Shared.Popups; using Content.Shared.Singularity.Components; +using Content.Shared.Singularity.EntitySystems; using Robust.Server.GameObjects; using Robust.Shared.Physics; using Robust.Shared.Physics.Components; @@ -13,7 +10,7 @@ namespace Content.Server.Singularity.EntitySystems; -public sealed class SingularityGeneratorSystem : EntitySystem +public sealed class SingularityGeneratorSystem : SharedSingularityGeneratorSystem { #region Dependencies [Dependency] private readonly IViewVariablesManager _vvm = default!; @@ -21,7 +18,6 @@ public sealed class SingularityGeneratorSystem : EntitySystem [Dependency] private readonly PhysicsSystem _physics = default!; [Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly MetaDataSystem _metadata = default!; - [Dependency] private readonly PopupSystem _popupSystem = default!; #endregion Dependencies public override void Initialize() @@ -29,7 +25,6 @@ public override void Initialize() base.Initialize(); SubscribeLocalEvent(HandleParticleCollide); - SubscribeLocalEvent(OnEmagged); var vvHandle = _vvm.GetTypeHandler(); vvHandle.AddPath(nameof(SingularityGeneratorComponent.Power), (_, comp) => comp.Power, SetPower); @@ -138,7 +133,7 @@ private void HandleParticleCollide(EntityUid uid, ParticleProjectileComponent co if (!contained && !generatorComp.FailsafeDisabled) { generatorComp.NextFailsafe = _timing.CurTime + generatorComp.FailsafeCooldown; - _popupSystem.PopupEntity(Loc.GetString("comp-generator-failsafe", ("target", args.OtherEntity)), args.OtherEntity, PopupType.LargeCaution); + PopupSystem.PopupEntity(Loc.GetString("comp-generator-failsafe", ("target", args.OtherEntity)), args.OtherEntity, PopupType.LargeCaution); } else { @@ -159,13 +154,6 @@ private void HandleParticleCollide(EntityUid uid, ParticleProjectileComponent co EntityManager.QueueDeleteEntity(uid); } - - private void OnEmagged(EntityUid uid, SingularityGeneratorComponent component, ref GotEmaggedEvent args) - { - _popupSystem.PopupEntity(Loc.GetString("comp-generator-failsafe-disabled", ("target", uid)), uid); - component.FailsafeDisabled = true; - args.Handled = true; - } #endregion Event Handlers /// diff --git a/Content.Server/Singularity/Components/SingularityGeneratorComponent.cs b/Content.Shared/Singularity/Components/SingularityGeneratorComponent.cs similarity index 91% rename from Content.Server/Singularity/Components/SingularityGeneratorComponent.cs rename to Content.Shared/Singularity/Components/SingularityGeneratorComponent.cs index c8feeb5d5dbf33..3643ed31a6f068 100644 --- a/Content.Server/Singularity/Components/SingularityGeneratorComponent.cs +++ b/Content.Shared/Singularity/Components/SingularityGeneratorComponent.cs @@ -1,14 +1,12 @@ using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; -using Content.Server.Singularity.EntitySystems; using Content.Shared.Physics; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; -namespace Content.Server.Singularity.Components; +namespace Content.Shared.Singularity.Components; -[RegisterComponent, AutoGenerateComponentPause] -[Access(typeof(SingularityGeneratorSystem))] +[RegisterComponent, AutoGenerateComponentPause, AutoGenerateComponentState] public sealed partial class SingularityGeneratorComponent : Component { /// @@ -28,7 +26,7 @@ public sealed partial class SingularityGeneratorComponent : Component /// /// Allows the generator to ignore all the failsafe stuff, e.g. when emagged /// - [DataField] + [DataField, AutoNetworkedField] public bool FailsafeDisabled = false; /// diff --git a/Content.Shared/Singularity/EntitySystems/SharedSingularityGeneratorSystem.cs b/Content.Shared/Singularity/EntitySystems/SharedSingularityGeneratorSystem.cs new file mode 100644 index 00000000000000..8830cb0624cf77 --- /dev/null +++ b/Content.Shared/Singularity/EntitySystems/SharedSingularityGeneratorSystem.cs @@ -0,0 +1,29 @@ +using Content.Shared.Emag.Systems; +using Content.Shared.Popups; +using Content.Shared.Singularity.Components; + +namespace Content.Shared.Singularity.EntitySystems; + +/// +/// Shared part of SingularitySingularityGeneratorSystem +/// +public abstract class SharedSingularityGeneratorSystem : EntitySystem +{ + #region Dependencies + [Dependency] protected readonly SharedPopupSystem PopupSystem = default!; + #endregion Dependencies + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnEmagged); + } + + private void OnEmagged(EntityUid uid, SingularityGeneratorComponent component, ref GotEmaggedEvent args) + { + PopupSystem.PopupEntity(Loc.GetString("comp-generator-failsafe-disabled", ("target", uid)), uid); + component.FailsafeDisabled = true; + args.Handled = true; + } +} \ No newline at end of file