Skip to content

Commit 26f123c

Browse files
committed
QuickSearch: Handle HUD Elements differently to Modules
1 parent 7c7f57a commit 26f123c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main/kotlin/com/lambda/gui/components/QuickSearch.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import com.lambda.event.listener.UnsafeListener.Companion.listenUnsafe
2828
import com.lambda.gui.LambdaScreen
2929
import com.lambda.gui.Layout
3030
import com.lambda.gui.dsl.ImGuiBuilder
31+
import com.lambda.module.HudModule
3132
import com.lambda.module.Module
3233
import com.lambda.module.ModuleRegistry
3334
import com.lambda.util.KeyCode
@@ -72,7 +73,7 @@ object QuickSearch {
7273
}
7374

7475
private class ModuleResult(val module: Module) : SearchResult {
75-
override val breadcrumb = "Module"
76+
override val breadcrumb = if (module is HudModule) "HUD" else "Module"
7677

7778
override fun ImGuiBuilder.buildLayout() {
7879
with(ModuleEntry(module)) {
@@ -192,6 +193,7 @@ object QuickSearch {
192193
private data class RankedSearchResult(val result: SearchResult, val score: Int)
193194

194195
private const val MODULE_PRIORITY_BONUS = 300
196+
private const val HUD_MODULE_PRIORITY_BONUS = 270
195197
private const val COMMAND_PRIORITY_BONUS = 200
196198

197199
/**
@@ -239,7 +241,10 @@ object QuickSearch {
239241
val bestScore = max(nameScore, tagScore)
240242

241243
if (bestScore > 0) {
242-
RankedSearchResult(ModuleResult(module), bestScore + MODULE_PRIORITY_BONUS)
244+
when(module) {
245+
is HudModule -> RankedSearchResult(ModuleResult(module), bestScore + HUD_MODULE_PRIORITY_BONUS)
246+
else -> RankedSearchResult(ModuleResult(module), bestScore + MODULE_PRIORITY_BONUS)
247+
}
243248
} else null
244249
}
245250

0 commit comments

Comments
 (0)