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:
@@ -9,7 +9,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
||||
namespace Content.Shared.Medical.Cryogenics;
|
||||
|
||||
[NetworkedComponent]
|
||||
public abstract class SharedCryoPodComponent: Component, IDragDropOn
|
||||
public abstract class SharedCryoPodComponent: Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the name of the atmospherics port to draw gas from.
|
||||
@@ -87,19 +87,4 @@ public abstract class SharedCryoPodComponent: Component, IDragDropOn
|
||||
ContainsEntity,
|
||||
IsOn
|
||||
}
|
||||
|
||||
public bool CanInsert(EntityUid entity)
|
||||
{
|
||||
return IoCManager.Resolve<IEntityManager>().HasComponent<BodyComponent>(entity);
|
||||
}
|
||||
|
||||
bool IDragDropOn.CanDragDropOn(DragDropEvent eventArgs)
|
||||
{
|
||||
return CanInsert(eventArgs.Dragged);
|
||||
}
|
||||
|
||||
bool IDragDropOn.DragDropOn(DragDropEvent eventArgs)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Content.Server.Medical.Components;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Emag.Systems;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
@@ -26,6 +28,12 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
|
||||
InitializeInsideCryoPod();
|
||||
}
|
||||
|
||||
protected void OnCryoPodCanDropOn(EntityUid uid, SharedCryoPodComponent component, ref CanDropTargetEvent args)
|
||||
{
|
||||
args.CanDrop = args.CanDrop && HasComp<BodyComponent>(args.Dragged);
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
protected void OnComponentInit(EntityUid uid, SharedCryoPodComponent cryoPodComponent, ComponentInit args)
|
||||
{
|
||||
cryoPodComponent.BodyContainer = _containerSystem.EnsureContainer<ContainerSlot>(uid, "scanner-body");
|
||||
|
||||
Reference in New Issue
Block a user