Skip to content

Commit 64f8301

Browse files
committed
merge interaction config into build config and denest break, place, and interact settings
1 parent 8204de8 commit 64f8301

31 files changed

+183
-336
lines changed

src/main/kotlin/com/lambda/config/groups/BreakSettings.kt

Lines changed: 48 additions & 48 deletions
Large diffs are not rendered by default.

src/main/kotlin/com/lambda/config/groups/BuildConfig.kt

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

1818
package com.lambda.config.groups
1919

20+
import com.lambda.interaction.request.rotating.visibilty.PointSelection
2021
import com.lambda.util.Describable
2122
import com.lambda.util.NamedEnum
2223

@@ -29,14 +30,15 @@ interface BuildConfig {
2930
val maxPendingInteractions: Int
3031
val interactionTimeout: Int
3132

32-
// Breaking
33-
val breakConfig: BreakSettings
33+
val useDefaultReach: Boolean
34+
val attackReach: Double
35+
val interactReach: Double
36+
val scanReach: Double
3437

35-
// Placing
36-
val placeConfig: PlaceSettings
37-
38-
// Interacting
39-
val interactConfig: InteractSettings
38+
val strictRayCast: Boolean
39+
val checkSideVisibility: Boolean
40+
val resolution: Int
41+
val pointSelection: PointSelection
4042

4143
enum class SwingType(
4244
override val displayName: String,

src/main/kotlin/com/lambda/config/groups/BuildSettings.kt

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,41 +18,43 @@
1818
package com.lambda.config.groups
1919

2020
import com.lambda.config.Configurable
21-
import com.lambda.interaction.request.breaking.BreakConfig.BreakConfirmationMode
22-
import com.lambda.interaction.request.placing.PlaceConfig
21+
import com.lambda.interaction.request.rotating.visibilty.PointSelection
2322
import com.lambda.util.NamedEnum
23+
import kotlin.math.max
2424

2525
class BuildSettings(
2626
c: Configurable,
27-
vararg groupPath: NamedEnum,
27+
vararg baseGroup: NamedEnum,
2828
vis: () -> Boolean = { true },
2929
) : BuildConfig, SettingGroup(c, c.settings.size) {
3030
enum class Group(override val displayName: String) : NamedEnum {
3131
General("General"),
32-
Break("Break"),
33-
Place("Place"),
34-
Interact("Interact")
32+
Reach("Reach"),
33+
Scan("Scan")
3534
}
3635

3736
// General
38-
override val pathing by c.setting("Pathing", true, "Path to blocks", vis).group(*groupPath, Group.General)
39-
override val stayInRange by c.setting("Stay In Range", true, "Stay in range of blocks", vis).group(*groupPath, Group.General)
40-
override val collectDrops by c.setting("Collect All Drops", false, "Collect all drops when breaking blocks", vis).group(*groupPath, Group.General)
41-
override val interactionsPerTick by c.setting("Interactions Per Tick", 5, 1..30, 1, "The amount of interactions that can happen per tick", visibility = vis).group(*groupPath, Group.General)
42-
override val maxPendingInteractions by c.setting("Max Pending Interactions", 15, 1..30, 1, "The maximum count of pending interactions to allow before pausing future interactions", visibility = vis).group(*groupPath, Group.General)
43-
44-
// Breaking
45-
override val breakConfig = BreakSettings(c, groupPath.toList() + Group.Break, vis)
46-
47-
// Placing
48-
override val placeConfig = PlaceSettings(c, groupPath.toList() + Group.Place, vis)
49-
50-
//Interacting
51-
override val interactConfig = InteractSettings(c, groupPath.toList() + Group.Interact, vis)
52-
53-
override val interactionTimeout by c.setting("Interaction Timeout", 10, 1..30, 1, "Timeout for block breaks in ticks", unit = " ticks") {
54-
vis() && (placeConfig.placeConfirmationMode != PlaceConfig.PlaceConfirmationMode.None
55-
|| breakConfig.breakConfirmation != BreakConfirmationMode.None
56-
|| interactConfig.interactConfirmationMode != InteractionConfig.InteractConfirmationMode.None)
57-
}.group(*groupPath, Group.Break, BreakSettings.Group.General).group(*groupPath, Group.Place).group(*groupPath, Group.Interact)
37+
override val pathing by c.setting("Pathing", true, "Path to blocks", vis).group(*baseGroup, Group.General)
38+
override val stayInRange by c.setting("Stay In Range", true, "Stay in range of blocks", vis).group(*baseGroup, Group.General)
39+
override val collectDrops by c.setting("Collect All Drops", false, "Collect all drops when breaking blocks", vis).group(*baseGroup, Group.General)
40+
override val interactionsPerTick by c.setting("Interactions Per Tick", 5, 1..30, 1, "The amount of interactions that can happen per tick", visibility = vis).group(*baseGroup, Group.General)
41+
override val maxPendingInteractions by c.setting("Max Pending Interactions", 15, 1..30, 1, "The maximum count of pending interactions to allow before pausing future interactions", visibility = vis).group(*baseGroup, Group.General)
42+
43+
override val useDefaultReach by c.setting("Default Reach", true, "Whether to use vanilla interaction ranges", vis).group(*baseGroup, Group.Reach)
44+
override val attackReach by c.setting("Attack Reach", DEFAULT_ATTACK_REACH, 1.0..10.0, 0.01, "Maximum entity interaction distance") { vis() && !useDefaultReach }.group(*baseGroup, Group.Reach)
45+
override val interactReach by c.setting("Interact Reach", DEFAULT_INTERACT_REACH, 1.0..10.0, 0.01, "Maximum block interaction distance") { vis() && !useDefaultReach }.group(*baseGroup, Group.Reach)
46+
47+
override val scanReach: Double get() = max(attackReach, interactReach)
48+
49+
override val strictRayCast by c.setting("Strict Raycast", false, "Whether to include the environment to the ray cast context", vis).group(*baseGroup, Group.Scan)
50+
override val checkSideVisibility by c.setting("Visibility Check", true, "Whether to check if an AABB side is visible", vis).group(*baseGroup, Group.Scan)
51+
override val resolution by c.setting("Resolution", 5, 1..20, 1, "The amount of grid divisions per surface of the hit box", "", vis).group(*baseGroup, Group.Scan)
52+
override val pointSelection by c.setting("Point Selection", PointSelection.Optimum, "The strategy to select the best hit point", vis).group(*baseGroup, Group.Scan)
53+
54+
override val interactionTimeout by c.setting("Interaction Timeout", 10, 1..30, 1, "Timeout for block breaks in ticks", unit = " ticks", visibility = vis)
55+
56+
companion object {
57+
const val DEFAULT_ATTACK_REACH = 3.0
58+
const val DEFAULT_INTERACT_REACH = 4.5
59+
}
5860
}

src/main/kotlin/com/lambda/config/groups/InteractSettings.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ import com.lambda.util.NamedEnum
2424

2525
class InteractSettings(
2626
c: Configurable,
27-
groupPath: List<NamedEnum> = emptyList(),
27+
baseGroup: NamedEnum,
2828
vis: () -> Boolean = { true }
2929
) : InteractConfig, SettingGroup(c, c.settings.size) {
30-
override val rotate by c.setting("Rotate For Interact", true, "Rotates the player to look at the block when interacting", visibility = vis).group(groupPath)
31-
override val swingHand by c.setting("Swing On Interact", true, "Swings the players hand after interacting", visibility = vis).group(groupPath)
32-
override val interactStageMask by c.setting("Interact Stage Mask", setOf(TickEvent.Input.Post), description = "The sub-tick timing at which interact actions are performed", visibility = vis).group(groupPath)
33-
override val interactSwingType by c.setting("Interact Swing Type", BuildConfig.SwingType.Vanilla, "The style of swing") { vis() && swingHand }.group(groupPath)
34-
override val interactConfirmationMode by c.setting("Interact Confirmation Mode", InteractionConfig.InteractConfirmationMode.InteractThenAwait, "The style of confirmation for interactions", visibility = vis).group(groupPath)
30+
override val rotate by c.setting("Rotate For Interact", true, "Rotates the player to look at the block when interacting", visibility = vis).group(baseGroup)
31+
override val swingHand by c.setting("Swing On Interact", true, "Swings the players hand after interacting", visibility = vis).group(baseGroup)
32+
override val interactStageMask by c.setting("Interact Stage Mask", setOf(TickEvent.Input.Post), description = "The sub-tick timing at which interact actions are performed", visibility = vis).group(baseGroup)
33+
override val interactSwingType by c.setting("Interact Swing Type", BuildConfig.SwingType.Vanilla, "The style of swing") { vis() && swingHand }.group(baseGroup)
34+
override val interactConfirmationMode by c.setting("Interact Confirmation Mode", InteractConfig.InteractConfirmationMode.InteractThenAwait, "The style of confirmation for interactions", visibility = vis).group(baseGroup)
3535
}

src/main/kotlin/com/lambda/config/groups/InteractionConfig.kt

Lines changed: 0 additions & 72 deletions
This file was deleted.

src/main/kotlin/com/lambda/config/groups/InteractionSettings.kt

Lines changed: 0 additions & 69 deletions
This file was deleted.

src/main/kotlin/com/lambda/config/groups/PlaceSettings.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ import com.lambda.util.NamedEnum
2626

2727
class PlaceSettings(
2828
c: Configurable,
29-
groupPath: List<NamedEnum> = emptyList(),
29+
baseGroup: NamedEnum,
3030
vis: () -> Boolean = { true }
3131
) : PlaceConfig, SettingGroup(c, c.settings.size) {
32-
override val rotateForPlace by c.setting("Rotate For Place", true, "Rotate towards block while placing", visibility = vis).group(groupPath)
33-
override val airPlace by c.setting("Air Place", AirPlaceMode.None, "Allows for placing blocks without adjacent faces", visibility = vis).group(groupPath)
34-
override val axisRotateSetting by c.setting("Axis Rotate", true, "Overrides the Rotate For Place setting and rotates the player on each axis to air place rotational blocks") { vis() && airPlace.isEnabled }.group(groupPath)
35-
override val placeStageMask by c.setting("Place Stage mask", setOf(TickEvent.Input.Post), description = "The sub-tick timing at which place actions are performed", visibility = vis).group(groupPath)
36-
override val placeConfirmationMode by c.setting("Place Confirmation", PlaceConfirmationMode.PlaceThenAwait, "Wait for block placement confirmation", visibility = vis).group(groupPath)
37-
override val maxPendingPlacements by c.setting("Max Pending Placements", 5, 0..30, 1, "The maximum amount of pending placements", visibility = vis).group(groupPath)
38-
override val placementsPerTick by c.setting("Places Per Tick", 1, 1..30, 1, "Maximum instant block places per tick", visibility = vis).group(groupPath)
39-
override val swing by c.setting("Swing On Place", true, "Swings the players hand when placing", visibility = vis).group(groupPath)
40-
override val swingType by c.setting("Place Swing Type", BuildConfig.SwingType.Vanilla, "The style of swing") { vis() && swing }.group(groupPath)
41-
override val sounds by c.setting("Place Sounds", true, "Plays the placing sounds", visibility = vis).group(groupPath)
32+
override val rotateForPlace by c.setting("Rotate For Place", true, "Rotate towards block while placing", visibility = vis).group(baseGroup)
33+
override val airPlace by c.setting("Air Place", AirPlaceMode.None, "Allows for placing blocks without adjacent faces", visibility = vis).group(baseGroup)
34+
override val axisRotateSetting by c.setting("Axis Rotate", true, "Overrides the Rotate For Place setting and rotates the player on each axis to air place rotational blocks") { vis() && airPlace.isEnabled }.group(baseGroup)
35+
override val placeStageMask by c.setting("Place Stage mask", setOf(TickEvent.Input.Post), description = "The sub-tick timing at which place actions are performed", visibility = vis).group(baseGroup)
36+
override val placeConfirmationMode by c.setting("Place Confirmation", PlaceConfirmationMode.PlaceThenAwait, "Wait for block placement confirmation", visibility = vis).group(baseGroup)
37+
override val maxPendingPlacements by c.setting("Max Pending Placements", 5, 0..30, 1, "The maximum amount of pending placements", visibility = vis).group(baseGroup)
38+
override val placementsPerTick by c.setting("Places Per Tick", 1, 1..30, 1, "Maximum instant block places per tick", visibility = vis).group(baseGroup)
39+
override val swing by c.setting("Swing On Place", true, "Swings the players hand when placing", visibility = vis).group(baseGroup)
40+
override val swingType by c.setting("Place Swing Type", BuildConfig.SwingType.Vanilla, "The style of swing") { vis() && swing }.group(baseGroup)
41+
override val sounds by c.setting("Place Sounds", true, "Plays the placing sounds", visibility = vis).group(baseGroup)
4242
}

src/main/kotlin/com/lambda/context/Automated.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ package com.lambda.context
1919

2020
import com.lambda.config.groups.BuildConfig
2121
import com.lambda.config.groups.EatConfig
22-
import com.lambda.config.groups.InteractionConfig
22+
import com.lambda.interaction.request.breaking.BreakConfig
2323
import com.lambda.interaction.request.hotbar.HotbarConfig
24+
import com.lambda.interaction.request.interacting.InteractConfig
2425
import com.lambda.interaction.request.inventory.InventoryConfig
26+
import com.lambda.interaction.request.placing.PlaceConfig
2527
import com.lambda.interaction.request.rotating.RotationConfig
2628

2729
interface Automated {
2830
val buildConfig: BuildConfig
31+
val breakConfig: BreakConfig
32+
val placeConfig: PlaceConfig
33+
val interactConfig: InteractConfig
2934
val rotationConfig: RotationConfig
30-
val interactionConfig: InteractionConfig
3135
val inventoryConfig: InventoryConfig
3236
val hotbarConfig: HotbarConfig
3337
val eatConfig: EatConfig
34-
}
35-
36-
val Automated.breakConfig get() = buildConfig.breakConfig
37-
val Automated.placeConfig get() = buildConfig.placeConfig
38-
val Automated.interactConfig get() = buildConfig.interactConfig
38+
}

src/main/kotlin/com/lambda/context/AutomationConfig.kt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,26 @@ package com.lambda.context
1919

2020
import com.lambda.config.Configurable
2121
import com.lambda.config.configurations.LambdaConfig
22+
import com.lambda.config.groups.BreakSettings
2223
import com.lambda.config.groups.BuildSettings
2324
import com.lambda.config.groups.EatSettings
2425
import com.lambda.config.groups.HotbarSettings
25-
import com.lambda.config.groups.InteractionSettings
26+
import com.lambda.config.groups.InteractSettings
2627
import com.lambda.config.groups.InventorySettings
28+
import com.lambda.config.groups.PlaceSettings
2729
import com.lambda.config.groups.RotationSettings
2830
import com.lambda.event.events.onStaticRender
2931
import com.lambda.interaction.construction.result.Drawable
3032
import com.lambda.util.NamedEnum
31-
import com.lambda.util.world.raycast.InteractionMask
3233

3334
object AutomationConfig : Configurable(LambdaConfig), Automated {
3435
override val name = "automation"
3536

3637
enum class Group(override val displayName: String) : NamedEnum {
3738
Build("Build"),
39+
Break("Break"),
40+
Place("Place"),
41+
Interact("Interact"),
3842
Rotation("Rotation"),
3943
Interaction("Interaction"),
4044
Inventory("Inventory"),
@@ -47,8 +51,10 @@ object AutomationConfig : Configurable(LambdaConfig), Automated {
4751
val renders by setting("Render", false).group(Group.Render)
4852

4953
override val buildConfig = BuildSettings(this, Group.Build)
54+
override val breakConfig = BreakSettings(this, Group.Break)
55+
override val placeConfig = PlaceSettings(this, Group.Place)
56+
override val interactConfig = InteractSettings(this, Group.Interact)
5057
override val rotationConfig = RotationSettings(this, Group.Rotation)
51-
override val interactionConfig = InteractionSettings(this, Group.Interaction, InteractionMask.Both)
5258
override val inventoryConfig = InventorySettings(this, Group.Inventory)
5359
override val hotbarConfig = HotbarSettings(this, Group.Hotbar)
5460
override val eatConfig = EatSettings(this, Group.Eat)

0 commit comments

Comments
 (0)