]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
[Tweak] Medipen prick popup is now centered on player (and some cleanup) (#15665)
authorOctoRocket <88291550+OctoRocket@users.noreply.github.com>
Sun, 23 Apr 2023 03:43:46 +0000 (22:43 -0500)
committerGitHub <noreply@github.com>
Sun, 23 Apr 2023 03:43:46 +0000 (13:43 +1000)
Content.Server/Chemistry/EntitySystems/ChemistrySystemHypospray.cs

index 2e0593ecf1992bcca858c16a51df09c484743602..d4076d6a19d507488796fc10bd57b1fc219940c7 100644 (file)
@@ -2,7 +2,7 @@ using System.Linq;
 using System.Diagnostics.CodeAnalysis;
 using Content.Server.Chemistry.Components;
 using Content.Server.Chemistry.Components.SolutionManager;
-using Content.Server.Weapons.Melee;
+// using Content.Server.Weapons.Melee;
 using Content.Shared.Chemistry.Reagent;
 using Content.Shared.Database;
 using Content.Shared.FixedPoint;
@@ -12,7 +12,6 @@ using Content.Shared.Interaction.Events;
 using Content.Shared.Mobs.Components;
 using Content.Shared.Weapons.Melee.Events;
 using Content.Shared.Timing;
-using Robust.Shared.Player;
 
 namespace Content.Server.Chemistry.EntitySystems
 {
@@ -30,7 +29,8 @@ namespace Content.Server.Chemistry.EntitySystems
 
         private void OnUseInHand(EntityUid uid, HyposprayComponent component, UseInHandEvent args)
         {
-            if (args.Handled) return;
+            if (args.Handled)
+                return;
 
             TryDoInject(uid, args.User, args.User);
             args.Handled = true;
@@ -68,9 +68,8 @@ namespace Content.Server.Chemistry.EntitySystems
             if (!EligibleEntity(target, _entMan))
                 return false;
 
-            if (TryComp(uid, out UseDelayComponent? delayComp))
-                if (_useDelay.ActiveDelay(uid, delayComp))
-                    return false;
+            if (TryComp(uid, out UseDelayComponent? delayComp) && _useDelay.ActiveDelay(uid, delayComp))
+                return false;
 
             string? msgFormat = null;
 
@@ -100,9 +99,7 @@ namespace Content.Server.Chemistry.EntitySystems
 
             if (target != user)
             {
-                _popup.PopupCursor(Loc.GetString("hypospray-component-feel-prick-message"), target.Value);
-                var meleeSys = EntitySystem.Get<MeleeWeaponSystem>();
-                var angle = Angle.FromWorldVec(_entMan.GetComponent<TransformComponent>(target.Value).WorldPosition - _entMan.GetComponent<TransformComponent>(user).WorldPosition);
+                _popup.PopupEntity(Loc.GetString("hypospray-component-feel-prick-message"), target.Value);
                 // TODO: This should just be using melee attacks...
                 // meleeSys.SendLunge(angle, user);
             }
@@ -131,7 +128,7 @@ namespace Content.Server.Chemistry.EntitySystems
             _reactiveSystem.DoEntityReaction(target.Value, removedSolution, ReactionMethod.Injection);
             _solutions.TryAddSolution(target.Value, targetSolution, removedSolution);
 
-            //same logtype as syringes...
+            // same LogType as syringes...
             _adminLogger.Add(LogType.ForceFeed, $"{_entMan.ToPrettyString(user):user} injected {_entMan.ToPrettyString(target.Value):target} with a solution {SolutionContainerSystem.ToPrettyString(removedSolution):removedSolution} using a {_entMan.ToPrettyString(uid):using}");
 
             return true;