Skip to content

Commit 56416de

Browse files
committed
override configs properly in modules
1 parent 53392a5 commit 56416de

File tree

8 files changed

+29
-30
lines changed

8 files changed

+29
-30
lines changed

src/main/kotlin/com/lambda/module/modules/combat/AutoTotem.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ object AutoTotem : Module(
5555
private val minPlayerDistance by setting("Player Distance", 64, 32..128, 4, "Set the distance to detect players to swap") { players }.group(Group.General)
5656
private val friends by setting("Friends", false, "Exclude friends from triggering player-based swaps") { players }.group(Group.General)
5757

58-
private val inventory = InventorySettings(this, Group.Inventory)
58+
override val inventoryConfig = InventorySettings(this, Group.Inventory)
5959

6060
init {
6161
listen<TickEvent.Pre> {

src/main/kotlin/com/lambda/module/modules/combat/CrystalAura.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ object CrystalAura : Module(
117117
private val targeting = Targeting.Combat(this, Group.Targeting, 10.0)
118118

119119
/* Rotation */
120-
private val rotation = RotationSettings(this, Group.Rotation)
120+
override val rotationConfig = RotationSettings(this, Group.Rotation)
121121

122122
private val blueprint = mutableMapOf<BlockPos, Opportunity>()
123123
private var activeOpportunity: Opportunity? = null
@@ -483,7 +483,7 @@ object CrystalAura : Module(
483483
* Places the crystal on [blockPos]
484484
*/
485485
fun place() = runSafe {
486-
if (rotation.rotate && !lookAt(placeRotation).requestBy(this@CrystalAura).done)
486+
if (rotationConfig.rotate && !lookAt(placeRotation).requestBy(this@CrystalAura).done)
487487
return@runSafe
488488

489489
val selection = selectStack { isItem(Items.END_CRYSTAL) }
@@ -515,7 +515,7 @@ object CrystalAura : Module(
515515
* @return Whether the delay passed, null if the interaction failed or no crystal found
516516
*/
517517
fun explode() {
518-
if (rotation.rotate && !lookAt(placeRotation).requestBy(this@CrystalAura).done) return
518+
if (rotationConfig.rotate && !lookAt(placeRotation).requestBy(this@CrystalAura).done) return
519519

520520
explodeTimer.runSafeIfPassed(explodeDelay.milliseconds) {
521521
crystal?.let { crystal ->

src/main/kotlin/com/lambda/module/modules/combat/KillAura.kt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
package com.lambda.module.modules.combat
1919

20-
import com.lambda.config.groups.InteractSettings
20+
import com.lambda.config.groups.BuildSettings
2121
import com.lambda.config.groups.InteractionSettings
2222
import com.lambda.config.groups.RotationSettings
2323
import com.lambda.config.groups.Targeting
@@ -51,20 +51,20 @@ object KillAura : Module(
5151
tag = ModuleTag.COMBAT,
5252
) {
5353
// Interact
54-
private val interactionSettings = InteractionSettings(this, Group.Interaction, InteractionMask.Entity)
55-
private val interactSettings = InteractSettings(this, listOf(Group.Interact))
56-
private val swap by setting("Swap", true, "Swap to the item with the highest damage").group(Group.Interact)
57-
private val attackMode by setting("Attack Mode", AttackMode.Cooldown).group(Group.Interact)
58-
private val cooldownOffset by setting("Cooldown Offset", 0, -5..5, 1) { attackMode == AttackMode.Cooldown }.group(Group.Interact)
59-
private val hitDelay1 by setting("Hit Delay 1", 2.0, 0.0..20.0, 1.0) { attackMode == AttackMode.Delay }.group(Group.Interact)
60-
private val hitDelay2 by setting("Hit Delay 2", 6.0, 0.0..20.0, 1.0) { attackMode == AttackMode.Delay }.group(Group.Interact)
54+
override val interactionConfig = InteractionSettings(this, Group.Interaction, InteractionMask.Entity)
55+
override val buildConfig = BuildSettings(this, Group.Build)
56+
private val swap by setting("Swap", true, "Swap to the item with the highest damage").group(Group.Build)
57+
private val attackMode by setting("Attack Mode", AttackMode.Cooldown).group(Group.Build)
58+
private val cooldownOffset by setting("Cooldown Offset", 0, -5..5, 1) { attackMode == AttackMode.Cooldown }.group(Group.Build)
59+
private val hitDelay1 by setting("Hit Delay 1", 2.0, 0.0..20.0, 1.0) { attackMode == AttackMode.Delay }.group(Group.Build)
60+
private val hitDelay2 by setting("Hit Delay 2", 6.0, 0.0..20.0, 1.0) { attackMode == AttackMode.Delay }.group(Group.Build)
6161

6262
// Targeting
6363
private val targeting = Targeting.Combat(this, Group.Targeting)
6464

6565
// Aiming
6666
private val rotate by setting("Rotate", true).group(Group.Aiming)
67-
private val rotation = RotationSettings(this, Group.Aiming) { rotate }
67+
override val rotationConfig = RotationSettings(this, Group.Aiming) { rotate }
6868

6969
val target: LivingEntity?
7070
get() = targeting.target()
@@ -82,7 +82,7 @@ object KillAura : Module(
8282

8383
enum class Group(override val displayName: String) : NamedEnum {
8484
Interaction("Interaction"),
85-
Interact("Interact"),
85+
Build("Build"),
8686
Targeting("Targeting"),
8787
Aiming("Aiming")
8888
}
@@ -128,18 +128,18 @@ object KillAura : Module(
128128
if (rotate) {
129129
val angle = RotationManager.activeRotation
130130

131-
if (interactionSettings.strictRayCast) {
132-
val cast = angle.rayCast(interactionSettings.attackReach)
131+
if (interactionConfig.strictRayCast) {
132+
val cast = angle.rayCast(interactionConfig.attackReach)
133133
if (cast?.entityResult?.entity != target) return
134134
}
135135

136136
// Perform a raycast without checking the environment
137-
angle.castBox(target.boundingBox, interactionSettings.attackReach) ?: return
137+
angle.castBox(target.boundingBox, interactionConfig.attackReach) ?: return
138138
}
139139

140140
// Attack
141141
interaction.attackEntity(player, target)
142-
if (interactSettings.swingHand) player.swingHand(Hand.MAIN_HAND)
142+
if (buildConfig.interactConfig.swingHand) player.swingHand(Hand.MAIN_HAND)
143143

144144
lastAttackTime = System.currentTimeMillis()
145145
hitDelay = (hitDelay1..hitDelay2).random() * 50

src/main/kotlin/com/lambda/module/modules/debug/RotationTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ object RotationTest : Module(
2929
name = "RotationTest",
3030
tag = ModuleTag.DEBUG,
3131
) {
32-
var rotation = RotationSettings(this)
32+
override val rotationConfig = RotationSettings(this)
3333
var hitPos: HitResult? = null
3434

3535
init {

src/main/kotlin/com/lambda/module/modules/player/AntiAim.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ object AntiAim : Module(
7373
private val yawSpeed by setting("Yaw Speed", 30, 1..90, 1, "Yaw rotation degrees per tick", "°") { yaw != YawMode.None }.group(Group.General)
7474
private val pitchSpeed by setting("Pitch Speed", 30, 1..90, 1, "Pitch rotation degrees per tick", "°") { pitch != PitchMode.None }.group(Group.General)
7575

76-
private val rotation = RotationSettings(this, Group.Rotation)
76+
override val rotationConfig = RotationSettings(this, Group.Rotation)
7777

7878
private var currentYaw = 0.0f
7979
private var currentPitch = 0.0f

src/main/kotlin/com/lambda/module/modules/player/HighwayTools.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ object HighwayTools : Module(
6969
private val distance by setting("Distance", -1, -1..1000000, 1, "Distance to build the highway/tunnel (negative for infinite)").group(Group.Structure)
7070
private val sliceSize by setting("Slice Size", 3, 1..5, 1, "Number of slices to build at once").group(Group.Structure)
7171

72-
private val build = BuildSettings(this, Group.Build)
73-
private val rotation = RotationSettings(this, Group.Rotation)
74-
private val interact = InteractionSettings(this, Group.Interaction, InteractionMask.Block)
75-
private val inventory = InventorySettings(this, Group.Inventory)
76-
private val hotbar = HotbarSettings(this, Group.Hotbar)
77-
private val eat = EatSettings(this, Group.Eat)
72+
override val buildConfig = BuildSettings(this, Group.Build)
73+
override val rotationConfig = RotationSettings(this, Group.Rotation)
74+
override val interactionConfig = InteractionSettings(this, Group.Interaction, InteractionMask.Block)
75+
override val inventoryConfig = InventorySettings(this, Group.Inventory)
76+
override val hotbarConfig = HotbarSettings(this, Group.Hotbar)
77+
override val eatConfig = EatSettings(this, Group.Eat)
7878

7979
private var octant = EightWayDirection.NORTH
8080
private var distanceMoved = 0
@@ -141,7 +141,7 @@ object HighwayTools : Module(
141141
disable()
142142
emptyStructure()
143143
}
144-
}.build(collectDrops = build.collectDrops, lifeMaintenance = true)
144+
}.build(collectDrops = buildConfig.collectDrops, lifeMaintenance = true)
145145
.run()
146146
}
147147

src/main/kotlin/com/lambda/module/modules/player/InventoryTweaks.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ object InventoryTweaks : Module(
4646

4747
private val instantShulker by setting("Instant Shulker", true, description = "Right-click shulker boxes in your inventory to instantly place them and open them.").group(Group.General)
4848
private val instantEChest by setting("Instant Ender-Chest", true, description = "Right-click ender chests in your inventory to instantly place them and open them.").group(Group.General)
49-
private val inventory = InventorySettings(this, Group.Inventory)
49+
override val inventoryConfig = InventorySettings(this, Group.Inventory)
5050
private var placedPos: BlockPos? = null
5151
private var placeAndOpen: Task<*>? = null
5252
private var lastBreak: Task<*>? = null

src/main/kotlin/com/lambda/module/modules/player/RotationLock.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ object RotationLock : Module(
4545
private val pitchStep by setting("Pitch Step", 45.0, 1.0..90.0, 1.0) { pitchMode == RotationMode.Snap }.group(Group.General)
4646
private val customPitch by setting("Custom Pitch", 0.0, -90.0..90.0, 1.0) { pitchMode == RotationMode.Custom }.group(Group.General)
4747

48-
@JvmStatic val rotationSettings = RotationSettings(this, Group.Rotation)
49-
private var rotationRequest: RotationRequest? = null
48+
override val rotationConfig = RotationSettings(this, Group.Rotation)
5049

5150
init {
5251
listen<TickEvent.Pre> {

0 commit comments

Comments
 (0)