Revert "fix: inventory interaction on "disablePlayerInventory = true""

This reverts commit a58ec5a29c.
This commit is contained in:
clasher113 2025-12-28 17:58:12 +02:00
parent a58ec5a29c
commit a1549983f8

View file

@ -385,12 +385,15 @@ void Hud::update(bool visible) {
/// @brief Show inventory on the screen and turn on inventory mode blocking movement
void Hud::openInventory() {
auto& content = frontend.getLevel().content;
showExchangeSlot();
inventoryOpen = true;
auto inventory = player.getInventory();
auto inventoryDocument = assets.get<UiDocument>("core:inventory");
inventoryView = std::dynamic_pointer_cast<InventoryView>(inventoryDocument->getRoot());
inventoryView->bind(inventory, &content);
add(HudElement(HudElementMode::INVENTORY, inventoryDocument, inventoryView, false));
add(HudElement(HudElementMode::INVENTORY, nullptr, exchangeSlot, false));
}
std::shared_ptr<Inventory> Hud::openInventory(
@ -411,10 +414,9 @@ std::shared_ptr<Inventory> Hud::openInventory(
if (playerInventory) {
openInventory();
} else {
inventoryOpen = true;
}
showExchangeSlot();
inventoryOpen = true;
if (inv == nullptr) {
inv = level.inventories->createVirtual(secondInvView->getSlotsCount());
}
@ -444,10 +446,9 @@ void Hud::openInventory(
secondUI = blockUI;
if (playerInventory) {
openInventory();
} else {
inventoryOpen = true;
}
showExchangeSlot();
inventoryOpen = true;
if (blockinv == nullptr) {
blockinv = level.inventories->createVirtual(blockUI->getSlotsCount());
}
@ -476,7 +477,6 @@ void Hud::showExchangeSlot() {
exchangeSlot->setInteractive(false);
exchangeSlot->setZIndex(1);
gui.store(SlotView::EXCHANGE_SLOT_NAME, exchangeSlot);
add(HudElement(HudElementMode::INVENTORY, nullptr, exchangeSlot, false));
}
void Hud::showOverlay(
@ -488,10 +488,10 @@ void Hud::showOverlay(
secondUI = doc->getRoot();
if (playerInventory) {
openInventory();
} else {
showExchangeSlot();
inventoryOpen = true;
}
showExchangeSlot();
inventoryOpen = true;
add(HudElement(HudElementMode::INVENTORY, doc, secondUI, false), args);
}