diff --git a/Content.Client/UserInterface/Systems/Storage/StorageUIController.cs b/Content.Client/UserInterface/Systems/Storage/StorageUIController.cs index 1e61ad983806..ecff43dd07dc 100644 --- a/Content.Client/UserInterface/Systems/Storage/StorageUIController.cs +++ b/Content.Client/UserInterface/Systems/Storage/StorageUIController.cs @@ -307,6 +307,12 @@ private void OnPieceUnpressed(GUIBoundKeyEventArgs args, ItemGridPiece control) _entity.GetNetEntity(storageEnt), new ItemStorageLocation(DraggingRotation, position))); } + else + { // Ronstation. + _entity.RaisePredictiveEvent(new StorageRemoveItemEvent( + _entity.GetNetEntity(draggingGhost.Entity), + _entity.GetNetEntity(storageEnt))); + } // Ronstation. _menuDragHelper.EndDrag(); _container?.BuildItemPieces(); diff --git a/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs b/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs index 183420db9d15..76232d49ab6a 100644 --- a/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs @@ -129,6 +129,7 @@ public override void Initialize() SubscribeAllEvent(OnInteractWithItem); SubscribeAllEvent(OnSetItemLocation); SubscribeAllEvent(OnInsertItemIntoLocation); + SubscribeAllEvent(OnRemoveItem); SubscribeAllEvent(OnSaveItemLocation); SubscribeLocalEvent(OnReclaimed); @@ -638,6 +639,18 @@ private void OnSetItemLocation(StorageSetItemLocationEvent msg, EntitySessionEve TrySetItemStorageLocation(item!, storage!, msg.Location); } + private void OnRemoveItem(StorageRemoveItemEvent msg, EntitySessionEventArgs args) // Ronstation. + { + if (!ValidateInput(args, msg.StorageEnt, msg.ItemEnt, out var player, out var storage, out var item)) + return; + + _adminLog.Add( + LogType.Storage, + LogImpact.Low, + $"{ToPrettyString(player):player} is removing {ToPrettyString(item):item} from {ToPrettyString(storage):storage}"); + TransformSystem.DropNextTo(item.Owner, player.Owner); + Audio.PlayPredicted(storage.Comp.StorageRemoveSound, storage, player, _audioParams); + } // Ronstation. private void OnInsertItemIntoLocation(StorageInsertItemIntoLocationEvent msg, EntitySessionEventArgs args) { if (!ValidateInput(args, msg.StorageEnt, msg.ItemEnt, out var player, out var storage, out var item, held: true)) diff --git a/Content.Shared/Storage/StorageComponent.cs b/Content.Shared/Storage/StorageComponent.cs index 5683ae95a719..d8239d27fca0 100644 --- a/Content.Shared/Storage/StorageComponent.cs +++ b/Content.Shared/Storage/StorageComponent.cs @@ -169,6 +169,20 @@ public StorageSetItemLocationEvent(NetEntity itemEnt, NetEntity storageEnt, Item } } + [Serializable, NetSerializable] // Ronstation. + public sealed class StorageRemoveItemEvent : EntityEventArgs + { + public readonly NetEntity ItemEnt; + + public readonly NetEntity StorageEnt; + + public StorageRemoveItemEvent(NetEntity itemEnt, NetEntity storageEnt) + { + ItemEnt = itemEnt; + StorageEnt = storageEnt; + } + } // Ronstation. + [Serializable, NetSerializable] public sealed class StorageInsertItemIntoLocationEvent : EntityEventArgs {