Skip to content

Conversation

@emyfops
Copy link
Collaborator

@emyfops emyfops commented May 30, 2025

Description

  • Adds new duration type setting that takes in a base duration value, a duration range and a step value.
  • Adds a duration highest unit inferrer
  • Changes the LimitedDecayQueue to use monotonic time marks
  • Changes the NumericSettings class to allow any comparable types

These changes are recommended because comparing longs and ints for duration checks are prone to errors and using durations and monotonic time marks makes it easier to compare durations

@emyfops emyfops requested review from Avanatiker and Copilot May 30, 2025 20:08
@github-actions github-actions bot added the triage Requires labelling or review label May 30, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new Kotlin duration setting along with related API changes and refactoring. Key changes include:

  • Introducing duration-based settings and type conversion in NumericSetting.
  • Refactoring time-based functionality in LimitedDecayQueue and related modules to use Kotlin’s Duration and monotonic time marks.
  • Updating tests and various modules to work with the new duration APIs.

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
common/src/test/kotlin/LimitedDecayQueueTest.kt Updated tests to use Kotlin Duration literals.
common/src/main/kotlin/com/lambda/util/extension/Time.kt Added extensions for tick conversion and duration unit helpers.
common/src/main/kotlin/com/lambda/util/collections/LimitedDecayQueue.kt Refactored to utilize Kotlin’s Duration and monotonic timestamps.
common/src/main/kotlin/com/lambda/util/ServerTPS.kt Updated server TPS logic to use Duration for timing.
common/src/main/kotlin/com/lambda/task/tasks/BuildTask.kt Changed legacy time conversion to the new ticks extension.
common/src/main/kotlin/com/lambda/module/modules/network/PacketLimiter.kt Converted static millisecond values to Duration.
common/src/main/kotlin/com/lambda/module/modules/network/PacketDelay.kt Replaced time polling with a Timer and Duration-based delays.
common/src/main/kotlin/com/lambda/module/modules/combat/CrystalAura.kt Updated delay settings to use Kotlin Duration types.
common/src/main/kotlin/com/lambda/module/modules/client/Discord.kt Updated delay configuration to use Duration.
common/src/main/kotlin/com/lambda/config/settings/NumericSetting.kt Changed to allow any Comparable types instead of just Numbers.
common/src/main/kotlin/com/lambda/config/settings/DurationSetting.kt Introduced a new DurationSetting with automatic unit inference.
common/src/kotlin/com/lambda/config/Configurable.kt Added DurationSetting registration overload.

Copy link
Member

@Avanatiker Avanatiker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start but delay setting is not yet shown in the ClickGUI and also we need some kind of option that allows to render the duration as time or tick based depending on the usecase ticks are more relevant. maybe a wrapper function that also automatically has 50ms as step idk

@emyfops
Copy link
Collaborator Author

emyfops commented Sep 7, 2025

This pull request is outdated and needs to be updated for ImGui, do not delete this branch

@emyfops emyfops closed this Sep 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage Requires labelling or review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants