diff --git a/res/layouts/console.xml b/res/layouts/console.xml
new file mode 100644
index 00000000..6991d3f8
--- /dev/null
+++ b/res/layouts/console.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/res/layouts/console.xml.lua b/res/layouts/console.xml.lua
new file mode 100644
index 00000000..ebef4b35
--- /dev/null
+++ b/res/layouts/console.xml.lua
@@ -0,0 +1,3 @@
+function on_open()
+ document.prompt.focused = true
+end
diff --git a/src/frontend/UiDocument.cpp b/src/frontend/UiDocument.cpp
index 5cf09589..b593f9e0 100644
--- a/src/frontend/UiDocument.cpp
+++ b/src/frontend/UiDocument.cpp
@@ -56,7 +56,7 @@ std::unique_ptr UiDocument::read(scriptenv penv, std::string name, f
auto xmldoc = xml::parse(file.u8string(), text);
auto env = penv == nullptr
- ? scripting::get_root_environment()
+ ? scripting::create_doc_environment(scripting::get_root_environment(), name)
: scripting::create_doc_environment(penv, name);
gui::UiXmlReader reader(env);
diff --git a/src/frontend/hud.cpp b/src/frontend/hud.cpp
index c22d8fe5..0f58a7c7 100644
--- a/src/frontend/hud.cpp
+++ b/src/frontend/hud.cpp
@@ -501,7 +501,7 @@ void Hud::updateElementsPosition(const Viewport& viewport) {
));
}
secondUI->setPos(glm::vec2(
- glm::min(width/2-invwidth/2, width-caWidth-10-invwidth),
+ glm::min(width/2-invwidth/2, width-caWidth-(inventoryView ? 10 : 0)-invwidth),
height/2-totalHeight/2
));
}
diff --git a/src/frontend/menu.cpp b/src/frontend/menu.cpp
index 06b805c2..4c89aeaa 100644
--- a/src/frontend/menu.cpp
+++ b/src/frontend/menu.cpp
@@ -27,7 +27,7 @@ void menus::create_version_label(Engine* engine) {
auto gui = engine->getGUI();
auto text = ENGINE_VERSION_STRING+" debug build";
gui->add(guiutil::create(
- "