Moved debug panel UI to xml#700
Conversation
| @@ -0,0 +1,216 @@ | |||
| -- Debug panel logic ported from C++ create_debug_panel to Lua XML script. | |||
| -- Shows performance, world, player and selection info; provides simple time control. | |||
| -- All comments in this file are intentionally in English only. | |||
There was a problem hiding this comment.
Комментарий про историю панели излишний. Последняя же строка вообще к коду теме не относится. В целом, из комментарием имеют смысл только:
- объяснения неочевидных моментов, которые нельзя решить именованием
- документация публичного API
| local function safe_caption(blockid) | ||
| -- Expect that the API exists and returns a valid string id | ||
| return block.name(blockid) | ||
| end |
There was a problem hiding this comment.
Отдельная функция не требуется, так как результат block.name и нужно выводить на панели + бессмысленный комментарий
| n = tonumber(n) or 0 | ||
| if n < 10 then return "0"..tostring(n) end | ||
| return tostring(n) | ||
| end |
There was a problem hiding this comment.
В extensions.md уже описана встроенная функция
| document.dbg_flags.text = "flags: -" | ||
| else | ||
| document.dbg_flags.text = "flags: "..table.concat(flags, ", ") | ||
| end |
There was a problem hiding this comment.
Перенос не подразумевает добавление новых элементов
| end | ||
| document.dbg_tp_x.consumer = try_teleport | ||
| document.dbg_tp_y.consumer = try_teleport | ||
| document.dbg_tp_z.consumer = try_teleport |
There was a problem hiding this comment.
За llm стоит проверять
Это просто не будет работать
| extern const luaL_Reg vec4lib[]; // vecn.cpp | ||
| extern const luaL_Reg weatherlib[]; // gfx.weather | ||
| extern const luaL_Reg worldlib[]; | ||
| extern const luaL_Reg renderlib[]; |
There was a problem hiding this comment.
библиотеки графического api реализуются в пакете gfx
| {"get_emitters_alive", lua::wrap<l_get_emitters_alive>}, | ||
| {"get_visible_chunks", lua::wrap<l_get_visible_chunks>}, | ||
| {"get_entities_next_id", lua::wrap<l_get_entities_next_id>}, | ||
| {nullptr, nullptr} |
There was a problem hiding this comment.
В одну кучу свален и рендер и частицы, для которых уже есть библиотека и hud и вообще серверная часть, к рендеру отношения не имеющая
| require_world_info().fog = static_cast<float>(value); | ||
| return 0; | ||
| } | ||
|
|
There was a problem hiding this comment.
Этот старый костыль должен быть удалён, вместе с соответствующим полем в WorldInfo
There was a problem hiding this comment.
Я тогда просто пока уберу фог из этой либы и в дебаг менюшке заменю на clouds, а удаление его совсем лучше сделать другим коммитом кмк
| <checkbox id="dbg_cb_minimap" size="400,24" | ||
| supplier="render.get_show_generator_minimap" | ||
| consumer="render.set_show_generator_minimap">Show Generator Minimap</checkbox> | ||
| </panel> |
There was a problem hiding this comment.
Бред LLM, начиная с несуществующих свойств text, font , заканчивая некорректным использованием checkbox
There was a problem hiding this comment.
Про чекбокс не понял. Вроде работает как ожидается
I created xml file and input for the debug panel. There is some inconsistency between this panel and the rest debug visualization (gizmo and fps graph), because they being triggered from different locations, but I don't know how to make it better for now
(если что, можно со мной на русском общаться)