block coords passing to on_open
This commit is contained in:
parent
98a96a9c1b
commit
60902e69ba
@ -485,9 +485,17 @@ void Hud::add(HudElement element) {
|
||||
if (document) {
|
||||
if (invview) {
|
||||
auto inventory = invview->getInventory();
|
||||
scripting::on_ui_open(element.getDocument(), inventory.get());
|
||||
scripting::on_ui_open(
|
||||
element.getDocument(),
|
||||
inventory.get(),
|
||||
currentblock
|
||||
);
|
||||
} else {
|
||||
scripting::on_ui_open(element.getDocument(), nullptr);
|
||||
scripting::on_ui_open(
|
||||
element.getDocument(),
|
||||
nullptr,
|
||||
currentblock
|
||||
);
|
||||
}
|
||||
}
|
||||
elements.push_back(element);
|
||||
|
||||
@ -207,11 +207,12 @@ bool scripting::on_item_break_block(Player* player, const ItemDef* item, int x,
|
||||
return false;
|
||||
}
|
||||
|
||||
void scripting::on_ui_open(UiDocument* layout, Inventory* inventory) {
|
||||
void scripting::on_ui_open(UiDocument* layout, Inventory* inventory, glm::ivec3 blockcoord) {
|
||||
std::string name = layout->getId()+".open";
|
||||
if (state->getglobal(name)) {
|
||||
state->pushinteger(inventory == nullptr ? 0 : inventory->getId());
|
||||
state->callNoThrow(1);
|
||||
state->pushivec3(blockcoord.x, blockcoord.y, blockcoord.z);
|
||||
state->callNoThrow(4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#include <string>
|
||||
#include <filesystem>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include "../../delegates.h"
|
||||
|
||||
@ -65,7 +66,7 @@ namespace scripting {
|
||||
bool on_item_break_block(Player* player, const ItemDef* item, int x, int y, int z);
|
||||
|
||||
/** Called on UI view show */
|
||||
void on_ui_open(UiDocument* layout, Inventory* inventory);
|
||||
void on_ui_open(UiDocument* layout, Inventory* inventory, glm::ivec3 blockcoord);
|
||||
/** Called on UI view close*/
|
||||
void on_ui_close(UiDocument* layout, Inventory* inventory);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user