From: Geekyhobo <66805063+Geekyhobo@users.noreply.github.com> Date: Thu, 4 Jan 2024 05:31:58 +0000 (-0500) Subject: Aghost Now Can Drop Things Wherever They Want (#23502) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=94a4e4ca10231027a6d0d0f9b860131443765033;p=space-station-14.git Aghost Now Can Drop Things Wherever They Want (#23502) * Aghost Now Can Drop Things Wherever They Want * update admin CL * Update Resources/Changelog/Admin.yml * Update Resources/Prototypes/tags.yml * Update Resources/Prototypes/tags.yml --------- Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> --- diff --git a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs index 7d2244fbbb..42201ab6af 100644 --- a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs +++ b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs @@ -1,6 +1,7 @@ using System.Numerics; using Content.Shared.Hands.Components; using Content.Shared.Interaction; +using Content.Shared.Tag; using Robust.Shared.Containers; using Robust.Shared.Map; @@ -8,6 +9,7 @@ namespace Content.Shared.Hands.EntitySystems; public abstract partial class SharedHandsSystem { + [Dependency] private readonly TagSystem _tagSystem = default!; private void InitializeDrop() { SubscribeLocalEvent(HandleEntityRemoved); @@ -30,6 +32,12 @@ public abstract partial class SharedHandsSystem _virtualSystem.Delete((args.Entity, @virtual), uid); } + private bool ShouldIgnoreRestrictions(EntityUid user) + { + //Checks if the Entity is something that shouldn't care about drop distance or walls ie Aghost + return !_tagSystem.HasTag(user, "BypassDropChecks"); + } + /// /// Checks whether an entity can drop a given entity. Will return false if they are not holding the entity. /// @@ -153,20 +161,24 @@ public abstract partial class SharedHandsSystem } /// - /// Calculates the final location a dropped item will end up at, accounting for max drop range and collision along the targeted drop path. + /// Calculates the final location a dropped item will end up at, accounting for max drop range and collision along the targeted drop path, Does a check to see if a user should bypass those checks as well. /// private Vector2 GetFinalDropCoordinates(EntityUid user, MapCoordinates origin, MapCoordinates target) { var dropVector = target.Position - origin.Position; var requestedDropDistance = dropVector.Length(); + var dropLength = dropVector.Length(); - if (dropVector.Length() > SharedInteractionSystem.InteractionRange) + if (ShouldIgnoreRestrictions(user)) { - dropVector = dropVector.Normalized() * SharedInteractionSystem.InteractionRange; - target = new MapCoordinates(origin.Position + dropVector, target.MapId); - } + if (dropVector.Length() > SharedInteractionSystem.InteractionRange) + { + dropVector = dropVector.Normalized() * SharedInteractionSystem.InteractionRange; + target = new MapCoordinates(origin.Position + dropVector, target.MapId); + } - var dropLength = _interactionSystem.UnobstructedDistance(origin, target, predicate: e => e == user); + dropLength = _interactionSystem.UnobstructedDistance(origin, target, predicate: e => e == user); + } if (dropLength < requestedDropDistance) return origin.Position + dropVector.Normalized() * dropLength; diff --git a/Resources/Changelog/Admin.yml b/Resources/Changelog/Admin.yml index 5144dd9dad..50b38cdf7e 100644 --- a/Resources/Changelog/Admin.yml +++ b/Resources/Changelog/Admin.yml @@ -81,3 +81,8 @@ Entries: - {message: 'Fixed not being able to right click in AHelps and the players and objects tabs.', type: Fix} id: 13 time: '2023-12-21T06:34:00.0000000+00:00' +- author: Geekyhobo + changes: + - {message: 'Fixed AGhosts not being able to drop items past the default range.', type: Fix} + id: 14 + time: '2024-1-4T01:30:00.0000000+00:00' diff --git a/Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml b/Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml index 2ea093060d..3d6b173f3d 100644 --- a/Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml +++ b/Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml @@ -11,6 +11,7 @@ - InstantDoAfters - CanPilot - BypassInteractionRangeChecks + - BypassDropChecks - type: Input context: "aghost" - type: Ghost diff --git a/Resources/Prototypes/tags.yml b/Resources/Prototypes/tags.yml index df6bf7cd24..fd73e8adfc 100644 --- a/Resources/Prototypes/tags.yml +++ b/Resources/Prototypes/tags.yml @@ -221,8 +221,11 @@ id: BulletFoam - type: Tag - id: BypassInteractionRangeChecks + id: BypassDropChecks +- type: Tag + id: BypassInteractionRangeChecks + - type: Tag id: CableCoil