Fix rotation visuals desync & appearance state spam (#23016)

* Fix rotation visuals desync

* :bucklemeup:

* A
This commit is contained in:
Leon Friedrich
2023-12-26 18:32:25 -05:00
committed by GitHub
parent 476ea14e8a
commit cf98300ba2
13 changed files with 106 additions and 69 deletions

View File

@@ -0,0 +1,29 @@
namespace Content.Shared.Rotation;
public abstract class SharedRotationVisualsSystem : EntitySystem
{
/// <summary>
/// Sets the rotation an entity will have when it is "horizontal"
/// </summary>
public void SetHorizontalAngle(Entity<RotationVisualsComponent?> ent, Angle angle)
{
if (!Resolve(ent, ref ent.Comp, false))
return;
if (ent.Comp.HorizontalRotation.Equals(angle))
return;
ent.Comp.HorizontalRotation = angle;
Dirty(ent);
}
/// <summary>
/// Resets the rotation an entity will have when it is "horizontal" back to it's default value.
/// </summary>
public void ResetHorizontalAngle(Entity<RotationVisualsComponent?> ent)
{
if (Resolve(ent, ref ent.Comp, false))
SetHorizontalAngle(ent, ent.Comp.DefaultRotation);
}
}