missing content report moved to xml

This commit is contained in:
MihailRis
2024-04-22 22:17:06 +03:00
parent 61ca91b525
commit 132016d33f
9 changed files with 78 additions and 44 deletions
+10 -5
View File
@@ -226,12 +226,17 @@ bool scripting::on_item_break_block(Player* player, const ItemDef* item, int x,
});
}
void scripting::on_ui_open(UiDocument* layout, Inventory* inventory, glm::ivec3 blockcoord) {
void scripting::on_ui_open(
UiDocument* layout,
std::vector<std::unique_ptr<dynamic::Value>> args
) {
auto argsptr = std::make_shared<std::vector<std::unique_ptr<dynamic::Value>>>(std::move(args));
std::string name = layout->getId() + ".open";
emit_event(name, [inventory, blockcoord] (lua::LuaState* state) {
state->pushinteger(inventory == nullptr ? 0 : inventory->getId());
state->pushivec3(blockcoord.x, blockcoord.y, blockcoord.z);
return 4;
emit_event(name, [=] (lua::LuaState* state) {
for (const auto& value : *argsptr) {
state->pushvalue(*value);
}
return argsptr->size();
});
}
+11 -5
View File
@@ -1,13 +1,16 @@
#include <string>
#include <filesystem>
#include <glm/glm.hpp>
#include "../../data/dynamic.h"
#include "../../typedefs.h"
#include "../../delegates.h"
#include "lua/LuaState.h"
#include "scripting_functional.h"
#include <vector>
#include <string>
#include <memory>
#include <filesystem>
#include <glm/glm.hpp>
namespace fs = std::filesystem;
class Engine;
@@ -71,7 +74,10 @@ namespace scripting {
bool on_item_break_block(Player* player, const ItemDef* item, int x, int y, int z);
/// @brief Called on UI view show
void on_ui_open(UiDocument* layout, Inventory* inventory, glm::ivec3 blockcoord);
void on_ui_open(
UiDocument* layout,
std::vector<std::unique_ptr<dynamic::Value>> args
);
/// @brief Called on UI view close
void on_ui_close(UiDocument* layout, Inventory* inventory);