From: SlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com> Date: Thu, 19 Sep 2024 00:14:29 +0000 (+0200) Subject: Allow containment field generators to be enabled on mapinit (#31158) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=cc7e5e01508b6ac79d6e85b18ec4ec7bc839ec71;p=space-station-14.git Allow containment field generators to be enabled on mapinit (#31158) * Initial commit * review fix --- diff --git a/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs b/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs index 05262f2999..6d97c8ccb3 100644 --- a/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs +++ b/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs @@ -37,6 +37,7 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem SubscribeLocalEvent(OnUnanchorAttempt); SubscribeLocalEvent(OnComponentRemoved); SubscribeLocalEvent(PreventBreach); + SubscribeLocalEvent(OnMapInit); } public override void Update(float frameTime) @@ -61,6 +62,12 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem #region Events + private void OnMapInit(Entity generator, ref MapInitEvent args) + { + if (generator.Comp.Enabled) + ChangeFieldVisualizer(generator); + } + /// /// A generator receives power from a source colliding with it. /// diff --git a/Content.Shared/Singularity/Components/ContainmentFieldGeneratorComponent.cs b/Content.Shared/Singularity/Components/ContainmentFieldGeneratorComponent.cs index 938b34f354..6b09edfa1f 100644 --- a/Content.Shared/Singularity/Components/ContainmentFieldGeneratorComponent.cs +++ b/Content.Shared/Singularity/Components/ContainmentFieldGeneratorComponent.cs @@ -79,7 +79,7 @@ public sealed partial class ContainmentFieldGeneratorComponent : Component /// /// Is the generator toggled on? /// - [ViewVariables] + [DataField] public bool Enabled; ///