Add config categories

This commit is contained in:
Linnea Gräf
2024-10-13 21:46:46 +02:00
parent 0cc77949c9
commit 4e9b0ded27
32 changed files with 337 additions and 220 deletions

View File

@@ -1,5 +1,3 @@
package moe.nea.firmament.features.chat
import com.mojang.brigadier.arguments.StringArgumentType.string
@@ -17,41 +15,41 @@ import moe.nea.firmament.util.MC
object AutoCompletions : FirmamentFeature {
object TConfig : ManagedConfig(identifier) {
val provideWarpTabCompletion by toggle("warp-complete") { true }
val replaceWarpIsByWarpIsland by toggle("warp-is") { true }
}
object TConfig : ManagedConfig(identifier, Category.CHAT) {
val provideWarpTabCompletion by toggle("warp-complete") { true }
val replaceWarpIsByWarpIsland by toggle("warp-is") { true }
}
override val config: ManagedConfig?
get() = TConfig
override val identifier: String
get() = "auto-completions"
override val config: ManagedConfig?
get() = TConfig
override val identifier: String
get() = "auto-completions"
@Subscribe
fun onMaskCommands(event: MaskCommands) {
if (TConfig.provideWarpTabCompletion) {
event.mask("warp")
}
}
@Subscribe
fun onMaskCommands(event: MaskCommands) {
if (TConfig.provideWarpTabCompletion) {
event.mask("warp")
}
}
@Subscribe
fun onCommandEvent(event: CommandEvent) {
if (!TConfig.provideWarpTabCompletion) return
event.deleteCommand("warp")
event.register("warp") {
thenArgument("to", string()) { toArg ->
suggestsList {
RepoManager.neuRepo.constants?.islands?.warps?.flatMap { listOf(it.warp) + it.aliases } ?: listOf()
}
thenExecute {
val warpName = get(toArg)
if (warpName == "is" && TConfig.replaceWarpIsByWarpIsland) {
MC.sendServerCommand("warp island")
} else {
MC.sendServerCommand("warp $warpName")
}
}
}
}
}
@Subscribe
fun onCommandEvent(event: CommandEvent) {
if (!TConfig.provideWarpTabCompletion) return
event.deleteCommand("warp")
event.register("warp") {
thenArgument("to", string()) { toArg ->
suggestsList {
RepoManager.neuRepo.constants?.islands?.warps?.flatMap { listOf(it.warp) + it.aliases } ?: listOf()
}
thenExecute {
val warpName = get(toArg)
if (warpName == "is" && TConfig.replaceWarpIsByWarpIsland) {
MC.sendServerCommand("warp island")
} else {
MC.sendServerCommand("warp $warpName")
}
}
}
}
}
}

View File

@@ -35,7 +35,7 @@ object ChatLinks : FirmamentFeature {
override val identifier: String
get() = "chat-links"
object TConfig : ManagedConfig(identifier) {
object TConfig : ManagedConfig(identifier, Category.CHAT) {
val enableLinks by toggle("links-enabled") { true }
val imageEnabled by toggle("image-enabled") { true }
val allowAllHosts by toggle("allow-all-hosts") { false }

View File

@@ -26,7 +26,7 @@ object DeveloperFeatures : FirmamentFeature {
.iterate { it.parent }
.find { it.resolve("settings.gradle.kts").exists() }
object TConfig : ManagedConfig("developer") {
object TConfig : ManagedConfig("developer", Category.DEV) {
val autoRebuildResources by toggle("auto-rebuild") { false }
}

View File

@@ -37,7 +37,7 @@ object PowerUserTools : FirmamentFeature {
override val identifier: String
get() = "power-user"
object TConfig : ManagedConfig(identifier) {
object TConfig : ManagedConfig(identifier, Category.DEV) {
val showItemIds by toggle("show-item-id") { false }
val copyItemId by keyBindingWithDefaultUnbound("copy-item-id")
val copyTexturePackId by keyBindingWithDefaultUnbound("copy-texture-pack-id")

View File

@@ -10,7 +10,7 @@ object DianaWaypoints : FirmamentFeature {
override val identifier get() = "diana"
override val config get() = TConfig
object TConfig : ManagedConfig(identifier) {
object TConfig : ManagedConfig(identifier, Category.EVENTS) {
val ancestralSpadeSolver by toggle("ancestral-spade") { true }
val ancestralSpadeTeleport by keyBindingWithDefaultUnbound("ancestral-teleport")
val nearbyWaypoints by toggle("nearby-waypoints") { true }

View File

@@ -28,7 +28,7 @@ object AnniversaryFeatures : FirmamentFeature {
override val identifier: String
get() = "anniversary"
object TConfig : ManagedConfig(identifier) {
object TConfig : ManagedConfig(identifier, Category.EVENTS) {
val enableShinyPigTracker by toggle("shiny-pigs") {true}
val trackPigCooldown by position("pig-hud", 200, 300) { Point(0.1, 0.2) }
}

View File

@@ -5,7 +5,7 @@ import moe.nea.firmament.features.FirmamentFeature
import moe.nea.firmament.gui.config.ManagedConfig
object CarnivalFeatures : FirmamentFeature {
object TConfig : ManagedConfig(identifier) {
object TConfig : ManagedConfig(identifier, Category.EVENTS) {
val enableBombSolver by toggle("bombs-solver") { true }
val displayTutorials by toggle("tutorials") { true }
}

View File

@@ -16,7 +16,7 @@ object CompatibliltyFeatures : FirmamentFeature {
override val identifier: String
get() = "compatibility"
object TConfig : ManagedConfig(identifier) {
object TConfig : ManagedConfig(identifier, Category.INTEGRATIONS) {
val enhancedExplosions by toggle("explosion-enabled") { false }
val explosionSize by integer("explosion-power", 10, 50) { 1 }
}

View File

@@ -21,7 +21,7 @@ object Fixes : FirmamentFeature {
override val identifier: String
get() = "fixes"
object TConfig : ManagedConfig(identifier) {
object TConfig : ManagedConfig(identifier, Category.MISC) { // TODO: split this config
val fixUnsignedPlayerSkins by toggle("player-skins") { true }
var autoSprint by toggle("auto-sprint") { false }
val autoSprintKeyBinding by keyBindingWithDefaultUnbound("auto-sprint-keybinding")

View File

@@ -22,7 +22,7 @@ object ItemRarityCosmetics : FirmamentFeature {
override val identifier: String
get() = "item-rarity-cosmetics"
object TConfig : ManagedConfig(identifier) {
object TConfig : ManagedConfig(identifier, Category.INVENTORY) {
val showItemRarityBackground by toggle("background") { false }
val showItemRarityInHotbar by toggle("background-hotbar") { false }
}

View File

@@ -7,7 +7,6 @@ import moe.nea.firmament.features.FirmamentFeature
import moe.nea.firmament.gui.config.ManagedConfig
import moe.nea.firmament.util.MC
import moe.nea.firmament.util.petData
import moe.nea.firmament.util.unformattedString
import moe.nea.firmament.util.useMatch
object PetFeatures : FirmamentFeature {
@@ -17,7 +16,7 @@ object PetFeatures : FirmamentFeature {
override val config: ManagedConfig?
get() = TConfig
object TConfig : ManagedConfig(identifier) {
object TConfig : ManagedConfig(identifier, Category.INVENTORY) {
val highlightEquippedPet by toggle("highlight-pet") { true }
}

View File

@@ -15,7 +15,7 @@ object PriceData : FirmamentFeature {
override val identifier: String
get() = "price-data"
object TConfig : ManagedConfig(identifier) {
object TConfig : ManagedConfig(identifier, Category.INVENTORY) {
val tooltipEnabled by toggle("enable-always") { true }
val enableKeybinding by keyBindingWithDefaultUnbound("enable-keybind")
}

View File

@@ -15,7 +15,7 @@ object SaveCursorPosition : FirmamentFeature {
override val identifier: String
get() = "save-cursor-position"
object TConfig : ManagedConfig(identifier) {
object TConfig : ManagedConfig(identifier, Category.INVENTORY) {
val enable by toggle("enable") { true }
val tolerance by duration("tolerance", 10.milliseconds, 5000.milliseconds) { 500.milliseconds }
}

View File

@@ -46,7 +46,7 @@ object SlotLocking : FirmamentFeature {
val lockedUUIDs: MutableSet<UUID> = mutableSetOf(),
)
object TConfig : ManagedConfig(identifier) {
object TConfig : ManagedConfig(identifier, Category.INVENTORY) {
val lockSlot by keyBinding("lock") { GLFW.GLFW_KEY_L }
val lockUUID by keyBindingWithOutDefaultModifiers("lock-uuid") {
SavedKeyBinding(GLFW.GLFW_KEY_L, shift = true)

View File

@@ -20,7 +20,7 @@ object InventoryButtons : FirmamentFeature {
override val identifier: String
get() = "inventory-buttons"
object TConfig : ManagedConfig(identifier) {
object TConfig : ManagedConfig(identifier, Category.INVENTORY) {
val _openEditor by button("open-editor") {
openEditor()
}

View File

@@ -27,7 +27,7 @@ object StorageOverlay : FirmamentFeature {
override val identifier: String
get() = "storage-overlay"
object TConfig : ManagedConfig(identifier) {
object TConfig : ManagedConfig(identifier, Category.INVENTORY) {
val alwaysReplace by toggle("always-replace") { true }
val columns by integer("rows", 1, 10) { 3 }
val scrollSpeed by integer("scroll-speed", 1, 50) { 10 }

View File

@@ -39,7 +39,7 @@ object PickaxeAbility : FirmamentFeature {
get() = "pickaxe-info"
object TConfig : ManagedConfig(identifier) {
object TConfig : ManagedConfig(identifier, Category.MINING) {
val cooldownEnabled by toggle("ability-cooldown") { true }
val cooldownScale by integer("ability-scale", 16, 64) { 16 }
val drillFuelBar by toggle("fuel-bar") { true }

View File

@@ -49,7 +49,7 @@ object PristineProfitTracker : FirmamentFeature {
override val config: ManagedConfig?
get() = TConfig
object TConfig : ManagedConfig(identifier) {
object TConfig : ManagedConfig(identifier, Category.MINING) {
val timeout by duration("timeout", 0.seconds, 120.seconds) { 30.seconds }
val gui by position("position", 80, 30) { Point(0.05, 0.2) }
}

View File

@@ -26,7 +26,7 @@ object CustomSkyBlockTextures : FirmamentFeature {
override val identifier: String
get() = "custom-skyblock-textures"
object TConfig : ManagedConfig(identifier) {
object TConfig : ManagedConfig(identifier, Category.INTEGRATIONS) { // TODO: should this be its own thing?
val enabled by toggle("enabled") { true }
val skullsEnabled by toggle("skulls-enabled") { true }
val cacheForever by toggle("cache-forever") { true }

View File

@@ -38,7 +38,7 @@ object FairySouls : FirmamentFeature {
object DConfig : ProfileSpecificDataHolder<Data>(serializer(), "found-fairysouls", ::Data)
object TConfig : ManagedConfig("fairy-souls") {
object TConfig : ManagedConfig("fairy-souls", Category.MISC) {
val displaySouls by toggle("show") { false }
val resetSouls by button("reset") {
DConfig.data?.foundSouls?.clear() != null

View File

@@ -38,7 +38,7 @@ object Waypoints : FirmamentFeature {
override val identifier: String
get() = "waypoints"
object TConfig : ManagedConfig(identifier) {
object TConfig : ManagedConfig(identifier, Category.MINING) { // TODO: add to misc
val tempWaypointDuration by duration("temp-waypoint-duration", 0.seconds, 1.hours) { 30.seconds }
val showIndex by toggle("show-index") { true }
val skipToNearest by toggle("skip-to-nearest") { false }