Allow containment field generators to be enabled on mapinit (#31158)

* Initial commit

* review fix
This commit is contained in:
SlamBamActionman
2024-09-19 02:14:29 +02:00
committed by GitHub
parent 6958789f37
commit cc7e5e0150
2 changed files with 8 additions and 1 deletions

View 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>

View File

@@ -79,7 +79,7 @@ public sealed partial class ContainmentFieldGeneratorComponent : Component
/// <summary>
/// Is the generator toggled on?
/// </summary>
[ViewVariables]
[DataField]
public bool Enabled;
/// <summary>