Skip to content

refactor(lua): move achievement tracking onto hooks#8537

Draft
scarf005 wants to merge 1 commit intocataclysmbn:mainfrom
scarf005:refactor/achievement-lua-system
Draft

refactor(lua): move achievement tracking onto hooks#8537
scarf005 wants to merge 1 commit intocataclysmbn:mainfrom
scarf005:refactor/achievement-lua-system

Conversation

@scarf005
Copy link
Copy Markdown
Member

Purpose of change (The Why)

Achievement tracking duplicated the existing Lua hook pipeline. Moving transition logic to Lua keeps the save payload unchanged while removes the per-achievement C++ watcher layer.

Describe the solution (The How)

  • add an on_stat_changed hook and a core Lua achievement runtime that evaluates completion and failure
  • keep achievements_tracker as the save/UI wrapper and pre-activate the required statistics without per-achievement watcher objects
  • add regression coverage for achievement completion and serialized tracker state

Testing

  • cmake --build --preset linux-full --target astyle
  • cmake --build --preset linux-full --target cataclysm-bn-tiles cata_test-tiles
  • ./out/build/linux-full/tests/cata_test-tiles "[stats]"
  • ./out/build/linux-full/src/cataclysm-bn-tiles --check-mods (fails on unrelated local Backrooms-CBN-mod external option parsing error)

Checklist

Mandatory

Optional

  • 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.

PR opened by gpt-5.4 high on opencode

Assisted-by: openai/gpt-5.4 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 Apr 16, 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