"Fix" conveyors (#6301)
This commit is contained in:
@@ -21,7 +21,6 @@ namespace Content.Server.Conveyor
|
||||
public class ConveyorSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private StunSystem _stunSystem = default!;
|
||||
[Dependency] private IEntityLookup _entityLookup = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -111,55 +110,5 @@ namespace Content.Server.Conveyor
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the angle in which entities on top of this conveyor
|
||||
/// belt are pushed in
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The angle when taking into account if the conveyor is reversed
|
||||
/// </returns>
|
||||
public Angle GetAngle(ConveyorComponent component)
|
||||
{
|
||||
var adjustment = component.State == ConveyorState.Reversed ? MathHelper.Pi/2 : -MathHelper.Pi/2;
|
||||
var radians = MathHelper.DegreesToRadians(component.Angle);
|
||||
|
||||
return new Angle(EntityManager.GetComponent<TransformComponent>(component.Owner).LocalRotation.Theta + radians + adjustment);
|
||||
}
|
||||
|
||||
public IEnumerable<(EntityUid, IPhysBody)> GetEntitiesToMove(ConveyorComponent comp)
|
||||
{
|
||||
//todo uuuhhh cache this
|
||||
foreach (var entity in _entityLookup.GetEntitiesIntersecting(comp.Owner, flags: LookupFlags.Approximate))
|
||||
{
|
||||
if (Deleted(entity))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (entity == comp.Owner)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!EntityManager.TryGetComponent(entity, out IPhysBody? physics) ||
|
||||
physics.BodyType == BodyType.Static || physics.BodyStatus == BodyStatus.InAir || entity.IsWeightless())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (EntityManager.HasComponent<IMapGridComponent>(entity))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (entity.IsInContainer())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
yield return (entity, physics);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user