Skip to content

Commit

Permalink
miscellaneous fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MihailRis committed Jan 20, 2025
1 parent eca3a54 commit 92f226c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
4 changes: 3 additions & 1 deletion res/layouts/ingame_chat.xml.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ local animation_fps = 30

local function remove_line(line)
document[line[1]]:destruct()
time.post_runnable(function() document.root:reposition() end)
time.post_runnable(function()
if world.is_open() then document.root:reposition() end
end)
end

local function update_line(line, uptime)
Expand Down
2 changes: 1 addition & 1 deletion res/modules/internal/gui_util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function gui_util.add_page_dispatcher(dispatcher)
table.insert(gui_util.local_dispatchers, dispatcher)
end

function gui_util.reset_local()
function gui_util.__reset_local()
gui_util.local_dispatchers = {}
end

Expand Down
3 changes: 3 additions & 0 deletions res/modules/internal/stdcomp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,8 @@ return {
end
return values
end
end,
__reset = function()
entities = {}
end
}
7 changes: 4 additions & 3 deletions res/scripts/stdlib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ function __vc_on_hud_open()
end)
end)
input.add_callback("key:escape", function()
if hud.is_paused() then
hud.resume()
if menu.page ~= "" then
menu:reset()
elseif hud.is_inventory_open() then
hud.close_inventory()
else
Expand Down Expand Up @@ -375,7 +375,8 @@ end

function __vc_on_world_quit()
_rules.clear()
gui_util:reset_local()
gui_util:__reset_local()
stdcomp.__reset()
end

local __vc_coroutines = {}
Expand Down
4 changes: 3 additions & 1 deletion src/frontend/screens/LevelScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ void LevelScreen::initializePack(ContentPackRuntime* pack) {
}

LevelScreen::~LevelScreen() {
saveWorldPreview();
if (!controller->getLevel()->getWorld()->isNameless()) {
saveWorldPreview();
}
scripting::on_frontend_close();
// unblock all bindings
Events::enableBindings();
Expand Down

0 comments on commit 92f226c

Please sign in to comment.