_entity.GetNetEntity(storageEnt),
new ItemStorageLocation(DraggingRotation, position)));
}
- else
- {
- _entity.RaisePredictiveEvent(new StorageRemoveItemEvent(
- _entity.GetNetEntity(draggingGhost.Entity),
- _entity.GetNetEntity(storageEnt)));
- }
_menuDragHelper.EndDrag();
_container?.BuildItemPieces();
SubscribeAllEvent<StorageInteractWithItemEvent>(OnInteractWithItem);
SubscribeAllEvent<StorageSetItemLocationEvent>(OnSetItemLocation);
SubscribeAllEvent<StorageInsertItemIntoLocationEvent>(OnInsertItemIntoLocation);
- SubscribeAllEvent<StorageRemoveItemEvent>(OnRemoveItem);
SubscribeAllEvent<StorageSaveItemLocationEvent>(OnSaveItemLocation);
SubscribeLocalEvent<StorageComponent, GotReclaimedEvent>(OnReclaimed);
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)
{
if (!ValidateInput(args, msg.StorageEnt, msg.ItemEnt, out var player, out var storage, out var item, held: true))
}
}
- [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]
public sealed class StorageInsertItemIntoLocationEvent : EntityEventArgs
{