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

@@ -1,37 +1,10 @@
using Content.Server.Disposal.Unit.Components;
namespace Content.Server.Disposal.Tube.Components
{
// TODO: Different types of tubes eject in random direction with no exit point
[RegisterComponent]
[ComponentReference(typeof(IDisposalTubeComponent))]
[Access(typeof(DisposalTubeSystem))]
[Virtual]
[ComponentReference(typeof(DisposalTubeComponent))]
public class DisposalTransitComponent : DisposalTubeComponent
public class DisposalTransitComponent : Component
{
public override string ContainerId => "DisposalTransit";
protected override Direction[] ConnectableDirections()
{
var rotation = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation;
var opposite = new Angle(rotation.Theta + Math.PI);
return new[] {rotation.GetDir(), opposite.GetDir()};
}
public override Direction NextDirection(DisposalHolderComponent holder)
{
var directions = ConnectableDirections();
var previousDF = holder.PreviousDirectionFrom;
var forward = directions[0];
if (previousDF == Direction.Invalid)
{
return forward;
}
var backward = directions[1];
return previousDF == forward ? backward : forward;
}
}
}