Skip to content

Commit

Permalink
1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Fragoler committed Aug 1, 2024
1 parent 2be2e92 commit 22fdb5a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
8 changes: 4 additions & 4 deletions Content.Client/Exodus/Fly/FlySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down Expand Up @@ -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)
}
}
Expand Down
9 changes: 3 additions & 6 deletions Content.Server/Exodus/Fly/FlySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ namespace Content.Server.Exodus.Fly;
/// </summary>
public sealed class FlySystem : SharedFlySystem
{

[Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly IConsoleHost _console = default!;

public override void Initialize()
Expand Down Expand Up @@ -71,8 +69,6 @@ public override void Update(float frameTime)
{
if (flyComp.IsInAir)
{
_physics.SetCanCollide(uid, true);

RaiseNetworkEvent(new LandMessage()
{
Entity = GetNetEntity(uid)
Expand All @@ -82,6 +78,7 @@ public override void Update(float frameTime)
}
else
{
SetCollidable(uid, false);

RaiseNetworkEvent(new TakeoffMessage()
{
Expand Down Expand Up @@ -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);

Expand All @@ -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)
Expand Down
10 changes: 9 additions & 1 deletion Content.Shared/Exodus/Fly/SharedFlySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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()
{
Expand Down Expand Up @@ -62,6 +64,12 @@ protected bool CanLand(EntityUid uid, FlyComponent? comp = null)
return true;
}

protected void SetCollidable(EntityUid uid, bool collidable)
{
var phys = EnsureComp<PhysicsComponent>(uid);
Physics.SetCanCollide(uid, collidable, body: phys);
}


[Serializable, NetSerializable]
protected sealed class LandAnimationMessage : EntityEventArgs
Expand Down

0 comments on commit 22fdb5a

Please sign in to comment.