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>
This commit is contained in:
@@ -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<HandsComponent, EntRemovedFromContainerMessage>(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");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether an entity can drop a given entity. Will return false if they are not holding the entity.
|
||||
/// </summary>
|
||||
@@ -153,20 +161,24 @@ public abstract partial class SharedHandsSystem
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
private Vector2 GetFinalDropCoordinates(EntityUid user, MapCoordinates origin, MapCoordinates target)
|
||||
{
|
||||
var dropVector = target.Position - origin.Position;
|
||||
var requestedDropDistance = dropVector.Length();
|
||||
var dropLength = dropVector.Length();
|
||||
|
||||
if (ShouldIgnoreRestrictions(user))
|
||||
{
|
||||
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;
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
- InstantDoAfters
|
||||
- CanPilot
|
||||
- BypassInteractionRangeChecks
|
||||
- BypassDropChecks
|
||||
- type: Input
|
||||
context: "aghost"
|
||||
- type: Ghost
|
||||
|
||||
@@ -220,6 +220,9 @@
|
||||
- type: Tag
|
||||
id: BulletFoam
|
||||
|
||||
- type: Tag
|
||||
id: BypassDropChecks
|
||||
|
||||
- type: Tag
|
||||
id: BypassInteractionRangeChecks
|
||||
|
||||
|
||||
Reference in New Issue
Block a user