Storage fixes (#36533)
* Storage fixes - Add size event. - Fix reclaim not running always. * Block the toggles * Standardise and popup explaining * Disable item toggles in bags * Fix verb popping up even if we can't activate * Conflicts * Validate * Stop drags if source closes * Really fixes * Real fix * Revert this
This commit is contained in:
@@ -269,12 +269,19 @@ public sealed class StorageUIController : UIController, IOnSystemChanged<Storage
|
||||
var position = targetStorage.GetMouseGridPieceLocation(dragEnt, dragLoc);
|
||||
var newLocation = new ItemStorageLocation(DraggingRotation, position);
|
||||
|
||||
EntityManager.RaisePredictiveEvent(new StorageSetItemLocationEvent(
|
||||
EntityManager.GetNetEntity(draggingGhost.Entity),
|
||||
EntityManager.GetNetEntity(sourceStorage),
|
||||
newLocation));
|
||||
if (!_storage.ItemFitsInGridLocation(dragEnt, sourceStorage, newLocation))
|
||||
{
|
||||
window.Reclaim(control.Location, control);
|
||||
}
|
||||
else
|
||||
{
|
||||
EntityManager.RaisePredictiveEvent(new StorageSetItemLocationEvent(
|
||||
EntityManager.GetNetEntity(draggingGhost.Entity),
|
||||
EntityManager.GetNetEntity(sourceStorage),
|
||||
newLocation));
|
||||
|
||||
window.Reclaim(newLocation, control);
|
||||
window.Reclaim(newLocation, control);
|
||||
}
|
||||
}
|
||||
// Dragging to new storage
|
||||
else if (targetStorage?.StorageEntity != null && targetStorage != window)
|
||||
@@ -336,6 +343,17 @@ public sealed class StorageUIController : UIController, IOnSystemChanged<Storage
|
||||
if (DraggingGhost == null)
|
||||
return false;
|
||||
|
||||
var player = _player.LocalEntity;
|
||||
|
||||
// If the attached storage is closed then stop dragging
|
||||
if (player == null ||
|
||||
!_storage.TryGetStorageLocation(DraggingGhost.Entity, out var container, out _, out _) ||
|
||||
!_ui.IsUiOpen(container.Owner, StorageComponent.StorageUiKey.Key, player.Value))
|
||||
{
|
||||
DraggingGhost.Orphan();
|
||||
return false;
|
||||
}
|
||||
|
||||
SetDraggingRotation();
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user