Skip to content

feat(lua): migrate achievements runtime to Lua#8263

Draft
scarf005 wants to merge 1 commit intocataclysmbn:mainfrom
scarf005:feat/lua-achievements-migration
Draft

feat(lua): migrate achievements runtime to Lua#8263
scarf005 wants to merge 1 commit intocataclysmbn:mainfrom
scarf005:feat/lua-achievements-migration

Conversation

@scarf005
Copy link
Member

Purpose of change (The Why)

  • Continue Lua migration by moving achievements runtime evaluation and UI text generation out of C++ tracker flow.

Describe the solution (The How)

  • Added data/json/achievements.lua runtime, wired through data/json/preload.lua and data/json/main.lua.
  • Added Lua-facing game APIs for achievement/stat/skill/kill queries in src/catalua_bindings_game.cpp and Lua UI text bridge in src/catalua.cpp/src/catalua.h.
  • Redirected achievements tab rendering to Lua text in src/scores_ui.cpp; removed C++ tracker event subscription/save serialization usage in src/game.cpp and src/savegame.cpp.
  • Added lua_achievements_runtime coverage in tests/catalua_test.cpp.

Describe alternatives you've considered

  • Keeping the C++ tracker as the runtime authority and only mirroring to Lua; rejected to satisfy full Lua runtime migration goal.

Testing

  • cmake --build build --target astyle
  • cmake --build build --target style-json-parallel
  • deno task dprint fmt
  • cmake --preset linux-full
  • cmake --build --preset linux-full --target cataclysm-bn-tiles cata_test-tiles
  • ./out/build/linux-full/tests/cata_test-tiles "lua_achievements_runtime"
  • ./out/build/linux-full/tests/cata_test-tiles "achievements_tracker"
  • ./out/build/linux-full/src/cataclysm-bn-tiles --check-mods (fails due local external user mods unrelated to this PR)

Additional context

  • No related issue linked.

Checklist

Mandatory

Optional

  • This is a C++ PR that modifies JSON loading or behavior.
    • I have documented the changes in the appropriate location in the docs/ folder.
    • If documentation for this feature does not exist, please write it or at least note its lack in PR description.
    • New localizable fields need to be added to the lang/bn_extract_json_strings.sh script if it does not support them yet.
    • If applicable, add checks on game load that would validate the loaded data.
    • If it modifies format of save files, please add migration from the old format.
  • This PR modifies lua scripts or the lua API.
    • I have added lua scope to the PR title.
    • I have added type annotations to functions so that it's safe and easy to maintain.
    • I have committed the output of deno task docs:gen so the Lua API documentation is updated.

Assisted-by: openai/gpt-5.3-codex on opencode
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
@github-actions github-actions bot added src changes related to source code. JSON related to game datas in JSON format. tests changes related to tests lua PRs and issues related to Lua scripting labels Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

JSON related to game datas in JSON format. lua PRs and issues related to Lua scripting src changes related to source code. tests changes related to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant