Splits the singularity into its component parts + ECS singularity + Support for singularities in containers. (#12132)
* InitialCommit (Broken) * Fixes compile errors * PR comments. More doc comments. Fixes * Makes a singularity/event horizon without radiation/physics a valid state to be in * VV 'fake' setters, fixes the visualizer, fixes the singularity trying to eat itself instead of nearby things. * Removes unused dependency from Content.Client.GravityWellSystem * Testing containment and fake VV setters for SingularityGeneratorComponent * Fixes gravity wells (broken due to LookupFlags.None). Adds recursive Event Horizon consumption * Fix merge skew * Fixes for the master merge * Fix engine commit * Dirty is obsolete * Switch over dirty * Fix requested changes * ambiant -> ambient * Moves EventHorionComponent to Shared * Proper container handling * Fixes master merge. Fixes post insertion assertions for singularities. Extends proper container handling to gravity wells and the distortion shader. * Better support for admemes throwing singularities. * Moves update timing from accumulators to target times * Update doc comments
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Content.Server.Singularity.Components;
|
||||
using Content.Server.Singularity.Events;
|
||||
using Content.Shared.Singularity.Components;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -22,6 +23,7 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
|
||||
[Dependency] private readonly TagSystem _tags = default!;
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly PhysicsSystem _physics = default!;
|
||||
[Dependency] private readonly AppearanceSystem _visualizer = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -34,6 +36,7 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
|
||||
SubscribeLocalEvent<ContainmentFieldGeneratorComponent, ReAnchorEvent>(OnReanchorEvent);
|
||||
SubscribeLocalEvent<ContainmentFieldGeneratorComponent, UnanchorAttemptEvent>(OnUnanchorAttempt);
|
||||
SubscribeLocalEvent<ContainmentFieldGeneratorComponent, ComponentRemove>(OnComponentRemoved);
|
||||
SubscribeLocalEvent<ContainmentFieldGeneratorComponent, EventHorizonAttemptConsumeEntityEvent>(PreventBreach);
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
@@ -356,24 +359,11 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
|
||||
/// <param name="component"></param>
|
||||
private void ChangePowerVisualizer(int power, ContainmentFieldGeneratorComponent component)
|
||||
{
|
||||
if (!TryComp<AppearanceComponent>(component.Owner, out var appearance))
|
||||
return;
|
||||
|
||||
if(component.PowerBuffer == 0)
|
||||
appearance.SetData(ContainmentFieldGeneratorVisuals.PowerLight, PowerLevelVisuals.NoPower);
|
||||
|
||||
if (component.PowerBuffer > 0 && component.PowerBuffer < component.PowerMinimum)
|
||||
appearance.SetData(ContainmentFieldGeneratorVisuals.PowerLight, PowerLevelVisuals.LowPower);
|
||||
|
||||
if (component.PowerBuffer >= component.PowerMinimum && component.PowerBuffer < 25)
|
||||
{
|
||||
appearance.SetData(ContainmentFieldGeneratorVisuals.PowerLight, PowerLevelVisuals.MediumPower);
|
||||
}
|
||||
|
||||
if (component.PowerBuffer == 25)
|
||||
{
|
||||
appearance.SetData(ContainmentFieldGeneratorVisuals.PowerLight, PowerLevelVisuals.HighPower);
|
||||
}
|
||||
_visualizer.SetData(component.Owner, ContainmentFieldGeneratorVisuals.PowerLight, component.PowerBuffer switch {
|
||||
<=0 => PowerLevelVisuals.NoPower,
|
||||
>=25 => PowerLevelVisuals.HighPower,
|
||||
_ => (component.PowerBuffer < component.PowerMinimum) ? PowerLevelVisuals.LowPower : PowerLevelVisuals.MediumPower
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -382,36 +372,30 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
|
||||
/// <param name="component"></param>
|
||||
private void ChangeFieldVisualizer(ContainmentFieldGeneratorComponent component)
|
||||
{
|
||||
if (!TryComp<AppearanceComponent>(component.Owner, out var appearance))
|
||||
return;
|
||||
|
||||
if (component.Connections.Count == 0 && !component.Enabled)
|
||||
{
|
||||
appearance.SetData(ContainmentFieldGeneratorVisuals.FieldLight, FieldLevelVisuals.NoLevel);
|
||||
}
|
||||
|
||||
if (component.Connections.Count == 0 && component.Enabled)
|
||||
{
|
||||
appearance.SetData(ContainmentFieldGeneratorVisuals.FieldLight, FieldLevelVisuals.On);
|
||||
}
|
||||
|
||||
if (component.Connections.Count == 1)
|
||||
{
|
||||
appearance.SetData(ContainmentFieldGeneratorVisuals.FieldLight, FieldLevelVisuals.OneField);
|
||||
}
|
||||
|
||||
if (component.Connections.Count > 1)
|
||||
{
|
||||
appearance.SetData(ContainmentFieldGeneratorVisuals.FieldLight, FieldLevelVisuals.MultipleFields);
|
||||
}
|
||||
_visualizer.SetData(component.Owner, ContainmentFieldGeneratorVisuals.FieldLight, component.Connections.Count switch {
|
||||
>1 => FieldLevelVisuals.MultipleFields,
|
||||
1 => FieldLevelVisuals.OneField,
|
||||
_ => component.Enabled ? FieldLevelVisuals.On : FieldLevelVisuals.NoLevel
|
||||
});
|
||||
}
|
||||
|
||||
private void ChangeOnLightVisualizer(ContainmentFieldGeneratorComponent component)
|
||||
{
|
||||
if (!TryComp<AppearanceComponent>(component.Owner, out var appearance))
|
||||
return;
|
||||
|
||||
appearance.SetData(ContainmentFieldGeneratorVisuals.OnLight, component.IsConnected);
|
||||
_visualizer.SetData(component.Owner, ContainmentFieldGeneratorVisuals.OnLight, component.IsConnected);
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Prevents singularities from breaching containment if the containment field generator is connected.
|
||||
/// </summary>
|
||||
/// <param name="uid">The entity the singularity is trying to eat.</param>
|
||||
/// <param name="comp">The containment field generator the singularity is trying to eat.</param>
|
||||
/// <param name="args">The event arguments.</param>
|
||||
private void PreventBreach(EntityUid uid, ContainmentFieldGeneratorComponent comp, EventHorizonAttemptConsumeEntityEvent args)
|
||||
{
|
||||
if (args.Cancelled)
|
||||
return;
|
||||
if (comp.IsConnected && !args.EventHorizon.CanBreachContainment)
|
||||
args.Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user