1
0

SharedRotationVisualsSystem.cs 858 B

1234567891011121314151617181920212223242526272829
  1. namespace Content.Shared.Rotation;
  2. public abstract class SharedRotationVisualsSystem : EntitySystem
  3. {
  4. /// <summary>
  5. /// Sets the rotation an entity will have when it is "horizontal"
  6. /// </summary>
  7. public void SetHorizontalAngle(Entity<RotationVisualsComponent?> ent, Angle angle)
  8. {
  9. if (!Resolve(ent, ref ent.Comp, false))
  10. return;
  11. if (ent.Comp.HorizontalRotation.Equals(angle))
  12. return;
  13. ent.Comp.HorizontalRotation = angle;
  14. Dirty(ent);
  15. }
  16. /// <summary>
  17. /// Resets the rotation an entity will have when it is "horizontal" back to it's default value.
  18. /// </summary>
  19. public void ResetHorizontalAngle(Entity<RotationVisualsComponent?> ent)
  20. {
  21. if (Resolve(ent, ref ent.Comp, false))
  22. SetHorizontalAngle(ent, ent.Comp.DefaultRotation);
  23. }
  24. }