[Tweak] Medipen prick popup is now centered on player (and some cleanup) (#15665)

This commit is contained in:
OctoRocket
2023-04-22 22:43:46 -05:00
committed by GitHub
parent 1320bedd8e
commit 4194a7d666

View File

@@ -2,7 +2,7 @@ using System.Linq;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using Content.Server.Chemistry.Components; using Content.Server.Chemistry.Components;
using Content.Server.Chemistry.Components.SolutionManager; using Content.Server.Chemistry.Components.SolutionManager;
using Content.Server.Weapons.Melee; // using Content.Server.Weapons.Melee;
using Content.Shared.Chemistry.Reagent; using Content.Shared.Chemistry.Reagent;
using Content.Shared.Database; using Content.Shared.Database;
using Content.Shared.FixedPoint; using Content.Shared.FixedPoint;
@@ -12,7 +12,6 @@ using Content.Shared.Interaction.Events;
using Content.Shared.Mobs.Components; using Content.Shared.Mobs.Components;
using Content.Shared.Weapons.Melee.Events; using Content.Shared.Weapons.Melee.Events;
using Content.Shared.Timing; using Content.Shared.Timing;
using Robust.Shared.Player;
namespace Content.Server.Chemistry.EntitySystems namespace Content.Server.Chemistry.EntitySystems
{ {
@@ -30,7 +29,8 @@ namespace Content.Server.Chemistry.EntitySystems
private void OnUseInHand(EntityUid uid, HyposprayComponent component, UseInHandEvent args) private void OnUseInHand(EntityUid uid, HyposprayComponent component, UseInHandEvent args)
{ {
if (args.Handled) return; if (args.Handled)
return;
TryDoInject(uid, args.User, args.User); TryDoInject(uid, args.User, args.User);
args.Handled = true; args.Handled = true;
@@ -68,9 +68,8 @@ namespace Content.Server.Chemistry.EntitySystems
if (!EligibleEntity(target, _entMan)) if (!EligibleEntity(target, _entMan))
return false; return false;
if (TryComp(uid, out UseDelayComponent? delayComp)) if (TryComp(uid, out UseDelayComponent? delayComp) && _useDelay.ActiveDelay(uid, delayComp))
if (_useDelay.ActiveDelay(uid, delayComp)) return false;
return false;
string? msgFormat = null; string? msgFormat = null;
@@ -100,9 +99,7 @@ namespace Content.Server.Chemistry.EntitySystems
if (target != user) if (target != user)
{ {
_popup.PopupCursor(Loc.GetString("hypospray-component-feel-prick-message"), target.Value); _popup.PopupEntity(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);
// TODO: This should just be using melee attacks... // TODO: This should just be using melee attacks...
// meleeSys.SendLunge(angle, user); // meleeSys.SendLunge(angle, user);
} }
@@ -131,7 +128,7 @@ namespace Content.Server.Chemistry.EntitySystems
_reactiveSystem.DoEntityReaction(target.Value, removedSolution, ReactionMethod.Injection); _reactiveSystem.DoEntityReaction(target.Value, removedSolution, ReactionMethod.Injection);
_solutions.TryAddSolution(target.Value, targetSolution, removedSolution); _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}"); _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; return true;