ECS dragdrop (#12973)
* ECS dragdrop No more excuses. * AAAAAAAAAAAAAA * kry * events * aaaaaaaaaa * HUH * Fix stripping * aaaaaa * spoike * asease * fix table vaulting * ded * rebiew * aaaaaaaaaaaaa * drag * aeaeae * weh
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Hands.Components;
|
||||
|
||||
namespace Content.Shared.Strip.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// Give to an entity to say they can strip another entity.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class SharedStrippingComponent : Component, IDragDropOn
|
||||
{
|
||||
bool IDragDropOn.CanDragDropOn(DragDropEvent eventArgs)
|
||||
{
|
||||
var ent = IoCManager.Resolve<IEntityManager>();
|
||||
return eventArgs.Target != eventArgs.Dragged &&
|
||||
eventArgs.Target == eventArgs.User &&
|
||||
ent.HasComponent<SharedStrippableComponent>(eventArgs.Dragged) &&
|
||||
ent.HasComponent<SharedHandsComponent>(eventArgs.User) &&
|
||||
ent.EntitySysManager.GetEntitySystem<ActionBlockerSystem>().CanInteract(eventArgs.User, eventArgs.Dragged);
|
||||
}
|
||||
|
||||
bool IDragDropOn.DragDropOn(DragDropEvent eventArgs)
|
||||
{
|
||||
// Handled by StrippableComponent
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,17 @@
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Inventory;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Strip.Components
|
||||
{
|
||||
public abstract class SharedStrippableComponent : Component, IDraggable
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class StrippableComponent : Component
|
||||
{
|
||||
bool IDraggable.CanDrop(CanDropEvent args)
|
||||
{
|
||||
var ent = IoCManager.Resolve<IEntityManager>();
|
||||
return args.Target != args.Dragged &&
|
||||
args.Target == args.User &&
|
||||
ent.HasComponent<SharedStrippingComponent>(args.User) &&
|
||||
ent.HasComponent<SharedHandsComponent>(args.User) &&
|
||||
ent.EntitySysManager.GetEntitySystem<ActionBlockerSystem>().CanInteract(args.User, args.Dragged);
|
||||
}
|
||||
|
||||
public abstract bool Drop(DragDropEvent args);
|
||||
/// <summary>
|
||||
/// The strip delay for hands.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("handDelay")]
|
||||
public float HandStripDelay = 4f;
|
||||
}
|
||||
|
||||
[NetSerializable, Serializable]
|
||||
10
Content.Shared/Strip/Components/StrippingComponent.cs
Normal file
10
Content.Shared/Strip/Components/StrippingComponent.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Strip.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// Give to an entity to say they can strip another entity.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class StrippingComponent : Component {}
|
||||
}
|
||||
Reference in New Issue
Block a user