Skip to content

Commit

Permalink
don't allow jetpacking while downed
Browse files Browse the repository at this point in the history
  • Loading branch information
Mnemotechnician committed Jul 17, 2024
1 parent a064633 commit d7875a0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Content.Shared/Movement/Systems/SharedJetpackSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Content.Shared.Movement.Components;
using Content.Shared.Movement.Events;
using Content.Shared.Popups;
using Content.Shared.Standing;
using Robust.Shared.Containers;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Systems;
Expand All @@ -20,6 +21,7 @@ public abstract class SharedJetpackSystem : EntitySystem
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly ActionContainerSystem _actionContainer = default!;
[Dependency] private readonly StandingStateSystem _standing = default!;

public override void Initialize()
{
Expand All @@ -44,6 +46,10 @@ private void OnMapInit(EntityUid uid, JetpackComponent component, MapInitEvent a

private void OnJetpackCanWeightlessMove(EntityUid uid, JetpackComponent component, ref CanWeightlessMoveEvent args)
{
Container.TryGetContainingContainer(uid, out var container);
if (container?.Owner is { } owner && _standing.IsDown(owner))
return;

args.CanMove = true;
}

Expand Down Expand Up @@ -72,6 +78,9 @@ private void OnJetpackDropped(EntityUid uid, JetpackComponent component, Dropped

private void OnJetpackUserCanWeightless(EntityUid uid, JetpackUserComponent component, ref CanWeightlessMoveEvent args)
{
if (_standing.IsDown(uid))
return;

args.CanMove = true;
}

Expand Down

0 comments on commit d7875a0

Please sign in to comment.