Drone Interaction Checks & Cleanup (#6731)

This commit is contained in:
Rane
2022-02-18 17:57:31 -05:00
committed by GitHub
parent 9f439f1d36
commit 67661ddbdb
7 changed files with 51 additions and 32 deletions

View File

@@ -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.