From: Plykiya <58439124+Plykiya@users.noreply.github.com> Date: Thu, 2 May 2024 12:32:47 +0000 (-0700) Subject: Disarm throws item in random direction (#27589) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=70f734edcc39a7f6ffb763ac2e4ad69967f0b145;p=space-station-14.git Disarm throws item in random direction (#27589) * Disarm throws item in random direction * Slightly increased offset * Return the return --------- Co-authored-by: Plykiya --- diff --git a/Content.Server/Hands/Systems/HandsSystem.cs b/Content.Server/Hands/Systems/HandsSystem.cs index e7527e2c76..4c6b80bd98 100644 --- a/Content.Server/Hands/Systems/HandsSystem.cs +++ b/Content.Server/Hands/Systems/HandsSystem.cs @@ -20,6 +20,7 @@ using Robust.Shared.GameStates; using Robust.Shared.Input.Binding; using Robust.Shared.Map; using Robust.Shared.Player; +using Robust.Shared.Random; using Robust.Shared.Timing; using Robust.Shared.Utility; @@ -28,6 +29,7 @@ namespace Content.Server.Hands.Systems public sealed class HandsSystem : SharedHandsSystem { [Dependency] private readonly IGameTiming _timing = default!; + [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly StackSystem _stackSystem = default!; [Dependency] private readonly VirtualItemSystem _virtualItemSystem = default!; [Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!; @@ -91,7 +93,8 @@ namespace Content.Server.Hands.Systems if (TryComp(uid, out PullerComponent? puller) && TryComp(puller.Pulling, out PullableComponent? pullable)) _pullingSystem.TryStopPull(puller.Pulling.Value, pullable); - if (!_handsSystem.TryDrop(uid, component.ActiveHand!, null, checkActionBlocker: false)) + var offsetRandomCoordinates = _transformSystem.GetMoverCoordinates(args.Target).Offset(_random.NextVector2(1f, 1.5f)); + if (!ThrowHeldItem(args.Target, offsetRandomCoordinates)) return; args.PopupPrefix = "disarm-action-";