]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Allow containment field generators to be enabled on mapinit (#31158)
authorSlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com>
Thu, 19 Sep 2024 00:14:29 +0000 (02:14 +0200)
committerGitHub <noreply@github.com>
Thu, 19 Sep 2024 00:14:29 +0000 (10:14 +1000)
* Initial commit

* review fix

Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs
Content.Shared/Singularity/Components/ContainmentFieldGeneratorComponent.cs

index 05262f2999629b14c5d128baa80267826791f3e6..6d97c8ccb3ddc73b56b73a7a220aca22b236ef9d 100644 (file)
@@ -37,6 +37,7 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
         SubscribeLocalEvent<ContainmentFieldGeneratorComponent, UnanchorAttemptEvent>(OnUnanchorAttempt);
         SubscribeLocalEvent<ContainmentFieldGeneratorComponent, ComponentRemove>(OnComponentRemoved);
         SubscribeLocalEvent<ContainmentFieldGeneratorComponent, EventHorizonAttemptConsumeEntityEvent>(PreventBreach);
+        SubscribeLocalEvent<ContainmentFieldGeneratorComponent, MapInitEvent>(OnMapInit);
     }
 
     public override void Update(float frameTime)
@@ -61,6 +62,12 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
 
     #region Events
 
+    private void OnMapInit(Entity<ContainmentFieldGeneratorComponent> generator, ref MapInitEvent args)
+    {
+        if (generator.Comp.Enabled)
+            ChangeFieldVisualizer(generator);
+    }
+
     /// <summary>
     /// A generator receives power from a source colliding with it.
     /// </summary>
index 938b34f354a6e016c442341830aa2710eed6545c..6b09edfa1f00686ab050b250c0da2ca2d7219017 100644 (file)
@@ -79,7 +79,7 @@ public sealed partial class ContainmentFieldGeneratorComponent : Component
     /// <summary>
     /// Is the generator toggled on?
     /// </summary>
-    [ViewVariables]
+    [DataField]
     public bool Enabled;
 
     /// <summary>