mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 22:11:51 +00:00
fix: inventory interaction on "disablePlayerInventory = true"
This commit is contained in:
parent
892c273e95
commit
a58ec5a29c
1 changed files with 10 additions and 10 deletions
|
|
@ -385,15 +385,12 @@ void Hud::update(bool visible) {
|
||||||
/// @brief Show inventory on the screen and turn on inventory mode blocking movement
|
/// @brief Show inventory on the screen and turn on inventory mode blocking movement
|
||||||
void Hud::openInventory() {
|
void Hud::openInventory() {
|
||||||
auto& content = frontend.getLevel().content;
|
auto& content = frontend.getLevel().content;
|
||||||
showExchangeSlot();
|
|
||||||
|
|
||||||
inventoryOpen = true;
|
|
||||||
auto inventory = player.getInventory();
|
auto inventory = player.getInventory();
|
||||||
auto inventoryDocument = assets.get<UiDocument>("core:inventory");
|
auto inventoryDocument = assets.get<UiDocument>("core:inventory");
|
||||||
inventoryView = std::dynamic_pointer_cast<InventoryView>(inventoryDocument->getRoot());
|
inventoryView = std::dynamic_pointer_cast<InventoryView>(inventoryDocument->getRoot());
|
||||||
inventoryView->bind(inventory, &content);
|
inventoryView->bind(inventory, &content);
|
||||||
add(HudElement(HudElementMode::INVENTORY, inventoryDocument, inventoryView, false));
|
add(HudElement(HudElementMode::INVENTORY, inventoryDocument, inventoryView, false));
|
||||||
add(HudElement(HudElementMode::INVENTORY, nullptr, exchangeSlot, false));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Inventory> Hud::openInventory(
|
std::shared_ptr<Inventory> Hud::openInventory(
|
||||||
|
|
@ -414,9 +411,10 @@ std::shared_ptr<Inventory> Hud::openInventory(
|
||||||
|
|
||||||
if (playerInventory) {
|
if (playerInventory) {
|
||||||
openInventory();
|
openInventory();
|
||||||
} else {
|
|
||||||
inventoryOpen = true;
|
|
||||||
}
|
}
|
||||||
|
showExchangeSlot();
|
||||||
|
inventoryOpen = true;
|
||||||
|
|
||||||
if (inv == nullptr) {
|
if (inv == nullptr) {
|
||||||
inv = level.inventories->createVirtual(secondInvView->getSlotsCount());
|
inv = level.inventories->createVirtual(secondInvView->getSlotsCount());
|
||||||
}
|
}
|
||||||
|
|
@ -446,9 +444,10 @@ void Hud::openInventory(
|
||||||
secondUI = blockUI;
|
secondUI = blockUI;
|
||||||
if (playerInventory) {
|
if (playerInventory) {
|
||||||
openInventory();
|
openInventory();
|
||||||
} else {
|
|
||||||
inventoryOpen = true;
|
|
||||||
}
|
}
|
||||||
|
showExchangeSlot();
|
||||||
|
inventoryOpen = true;
|
||||||
|
|
||||||
if (blockinv == nullptr) {
|
if (blockinv == nullptr) {
|
||||||
blockinv = level.inventories->createVirtual(blockUI->getSlotsCount());
|
blockinv = level.inventories->createVirtual(blockUI->getSlotsCount());
|
||||||
}
|
}
|
||||||
|
|
@ -477,6 +476,7 @@ void Hud::showExchangeSlot() {
|
||||||
exchangeSlot->setInteractive(false);
|
exchangeSlot->setInteractive(false);
|
||||||
exchangeSlot->setZIndex(1);
|
exchangeSlot->setZIndex(1);
|
||||||
gui.store(SlotView::EXCHANGE_SLOT_NAME, exchangeSlot);
|
gui.store(SlotView::EXCHANGE_SLOT_NAME, exchangeSlot);
|
||||||
|
add(HudElement(HudElementMode::INVENTORY, nullptr, exchangeSlot, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hud::showOverlay(
|
void Hud::showOverlay(
|
||||||
|
|
@ -488,10 +488,10 @@ void Hud::showOverlay(
|
||||||
secondUI = doc->getRoot();
|
secondUI = doc->getRoot();
|
||||||
if (playerInventory) {
|
if (playerInventory) {
|
||||||
openInventory();
|
openInventory();
|
||||||
} else {
|
|
||||||
showExchangeSlot();
|
|
||||||
inventoryOpen = true;
|
|
||||||
}
|
}
|
||||||
|
showExchangeSlot();
|
||||||
|
inventoryOpen = true;
|
||||||
|
|
||||||
add(HudElement(HudElementMode::INVENTORY, doc, secondUI, false), args);
|
add(HudElement(HudElementMode::INVENTORY, doc, secondUI, false), args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue