Drag changes (#2487)

* Drag changes

* Higlights only show near cursor
* Don't highlight un-droppable entities
* Fixes invalid highlights issue

* Also the scanner

* 2 months fix

* Address reviews

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2021-01-11 22:14:01 +11:00
committed by GitHub
parent 067397c713
commit acb3c72d99
28 changed files with 335 additions and 131 deletions

View File

@@ -10,13 +10,11 @@ using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
using Content.Server.GameObjects.EntitySystems.DeviceNetwork;
using Content.Server.GameObjects.EntitySystems.DoAfter;
using Content.Server.Interfaces;
using Content.Server.Interfaces.GameObjects.Components.Items;
using Content.Server.Utility;
using Content.Shared.GameObjects.Components;
using Content.Shared.GameObjects.Components.Body;
using Content.Shared.GameObjects.Components.Disposal;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
using Content.Shared.GameObjects.Verbs;
using Content.Shared.Interfaces;
@@ -47,7 +45,7 @@ namespace Content.Server.GameObjects.Components.Disposal
[ComponentReference(typeof(SharedDisposalMailingUnitComponent))]
[ComponentReference(typeof(IActivate))]
[ComponentReference(typeof(IInteractUsing))]
public class DisposalMailingUnitComponent : SharedDisposalMailingUnitComponent, IInteractHand, IActivate, IInteractUsing, IDragDropOn
public class DisposalMailingUnitComponent : SharedDisposalMailingUnitComponent, IInteractHand, IActivate, IInteractUsing
{
[Dependency] private readonly IGameTiming _gameTiming = default!;
@@ -145,7 +143,7 @@ namespace Content.Server.GameObjects.Components.Disposal
/// </summary>
private (PressureState State, string Localized) _locState;
public bool CanInsert(IEntity entity)
public override bool CanInsert(IEntity entity)
{
if (!Anchored)
{
@@ -763,12 +761,12 @@ namespace Content.Server.GameObjects.Components.Disposal
return TryDrop(eventArgs.User, eventArgs.Using);
}
bool IDragDropOn.CanDragDropOn(DragDropEventArgs eventArgs)
public override bool CanDragDropOn(DragDropEventArgs eventArgs)
{
return CanInsert(eventArgs.Dragged);
}
bool IDragDropOn.DragDropOn(DragDropEventArgs eventArgs)
public override bool DragDropOn(DragDropEventArgs eventArgs)
{
_ = TryInsert(eventArgs.Dragged, eventArgs.User);
return true;