Conversation
There was a problem hiding this comment.
Pull Request Overview
Refactors the token system into a modular, container-based API with pluggable restore/infinity features, a configurable logger, and explicit state/config management. Tests and docs are updated to reflect the new API and data model.
- Introduces token.container, token.value, token.config, token.state, token.restore, token.infinity, token.time, and token.logger modules; removes legacy token_internal and smart_value.
- Reworks the public API around container instances, per-container events, and a periodic restore update loop; updates tests and example usage.
- Updates configuration schema (token_configs/token_groups) and documentation; adds debug page scaffolding and resource loading from test resources.
Reviewed Changes
Copilot reviewed 36 out of 37 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| token/token_internal.lua | Removes legacy monolithic config/logger helpers (replaced by modular components). |
| token/token/value.lua | Adds token value wrapper with min/max clamping, total sum, and visual credit handling. |
| token/token/time.lua | Adds time abstraction (socket.gettime) for restore/infinity timing. |
| token/token/state.lua | Adds serializable state container registry (containers/tokens/restore/infinity). |
| token/token/restore.lua | Adds timed restore plugin (enable/disable/reset, time-to-restore, batch update). |
| token/token/logger.lua | Adds swappable logger with default and empty implementations. |
| token/token/infinity.lua | Adds “infinity” spend window support and remaining time helpers. |
| token/token/debug_page.lua | Adds debug panel rendering helpers (Druid-based). |
| token/token/container.lua | Implements container class: per-token ops, group ops, events, and plugin integration. |
| token/token/config.lua | Adds config store/lookup API; supports token_configs/token_groups/lots. |
| token/token.lua | Rewrites public module: container lifecycle, config/log/state wiring, timer update loop. |
| token/smart_value.lua | Removes legacy smart_value implementation (replaced by token.value). |
| test/test_tokens.lua | Removes old tests (replaced by granular tests for new API). |
| test/test_token_visual.lua | Adds tests for visual credit API. |
| test/test_token_state.lua | Adds tests for save/load state roundtrip. |
| test/test_token_restore.lua | Adds tests for restore timer behavior and reconfiguration. |
| test/test_token_logger.lua | Updates/extends logger behavior tests. |
| test/test_token_infinity.lua | Adds tests for infinity spend window. |
| test/test_token_groups.lua | Adds tests for group/lot behavior using new config schema. |
| test/test_token_events.lua | Adds tests for on_token_change propagation. |
| test/test_token_config.lua | Updates tests for registering tokens/groups/lots and config groups. |
| test/test_token.lua | Updates core API tests to container-based API. |
| test/test_load_json.lua | Updates JSON loading test to new schema and custom test resource path. |
| test/test.script | Switches runner to script-based tests (no GUI). |
| test/test.gui | Removes GUI runner. |
| test/test.collection | Switches collection to script component runner. |
| test/resources/token_config.json | Adds test JSON config with new schema. |
| resources/token_config.json | Migrates default JSON config to new schema keys. |
| event | Adds symlink to external defold-event module (used by event.event). |
| druid | Adds symlink to external Druid (used by debug UI helpers). |
| api/token_api.md | Updates token module API docs to new surface area. |
| api/container_api.md | Adds container API docs. |
| .vscode/settings.json | Updates Lua diagnostics/library settings. |
| example/example.gui_script | Updates example to new container-based API and initialization. |
| game.project | Adds test resources; removes defold-event dependency; adjusts libraries. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 59 out of 60 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.