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