diff --git a/Content.Client/Exodus/Fly/FlySystem.cs b/Content.Client/Exodus/Fly/FlySystem.cs index d6f5a26cf7..a4b5c5176b 100644 --- a/Content.Client/Exodus/Fly/FlySystem.cs +++ b/Content.Client/Exodus/Fly/FlySystem.cs @@ -67,8 +67,8 @@ private void OnTakeoffAnimationMessage(TakeoffAnimationMessage ev) KeyFrames = { new AnimationTrackProperty.KeyFrame(Vector2.Zero, 0f), - new AnimationTrackProperty.KeyFrame(new Vector2((float) Math.Sin(flyComp.TakeoffAngle) * 20f, - (float) Math.Cos(flyComp.TakeoffAngle) * 20f), flyComp.TakeoffTime) + new AnimationTrackProperty.KeyFrame(new Vector2((float) Math.Sin(flyComp.TakeoffAngle) * 5f, + (float) Math.Cos(flyComp.TakeoffAngle) * 5f), flyComp.TakeoffTime) } } } @@ -101,8 +101,8 @@ private void OnLandAnimationMessage(LandAnimationMessage ev) Property = nameof(SpriteComponent.Offset), KeyFrames = { - new AnimationTrackProperty.KeyFrame(new Vector2((float) Math.Sin(flyComp.LandAngle) * 20f, - (float) Math.Cos(flyComp.LandTime) * 20f), 0f), + new AnimationTrackProperty.KeyFrame(new Vector2((float) Math.Sin(flyComp.LandAngle) * 5f, + (float) Math.Cos(flyComp.LandTime) * 5f), 0f), new AnimationTrackProperty.KeyFrame(Vector2.Zero, flyComp.LandTime) } } diff --git a/Content.Server/Exodus/Fly/FlySystem.cs b/Content.Server/Exodus/Fly/FlySystem.cs index cd0c28910f..6623ae8aa3 100644 --- a/Content.Server/Exodus/Fly/FlySystem.cs +++ b/Content.Server/Exodus/Fly/FlySystem.cs @@ -11,8 +11,6 @@ namespace Content.Server.Exodus.Fly; /// public sealed class FlySystem : SharedFlySystem { - - [Dependency] private readonly SharedPhysicsSystem _physics = default!; [Dependency] private readonly IConsoleHost _console = default!; public override void Initialize() @@ -71,8 +69,6 @@ public override void Update(float frameTime) { if (flyComp.IsInAir) { - _physics.SetCanCollide(uid, true); - RaiseNetworkEvent(new LandMessage() { Entity = GetNetEntity(uid) @@ -82,6 +78,7 @@ public override void Update(float frameTime) } else { + SetCollidable(uid, false); RaiseNetworkEvent(new TakeoffMessage() { @@ -119,8 +116,6 @@ private void TakeOff(EntityUid uid, FlyComponent component) { Audio.PlayPvs(component.SoundTakeoff, uid); - _physics.SetCanCollide(uid, false); - component.DoAnimation = true; component.AnimationTimeEnd = Timing.CurTime + TimeSpan.FromSeconds(component.TakeoffTime); @@ -137,6 +132,8 @@ private void Land(EntityUid uid, FlyComponent component) component.DoAnimation = true; component.AnimationTimeEnd = Timing.CurTime + TimeSpan.FromSeconds(component.LandTime); + SetCollidable(uid, true); + RaiseNetworkEvent(new LandAnimationMessage() { Entity = GetNetEntity(uid) diff --git a/Content.Shared/Exodus/Fly/SharedFlySystem.cs b/Content.Shared/Exodus/Fly/SharedFlySystem.cs index 44643364d4..c18e94fd7c 100644 --- a/Content.Shared/Exodus/Fly/SharedFlySystem.cs +++ b/Content.Shared/Exodus/Fly/SharedFlySystem.cs @@ -11,7 +11,8 @@ using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Map; -using Robust.Shared.Prototypes; +using Robust.Shared.Physics.Systems; +using Robust.Shared.Physics.Components; using Robust.Shared.Serialization; using Robust.Shared.Timing; @@ -26,6 +27,7 @@ public abstract partial class SharedFlySystem : EntitySystem [Dependency] protected readonly SharedTransformSystem TransformSystem = default!; [Dependency] protected readonly SharedAudioSystem Audio = default!; [Dependency] protected readonly SharedContainerSystem Container = default!; + [Dependency] protected readonly SharedPhysicsSystem Physics = default!; public override void Initialize() { @@ -62,6 +64,12 @@ protected bool CanLand(EntityUid uid, FlyComponent? comp = null) return true; } + protected void SetCollidable(EntityUid uid, bool collidable) + { + var phys = EnsureComp(uid); + Physics.SetCanCollide(uid, collidable, body: phys); + } + [Serializable, NetSerializable] protected sealed class LandAnimationMessage : EntityEventArgs