]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Disarm throws item in random direction (#27589)
authorPlykiya <58439124+Plykiya@users.noreply.github.com>
Thu, 2 May 2024 12:32:47 +0000 (05:32 -0700)
committerGitHub <noreply@github.com>
Thu, 2 May 2024 12:32:47 +0000 (15:32 +0300)
* Disarm throws item in random direction

* Slightly increased offset

* Return the return

---------

Co-authored-by: Plykiya <plykiya@protonmail.com>
Content.Server/Hands/Systems/HandsSystem.cs

index e7527e2c76de63eaf72d142f47c405cbc9ea2b8d..4c6b80bd987939eb15ad82d5e38c09e65b01e51c 100644 (file)
@@ -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-";