Drone Interaction Checks & Cleanup (#6731)
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Analyzers;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Drone.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
[NetworkedComponent]
|
||||
public sealed class DroneToolComponent : Component {}
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Containers;
|
||||
using Content.Shared.Drone.Components;
|
||||
|
||||
namespace Content.Shared.Drone
|
||||
{
|
||||
@@ -9,15 +7,8 @@ namespace Content.Shared.Drone
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<DroneToolComponent, ContainerGettingRemovedAttemptEvent>(OnRemoveAttempt);
|
||||
}
|
||||
|
||||
private void OnRemoveAttempt(EntityUid uid, DroneToolComponent tool, ContainerGettingRemovedAttemptEvent args)
|
||||
{
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum DroneVisuals : byte
|
||||
{
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Interaction.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
[NetworkedComponent]
|
||||
public sealed class UnremoveableComponent : Component {}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ using Content.Shared.CombatMode;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Input;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Interaction.Components;
|
||||
using Content.Shared.Physics;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Throwing;
|
||||
@@ -54,6 +56,7 @@ namespace Content.Shared.Interaction
|
||||
{
|
||||
SubscribeLocalEvent<BoundUserInterfaceMessageAttempt>(OnBoundInterfaceInteractAttempt);
|
||||
SubscribeAllEvent<InteractInventorySlotEvent>(HandleInteractInventorySlotEvent);
|
||||
SubscribeLocalEvent<UnremoveableComponent, ContainerGettingRemovedAttemptEvent>(OnRemoveAttempt);
|
||||
|
||||
CommandBinds.Builder
|
||||
.Bind(ContentKeyFunctions.AltActivateItemInWorld,
|
||||
@@ -91,6 +94,15 @@ namespace Content.Shared.Interaction
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prevents an item with the Unremovable component from being removed from a container by almost any means
|
||||
/// </summary>
|
||||
private void OnRemoveAttempt(EntityUid uid, UnremoveableComponent item, ContainerGettingRemovedAttemptEvent args)
|
||||
{
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Handles the event were a client uses an item in their inventory or in their hands, either by
|
||||
/// alt-clicking it or pressing 'E' while hovering over it.
|
||||
|
||||
Reference in New Issue
Block a user