Open slot storage keybind can now also close the UI (#27962)

This commit is contained in:
Kara
2024-05-12 17:03:07 -07:00
committed by GitHub
parent c325ca8566
commit d6e2cc0a8b

View File

@@ -1433,15 +1433,15 @@ public abstract class SharedStorageSystem : EntitySystem
private void HandleOpenBackpack(ICommonSession? session) private void HandleOpenBackpack(ICommonSession? session)
{ {
HandleOpenSlotUI(session, "back"); HandleToggleSlotUI(session, "back");
} }
private void HandleOpenBelt(ICommonSession? session) private void HandleOpenBelt(ICommonSession? session)
{ {
HandleOpenSlotUI(session, "belt"); HandleToggleSlotUI(session, "belt");
} }
private void HandleOpenSlotUI(ICommonSession? session, string slot) private void HandleToggleSlotUI(ICommonSession? session, string slot)
{ {
if (session is not { } playerSession) if (session is not { } playerSession)
return; return;
@@ -1455,7 +1455,14 @@ public abstract class SharedStorageSystem : EntitySystem
if (!ActionBlocker.CanInteract(playerEnt, storageEnt)) if (!ActionBlocker.CanInteract(playerEnt, storageEnt))
return; return;
OpenStorageUI(storageEnt.Value, playerEnt); if (!_ui.IsUiOpen(storageEnt.Value, StorageComponent.StorageUiKey.Key, playerEnt))
{
OpenStorageUI(storageEnt.Value, playerEnt);
}
else
{
_ui.CloseUi(storageEnt.Value, StorageComponent.StorageUiKey.Key, playerEnt);
}
} }
protected void ClearCantFillReasons() protected void ClearCantFillReasons()