diff --git a/res/layouts/console.xml b/res/layouts/console.xml
index 6e5cc6c0..7b9bad3f 100644
--- a/res/layouts/console.xml
+++ b/res/layouts/console.xml
@@ -46,16 +46,19 @@
color="#FFFFFF80" size="16" pos="4,6"
hover-color="#1080FF">
+ size="60,16" padding="8" interval="8" color="0">
-
+
@@ -76,9 +79,12 @@
scroll-step='50'
>
-
-
+
+
+
+
+
+
%s: %s",
+ gui.str("Error at line %{0}"):gsub("%%{0}", line), message)
+ )
+ return
+ end
+ local script_type, unit = xunpack(scripts_classification[current_file.filename])
+ save_current_file()
+
+ local func = function()
+ local stack_size = debug.count_frames()
+ xpcall(chunk, function(msg) __vc__error(msg, 1, 1, stack_size) end)
+ end
+
+ if script_type == "block" then
+ func = function() block.reload_script(unit) end
+ elseif script_type == "item" then
+ func = function() item.reload_script(unit) end
+ end
+ local output = core.capture_output(func)
+ document.output:add(
+ string.format(
+ "",
+ output)
+ )
+end
+
function save_current_file()
if not current_file.mutable then
return
@@ -161,14 +209,26 @@ function open_file_in_editor(filename, line, mutable)
document.saveIcon.enabled = current_file.modified
end
+function clear_traceback()
+ local tb_list = document.traceback
+ tb_list:clear()
+ tb_list:add("")
+end
+
+function clear_output()
+ local output = document.output
+ output:clear()
+ output:add("")
+end
+
events.on("core:open_traceback", function(traceback_b64)
local traceback = bjson.frombytes(base64.decode(traceback_b64))
modes:set('debug')
+ clear_traceback()
+
local tb_list = document.traceback
local srcsize = tb_list.size
- tb_list:clear()
- tb_list:add("")
for _, frame in ipairs(traceback.frames) do
local callback = ""
local framestr = ""
@@ -322,10 +382,10 @@ end
local function build_scripts_classification()
for id, props in pairs(block.properties) do
- scripts_classification[props["script-file"]] = "block"
+ scripts_classification[props["script-file"]] = {"block", block.name(id)}
end
for id, props in pairs(item.properties) do
- scripts_classification[props["script-file"]] = "item"
+ scripts_classification[props["script-file"]] = {"item", item.name(id)}
end
end
@@ -336,7 +396,7 @@ local function load_scripts_list()
end
for _, filename in ipairs(filenames) do
- scripts_classification[filename] = "module"
+ scripts_classification[filename] = {"module"}
end
for _, packid in ipairs(packs) do
@@ -364,6 +424,9 @@ function on_open(mode)
build_files_list(filenames)
document.editorContainer:setInterval(200, refresh_file_title)
+
+ clear_traceback()
+ clear_output()
elseif mode then
modes:set(mode)
end
diff --git a/res/preload.json b/res/preload.json
index 2b00a440..b5c24d09 100644
--- a/res/preload.json
+++ b/res/preload.json
@@ -30,7 +30,9 @@
"gui/block",
"gui/item",
"gui/file",
- "gui/module"
+ "gui/module",
+ "gui/play",
+ "gui/info"
],
"fonts": [
{
diff --git a/res/texts/en_US.txt b/res/texts/en_US.txt
index 732e2d66..57a6cb6b 100644
--- a/res/texts/en_US.txt
+++ b/res/texts/en_US.txt
@@ -11,7 +11,9 @@ world.delete-confirm=Do you want to delete world forever?
world.generators.default=Default
world.generators.flat=Flat
+editor.info.tooltip=CTRL+S - Save\nCTRL+R - Run\nCTRL+Z - Undo\nCTRL+Y - Redo
devtools.traceback=Traceback (most recent call first)
+devtools.output=Output
# Tooltips
graphics.gamma.tooltip=Lighting brightness curve
diff --git a/res/texts/ru_RU.txt b/res/texts/ru_RU.txt
index 92eec3e8..65db4507 100644
--- a/res/texts/ru_RU.txt
+++ b/res/texts/ru_RU.txt
@@ -22,8 +22,13 @@ File=Файл
Read only=Только для чтения
Save=Сохранить
Grant %{0} pack modification permission?=Выдать разрешение на модификацию пака %{0}?
+Error at line %{0}=Ошибка на строке %{0}
+Run=Запустить
+editor.info.tooltip=CTRL+S - Сохранить\nCTRL+R - Запустить\nCTRL+Z - Отменить\nCTRL+Y - Повторить
devtools.traceback=Стек вызовов (от последнего)
+devtools.output=Вывод
+
error.pack-not-found=Не удалось найти пакет
error.dependency-not-found=Используемая зависимость не найдена
pack.remove-confirm=Удалить весь поставляемый паком/паками контент из мира (безвозвратно)?
diff --git a/res/textures/gui/info.png b/res/textures/gui/info.png
new file mode 100644
index 00000000..a7bb7030
Binary files /dev/null and b/res/textures/gui/info.png differ
diff --git a/res/textures/gui/play.png b/res/textures/gui/play.png
new file mode 100644
index 00000000..2442b02c
Binary files /dev/null and b/res/textures/gui/play.png differ