Refactor drag and drop to use a shared interface (#2012)

* WIP in progress hours

* Cleanup

* Fix bugle

* Fix nullable error

* Merge fixes

* Merge fixes

* Merge fixes
This commit is contained in:
DrSmugleaf
2020-10-14 15:24:07 +02:00
committed by GitHub
parent f715eed63c
commit cdedaeb12e
37 changed files with 527 additions and 377 deletions

View File

@@ -1,16 +1,36 @@
using System;
using System.Collections.Generic;
using Content.Shared.GameObjects.Components.Items;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.UserInterface;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Serialization;
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
namespace Content.Shared.GameObjects.Components.GUI
{
public class SharedStrippableComponent : Component
public abstract class SharedStrippableComponent : Component, IDraggable
{
public override string Name => "Strippable";
public bool CanBeStripped(IEntity by)
{
return by != Owner
&& by.HasComponent<ISharedHandsComponent>()
&& ActionBlockerSystem.CanInteract(by);
}
bool IDraggable.CanDrop(CanDropEventArgs args)
{
return args.Target != args.Dragged
&& args.Target == args.User
&& CanBeStripped(args.User);
}
public abstract bool Drop(DragDropEventArgs args);
[NetSerializable, Serializable]
public enum StrippingUiKey
{