Remove disposal tubes component references and ECS some of it (#15188)

This commit is contained in:
DrSmugleaf
2023-04-06 20:20:50 -07:00
committed by GitHub
parent 9ee1c61ca2
commit 97a8b64c1d
16 changed files with 261 additions and 233 deletions

View File

@@ -6,14 +6,12 @@ using Content.Server.Disposal.Unit.EntitySystems;
namespace Content.Server.Disposal.Tube.Components
{
[RegisterComponent]
[ComponentReference(typeof(IDisposalTubeComponent))]
[ComponentReference(typeof(DisposalTubeComponent))]
public sealed class DisposalEntryComponent : DisposalTubeComponent
[Access(typeof(DisposalTubeSystem), typeof(DisposalUnitSystem))]
public sealed class DisposalEntryComponent : Component
{
[Dependency] private readonly IEntityManager _entMan = default!;
private const string HolderPrototypeId = "DisposalHolder";
public override string ContainerId => "DisposalEntry";
public bool TryInsert(DisposalUnitComponent from, IEnumerable<string>? tags = default)
{
@@ -31,25 +29,7 @@ namespace Content.Server.Disposal.Tube.Components
if (tags != default)
holderComponent.Tags.UnionWith(tags);
return EntitySystem.Get<DisposableSystem>().EnterTube((holderComponent).Owner, Owner, holderComponent, null, this);
}
protected override Direction[] ConnectableDirections()
{
return new[] {_entMan.GetComponent<TransformComponent>(Owner).LocalRotation.GetDir()};
}
/// <summary>
/// Ejects contents when they come from the same direction the entry is facing.
/// </summary>
public override Direction NextDirection(DisposalHolderComponent holder)
{
if (holder.PreviousDirectionFrom != Direction.Invalid)
{
return Direction.Invalid;
}
return ConnectableDirections()[0];
return EntitySystem.Get<DisposableSystem>().EnterTube((holderComponent).Owner, Owner, holderComponent);
}
}
}