add hud.open inventory events support

This commit is contained in:
MihailRis 2025-01-12 17:36:42 +03:00
parent 80128a4190
commit 90fc559234

View File

@ -413,6 +413,7 @@ std::shared_ptr<Inventory> Hud::openInventory(
}
secondInvView->bind(inv, &content);
add(HudElement(hud_element_mode::inventory_bound, doc, secondUI, false));
scripting::on_inventory_open(&player, *inv);
return inv;
}
@ -522,6 +523,9 @@ void Hud::closeInventory() {
scripting::on_inventory_closed(&player, *blockUI->getInventory());
blockUI = nullptr;
}
if (secondInvView) {
scripting::on_inventory_closed(&player, *secondInvView->getInventory());
}
dropExchangeSlot();
gui.remove(SlotView::EXCHANGE_SLOT_NAME);
exchangeSlot = nullptr;