|
18 | 18 | package com.lambda.config.groups |
19 | 19 |
|
20 | 20 | 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 |
23 | 22 | import com.lambda.util.NamedEnum |
| 23 | +import kotlin.math.max |
24 | 24 |
|
25 | 25 | class BuildSettings( |
26 | 26 | c: Configurable, |
27 | | - vararg groupPath: NamedEnum, |
| 27 | + vararg baseGroup: NamedEnum, |
28 | 28 | vis: () -> Boolean = { true }, |
29 | | -) : BuildConfig { |
| 29 | +) : BuildConfig, SettingGroup(c) { |
30 | 30 | enum class Group(override val displayName: String) : NamedEnum { |
31 | 31 | General("General"), |
32 | | - Break("Break"), |
33 | | - Place("Place"), |
34 | | - Interact("Interact") |
| 32 | + Reach("Reach"), |
| 33 | + Scan("Scan") |
35 | 34 | } |
36 | 35 |
|
37 | 36 | // 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 | + override val interactionTimeout by c.setting("Interaction Timeout", 10, 1..30, 1, "Timeout for block breaks in ticks", unit = " ticks", visibility = vis).group(*baseGroup, Group.General) |
| 43 | + |
| 44 | + override val useDefaultReach by c.setting("Default Reach", true, "Whether to use vanilla interaction ranges", vis).group(*baseGroup, Group.Reach) |
| 45 | + 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) |
| 46 | + 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) |
| 47 | + |
| 48 | + override val scanReach: Double get() = max(attackReach, interactReach) |
| 49 | + |
| 50 | + override val strictRayCast by c.setting("Strict Raycast", false, "Whether to include the environment to the ray cast context", vis).group(*baseGroup, Group.Scan) |
| 51 | + override val checkSideVisibility by c.setting("Visibility Check", true, "Whether to check if an AABB side is visible", vis).group(*baseGroup, Group.Scan) |
| 52 | + 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) |
| 53 | + override val pointSelection by c.setting("Point Selection", PointSelection.Optimum, "The strategy to select the best hit point", vis).group(*baseGroup, Group.Scan) |
| 54 | + |
| 55 | + companion object { |
| 56 | + const val DEFAULT_ATTACK_REACH = 3.0 |
| 57 | + const val DEFAULT_INTERACT_REACH = 4.5 |
| 58 | + } |
58 | 59 | } |
0 commit comments