inventory id argument
This commit is contained in:
parent
8e529eb63b
commit
4ce46f34bf
@ -1,7 +1,7 @@
|
||||
function on_open()
|
||||
print("OPEN")
|
||||
function on_open(inv)
|
||||
print("OPEN", inv)
|
||||
end
|
||||
|
||||
function on_close()
|
||||
print("CLOSE")
|
||||
function on_close(inv)
|
||||
print("CLOSE", inv)
|
||||
end
|
||||
|
||||
@ -86,16 +86,6 @@ void AssetsLoader::addDefaults(AssetsLoader& loader, const Content* content) {
|
||||
fs::path folder = info.folder / fs::path("layouts");
|
||||
addLayouts(pack->getEnvironment()->getId(), info.id, folder, loader);
|
||||
}
|
||||
|
||||
for (fs::path& file : loader.getPaths()->listdir(LAYOUTS_FOLDER)) {
|
||||
if (file.extension().u8string() != ".xml")
|
||||
continue;
|
||||
std::string packName = file.parent_path().parent_path().filename();
|
||||
if (packName == "res") {
|
||||
packName = "core";
|
||||
}
|
||||
//loader.add(ASSET_LAYOUT, file.u8string(), packName+":"+file.stem().u8string());
|
||||
}
|
||||
}
|
||||
loader.add(ASSET_ATLAS, TEXTURES_FOLDER"/blocks", "blocks");
|
||||
loader.add(ASSET_ATLAS, TEXTURES_FOLDER"/items", "items");
|
||||
|
||||
@ -46,4 +46,4 @@ public:
|
||||
const fs::path& getMainRoot() const;
|
||||
};
|
||||
|
||||
#endif // FILES_ENGINE_PATHS_H_
|
||||
#endif // FILES_ENGINE_PATHS_H_
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
#include "../../world/Level.h"
|
||||
#include "../../voxels/Block.h"
|
||||
#include "../../items/ItemDef.h"
|
||||
#include "../../items/Inventory.h"
|
||||
#include "../../logic/BlocksController.h"
|
||||
#include "../../frontend/UiDocument.h"
|
||||
#include "../../engine.h"
|
||||
@ -208,14 +209,16 @@ bool scripting::on_item_break_block(Player* player, const ItemDef* item, int x,
|
||||
void scripting::on_ui_open(UiDocument* layout, Inventory* inventory) {
|
||||
std::string name = layout->getId()+".open";
|
||||
if (state->getglobal(name)) {
|
||||
state->callNoThrow(0);
|
||||
state->pushinteger(inventory->getId());
|
||||
state->callNoThrow(1);
|
||||
}
|
||||
}
|
||||
|
||||
void scripting::on_ui_close(UiDocument* layout, Inventory* inventory) {
|
||||
std::string name = layout->getId()+".close";
|
||||
if (state->getglobal(name)) {
|
||||
state->callNoThrow(0);
|
||||
state->pushinteger(inventory->getId());
|
||||
state->callNoThrow(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user