Skip to content

Commit 87ecb9c

Browse files
committed
Module List
1 parent 803e630 commit 87ecb9c

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

common/src/main/kotlin/com/lambda/module/Module.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import com.lambda.event.listener.Listener
3131
import com.lambda.event.listener.SafeListener
3232
import com.lambda.event.listener.SafeListener.Companion.listen
3333
import com.lambda.event.listener.UnsafeListener
34+
import com.lambda.module.hud.ModuleList
3435
import com.lambda.module.tag.ModuleTag
3536
import com.lambda.sound.LambdaSound
3637
import com.lambda.sound.SoundManager.playSoundRandomly
@@ -116,9 +117,9 @@ abstract class Module(
116117
) : Nameable, Muteable, Configurable(ModuleConfig) {
117118
private val isEnabledSetting = setting("Enabled", enabledByDefault, visibility = { false })
118119
private val keybindSetting = setting("Keybind", defaultKeybind)
119-
private val isVisible = setting("Visible", true)
120+
val isVisible = setting("Visible", true) { ModuleList.isEnabled }
120121
val reset by setting("Reset", { settings.forEach { it.reset() }; this@Module.info("Settings set to default") })
121-
val customTags = setting("Tags", setOf<ModuleTag>(), visibility = { false })
122+
val customTags = setting("Tags", setOf<ModuleTag>()) { false }
122123

123124
var isEnabled by isEnabledSetting
124125
val isDisabled get() = !isEnabled
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright 2024 Lambda
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
package com.lambda.module.hud
19+
20+
import com.lambda.graphics.renderer.gui.font.FontRenderer.drawString
21+
import com.lambda.module.HudModule
22+
import com.lambda.module.ModuleRegistry
23+
import com.lambda.module.tag.ModuleTag
24+
import com.lambda.task.TaskFlow
25+
import com.lambda.util.math.Vec2d
26+
27+
object ModuleList : HudModule(
28+
name = "ModuleList",
29+
defaultTags = setOf(ModuleTag.CLIENT),
30+
) {
31+
override val width = 200.0
32+
override val height = 200.0
33+
34+
init {
35+
onRender {
36+
val enabled = ModuleRegistry.modules
37+
.filter { it.isEnabled }
38+
.filter { it.isVisible.value }
39+
drawString(enabled.joinToString("\n") { "${it.name} [${it.keybind.name}]" }, Vec2d.ZERO)
40+
}
41+
}
42+
}

0 commit comments

Comments
 (0)