Fix timer comparison logic and logging#1118
Merged
Stranger1992 merged 4 commits intoTombEngine:developfrom Feb 5, 2026
Merged
Conversation
Add human-readable comparison labels and refine IfRemainingTimeIs behavior: introduce textCompareOp for clearer debug messages, relax the IsTicking requirement to only equality/inequality checks (timers must be active for all checks, but equal/not-equal require ticking), and adjust logging to include remaining time and comparison type. This prevents evaluating equality against non-ticking timers and improves diagnostic output.
Simplify the IfRemainingTimeIs handling by using a single conditional expression for Equal/NotEqual to avoid repeated Timer:Get calls and reduce branches. Move and consolidate logging so messages are only printed when debugging is enabled and either the timer is ticking for Equal/NotEqual checks or always for other comparison operators. This reduces duplication and prevents logging when the timer isn't active.
Store the result of Timer.Get(name):IfRemainingTimeIs(...) in a local variable `test` and reuse it when computing `result`, avoiding duplicate calls. This refactors the equality/inequality branch to improve readability and prevent repeated evaluation of the same timer check without changing behavior.
Replace repeated Timer.Get(name) calls with a local timer variable and cache timer:IsTicking() into isTicking. Use the cached values for remaining time checks, comparisons, and debug logging to improve readability and avoid redundant lookups; no functional behavior changes intended.
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.
Add human-readable comparison labels and refine IfRemainingTimeIs behavior: introduce textCompareOp for clearer debug messages, relax the IsTicking requirement to only equality/inequality checks (timers must be active for all checks, but equal/not-equal require ticking), and adjust logging to include remaining time and comparison type. This prevents evaluating equality against non-ticking timers and improves diagnostic output.