Skip to content

Fix timer comparison logic and logging#1118

Merged
Stranger1992 merged 4 commits intoTombEngine:developfrom
davidmarr:fix-timer-node
Feb 5, 2026
Merged

Fix timer comparison logic and logging#1118
Stranger1992 merged 4 commits intoTombEngine:developfrom
davidmarr:fix-timer-node

Conversation

@davidmarr
Copy link
Contributor

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.

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.
@Stranger1992 Stranger1992 merged commit 699bae5 into TombEngine:develop Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants