From a1cff649dd14659f6798e386cf8ef77616651077 Mon Sep 17 00:00:00 2001 From: videogame hacker Date: Fri, 4 Mar 2022 18:14:39 +0000 Subject: [PATCH] Add a speed setting to Freecam, unclamp RegisteredValues --- .../kotlin/codes/som/hibiscus/api/feature/values/FloatValue.kt | 3 --- .../codes/som/hibiscus/api/feature/values/IntegerValue.kt | 3 --- src/main/kotlin/codes/som/hibiscus/features/visual/Freecam.kt | 2 ++ 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/codes/som/hibiscus/api/feature/values/FloatValue.kt b/src/main/kotlin/codes/som/hibiscus/api/feature/values/FloatValue.kt index 8341d34..d8de193 100644 --- a/src/main/kotlin/codes/som/hibiscus/api/feature/values/FloatValue.kt +++ b/src/main/kotlin/codes/som/hibiscus/api/feature/values/FloatValue.kt @@ -6,9 +6,6 @@ class FloatValue( name: String, value: Float, val min: Float = Float.MIN_VALUE, val max: Float = Float.MAX_VALUE ) : RegisteredValue(name, value) { - override fun valueChangeHook(orig: Float, new: Float) = - new.coerceIn(min, max) - override fun convertValueFromString(representation: String): Float { return representation.toFloat() } diff --git a/src/main/kotlin/codes/som/hibiscus/api/feature/values/IntegerValue.kt b/src/main/kotlin/codes/som/hibiscus/api/feature/values/IntegerValue.kt index 1840bfa..5f3aeed 100644 --- a/src/main/kotlin/codes/som/hibiscus/api/feature/values/IntegerValue.kt +++ b/src/main/kotlin/codes/som/hibiscus/api/feature/values/IntegerValue.kt @@ -6,9 +6,6 @@ class IntegerValue( name: String, value: Int, val min: Int = Int.MIN_VALUE, val max: Int = Int.MAX_VALUE ) : RegisteredValue(name, value) { - override fun valueChangeHook(orig: Int, new: Int) = - new.coerceIn(min, max) - override fun convertValueFromString(representation: String): Int { return representation.toInt() } diff --git a/src/main/kotlin/codes/som/hibiscus/features/visual/Freecam.kt b/src/main/kotlin/codes/som/hibiscus/features/visual/Freecam.kt index d6b941b..54be682 100644 --- a/src/main/kotlin/codes/som/hibiscus/features/visual/Freecam.kt +++ b/src/main/kotlin/codes/som/hibiscus/features/visual/Freecam.kt @@ -33,6 +33,7 @@ class Freecam : Feature("Freecam", FeatureCategory.VISUAL) { private var origPitch = 0F private val toggleKey by values.key("Toggle Key", GLFW_KEY_TAB) + private val speed by values.float("Speed", 1.0f, 0.01f, 50.0f) init { var isPlayerTicking = false @@ -98,6 +99,7 @@ class Freecam : Feature("Freecam", FeatureCategory.VISUAL) { .multiply(movement.z) .add(lookVec.rotateY(-MathHelper.HALF_PI).multiply(movement.x)) .add(0.0, movement.y, 0.0) + .multiply(speed.toDouble()) view.move(MovementType.SELF, movement) // Update entity positional state properly by calling move() }