Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Slowdown to Dragging Items that Slow when Held #29364

Merged
merged 5 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Content.Shared/Hands/EntitySystems/SharedHandsSystem.Relay.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Content.Shared.Hands.Components;
using Content.Shared.Movement.Systems;
using Content.Shared.Movement.Pulling.Components;

namespace Content.Shared.Hands.EntitySystems;

Expand All @@ -17,5 +18,8 @@ private void RelayEvent<T>(Entity<HandsComponent> entity, ref T args) where T :
{
RaiseLocalEvent(held, ref ev);
}

if (TryComp<PullerComponent>(entity, out var puller) && puller.Pulling != null)
RaiseLocalEvent(puller.Pulling.Value, ref ev);
}
Cojoke-dot marked this conversation as resolved.
Show resolved Hide resolved
}
13 changes: 13 additions & 0 deletions Content.Shared/Item/HeldSpeedModifierSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Content.Shared.Clothing;
using Content.Shared.Hands;
using Content.Shared.Movement.Systems;
using Content.Shared.Movement.Pulling.Events;

namespace Content.Shared.Item;

Expand All @@ -16,6 +17,8 @@ public override void Initialize()
{
SubscribeLocalEvent<HeldSpeedModifierComponent, GotEquippedHandEvent>(OnGotEquippedHand);
SubscribeLocalEvent<HeldSpeedModifierComponent, GotUnequippedHandEvent>(OnGotUnequippedHand);
SubscribeLocalEvent<HeldSpeedModifierComponent, PullStartedMessage>(OnGotStartPull);
SubscribeLocalEvent<HeldSpeedModifierComponent, PullStoppedMessage>(OnGotStopPull);
Cojoke-dot marked this conversation as resolved.
Show resolved Hide resolved
SubscribeLocalEvent<HeldSpeedModifierComponent, HeldRelayedEvent<RefreshMovementSpeedModifiersEvent>>(OnRefreshMovementSpeedModifiers);
}

Expand All @@ -29,6 +32,16 @@ private void OnGotUnequippedHand(Entity<HeldSpeedModifierComponent> ent, ref Got
_movementSpeedModifier.RefreshMovementSpeedModifiers(args.User);
}

private void OnGotStartPull(Entity<HeldSpeedModifierComponent> ent, ref PullStartedMessage args)
{
_movementSpeedModifier.RefreshMovementSpeedModifiers(args.PullerUid);
}

private void OnGotStopPull(Entity<HeldSpeedModifierComponent> ent, ref PullStoppedMessage args)
{
_movementSpeedModifier.RefreshMovementSpeedModifiers(args.PullerUid);
}

private void OnRefreshMovementSpeedModifiers(EntityUid uid, HeldSpeedModifierComponent component, HeldRelayedEvent<RefreshMovementSpeedModifiersEvent> args)
{
var walkMod = component.WalkModifier;
Expand Down
Loading