add 'is_new' argument to on_world_open
This commit is contained in:
parent
9ce70d70e1
commit
53ce219127
@ -324,7 +324,7 @@ void Hud::updateWorldGenDebug() {
|
||||
|
||||
void Hud::update(bool visible) {
|
||||
const auto& chunks = *player.chunks;
|
||||
bool is_menu_open = menu.hasOpenPage();
|
||||
bool isMenuOpen = menu.hasOpenPage();
|
||||
|
||||
debugPanel->setVisible(
|
||||
debug && visible && !(inventoryOpen && inventoryView == nullptr)
|
||||
@ -333,13 +333,13 @@ void Hud::update(bool visible) {
|
||||
if (!visible && inventoryOpen) {
|
||||
closeInventory();
|
||||
}
|
||||
if (pause && !is_menu_open) {
|
||||
if (pause && !isMenuOpen) {
|
||||
setPause(false);
|
||||
}
|
||||
if (!gui.isFocusCaught()) {
|
||||
processInput(visible);
|
||||
}
|
||||
if ((is_menu_open || inventoryOpen) == input.getCursor().locked) {
|
||||
if ((isMenuOpen || inventoryOpen) == input.getCursor().locked) {
|
||||
input.toggleCursor();
|
||||
}
|
||||
|
||||
@ -360,8 +360,8 @@ void Hud::update(bool visible) {
|
||||
contentAccessPanel->setSize(glm::vec2(caSize.x, windowSize.y));
|
||||
contentAccess->setMinSize(glm::vec2(1, windowSize.y));
|
||||
hotbarView->setVisible(visible && !(secondUI && !inventoryView));
|
||||
darkOverlay->setVisible(is_menu_open);
|
||||
menu.setVisible(is_menu_open);
|
||||
darkOverlay->setVisible(isMenuOpen);
|
||||
menu.setVisible(isMenuOpen);
|
||||
|
||||
if (visible) {
|
||||
for (auto& element : elements) {
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
#include "voxels/Block.hpp"
|
||||
#include "voxels/Chunk.hpp"
|
||||
#include "world/Level.hpp"
|
||||
#include "world/World.hpp"
|
||||
#include "interfaces/Process.hpp"
|
||||
|
||||
using namespace scripting;
|
||||
@ -330,7 +331,11 @@ void scripting::on_world_load(LevelController* controller) {
|
||||
}
|
||||
|
||||
for (auto& pack : content_control->getAllContentPacks()) {
|
||||
lua::emit_event(L, pack.id + ":.worldopen");
|
||||
lua::emit_event(L, pack.id + ":.worldopen", [](auto L) {
|
||||
return lua::pushboolean(
|
||||
L, !scripting::level->getWorld()->getInfo().isLoaded
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -116,6 +116,8 @@ std::unique_ptr<Level> World::load(
|
||||
if (!info.has_value()) {
|
||||
throw world_load_error("could not to find world.json");
|
||||
}
|
||||
info->isLoaded = true;
|
||||
|
||||
logger.info() << "loading world " << info->name << " ("
|
||||
<< worldFilesPtr->getFolder().string() << ")";
|
||||
logger.info() << "world version: " << info->major << "." << info->minor
|
||||
|
||||
@ -45,6 +45,8 @@ struct WorldInfo : public Serializable {
|
||||
|
||||
int major = 0, minor = -1;
|
||||
|
||||
bool isLoaded = false;
|
||||
|
||||
dv::value serialize() const override;
|
||||
void deserialize(const dv::value& src) override;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user