Remove drag & drop dropping items from containers (#32706)

* Initial commit

* Update based on maintainer discussion

* Forgot to remove this woops
This commit is contained in:
SlamBamActionman
2024-11-20 02:00:38 +01:00
committed by GitHub
parent efa28fc650
commit 89392e2424
3 changed files with 0 additions and 34 deletions

View File

@@ -307,12 +307,6 @@ public sealed class StorageUIController : UIController, IOnSystemChanged<Storage
_entity.GetNetEntity(storageEnt), _entity.GetNetEntity(storageEnt),
new ItemStorageLocation(DraggingRotation, position))); new ItemStorageLocation(DraggingRotation, position)));
} }
else
{
_entity.RaisePredictiveEvent(new StorageRemoveItemEvent(
_entity.GetNetEntity(draggingGhost.Entity),
_entity.GetNetEntity(storageEnt)));
}
_menuDragHelper.EndDrag(); _menuDragHelper.EndDrag();
_container?.BuildItemPieces(); _container?.BuildItemPieces();

View File

@@ -129,7 +129,6 @@ public abstract class SharedStorageSystem : EntitySystem
SubscribeAllEvent<StorageInteractWithItemEvent>(OnInteractWithItem); SubscribeAllEvent<StorageInteractWithItemEvent>(OnInteractWithItem);
SubscribeAllEvent<StorageSetItemLocationEvent>(OnSetItemLocation); SubscribeAllEvent<StorageSetItemLocationEvent>(OnSetItemLocation);
SubscribeAllEvent<StorageInsertItemIntoLocationEvent>(OnInsertItemIntoLocation); SubscribeAllEvent<StorageInsertItemIntoLocationEvent>(OnInsertItemIntoLocation);
SubscribeAllEvent<StorageRemoveItemEvent>(OnRemoveItem);
SubscribeAllEvent<StorageSaveItemLocationEvent>(OnSaveItemLocation); SubscribeAllEvent<StorageSaveItemLocationEvent>(OnSaveItemLocation);
SubscribeLocalEvent<StorageComponent, GotReclaimedEvent>(OnReclaimed); SubscribeLocalEvent<StorageComponent, GotReclaimedEvent>(OnReclaimed);
@@ -639,19 +638,6 @@ public abstract class SharedStorageSystem : EntitySystem
TrySetItemStorageLocation(item!, storage!, msg.Location); TrySetItemStorageLocation(item!, storage!, msg.Location);
} }
private void OnRemoveItem(StorageRemoveItemEvent msg, EntitySessionEventArgs args)
{
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);
}
private void OnInsertItemIntoLocation(StorageInsertItemIntoLocationEvent msg, EntitySessionEventArgs args) 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)) if (!ValidateInput(args, msg.StorageEnt, msg.ItemEnt, out var player, out var storage, out var item, held: true))

View File

@@ -169,20 +169,6 @@ namespace Content.Shared.Storage
} }
} }
[Serializable, NetSerializable]
public sealed class StorageRemoveItemEvent : EntityEventArgs
{
public readonly NetEntity ItemEnt;
public readonly NetEntity StorageEnt;
public StorageRemoveItemEvent(NetEntity itemEnt, NetEntity storageEnt)
{
ItemEnt = itemEnt;
StorageEnt = storageEnt;
}
}
[Serializable, NetSerializable] [Serializable, NetSerializable]
public sealed class StorageInsertItemIntoLocationEvent : EntityEventArgs public sealed class StorageInsertItemIntoLocationEvent : EntityEventArgs
{ {