Add a speed setting to Freecam, unclamp RegisteredValues
parent
f32cd7e20c
commit
a1cff649dd
|
@ -6,9 +6,6 @@ class FloatValue(
|
||||||
name: String, value: Float,
|
name: String, value: Float,
|
||||||
val min: Float = Float.MIN_VALUE, val max: Float = Float.MAX_VALUE
|
val min: Float = Float.MIN_VALUE, val max: Float = Float.MAX_VALUE
|
||||||
) : RegisteredValue<Float>(name, value) {
|
) : RegisteredValue<Float>(name, value) {
|
||||||
override fun valueChangeHook(orig: Float, new: Float) =
|
|
||||||
new.coerceIn(min, max)
|
|
||||||
|
|
||||||
override fun convertValueFromString(representation: String): Float {
|
override fun convertValueFromString(representation: String): Float {
|
||||||
return representation.toFloat()
|
return representation.toFloat()
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,6 @@ class IntegerValue(
|
||||||
name: String, value: Int,
|
name: String, value: Int,
|
||||||
val min: Int = Int.MIN_VALUE, val max: Int = Int.MAX_VALUE
|
val min: Int = Int.MIN_VALUE, val max: Int = Int.MAX_VALUE
|
||||||
) : RegisteredValue<Int>(name, value) {
|
) : RegisteredValue<Int>(name, value) {
|
||||||
override fun valueChangeHook(orig: Int, new: Int) =
|
|
||||||
new.coerceIn(min, max)
|
|
||||||
|
|
||||||
override fun convertValueFromString(representation: String): Int {
|
override fun convertValueFromString(representation: String): Int {
|
||||||
return representation.toInt()
|
return representation.toInt()
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ class Freecam : Feature("Freecam", FeatureCategory.VISUAL) {
|
||||||
private var origPitch = 0F
|
private var origPitch = 0F
|
||||||
|
|
||||||
private val toggleKey by values.key("Toggle Key", GLFW_KEY_TAB)
|
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 {
|
init {
|
||||||
var isPlayerTicking = false
|
var isPlayerTicking = false
|
||||||
|
@ -98,6 +99,7 @@ class Freecam : Feature("Freecam", FeatureCategory.VISUAL) {
|
||||||
.multiply(movement.z)
|
.multiply(movement.z)
|
||||||
.add(lookVec.rotateY(-MathHelper.HALF_PI).multiply(movement.x))
|
.add(lookVec.rotateY(-MathHelper.HALF_PI).multiply(movement.x))
|
||||||
.add(0.0, movement.y, 0.0)
|
.add(0.0, movement.y, 0.0)
|
||||||
|
.multiply(speed.toDouble())
|
||||||
|
|
||||||
view.move(MovementType.SELF, movement) // Update entity positional state properly by calling move()
|
view.move(MovementType.SELF, movement) // Update entity positional state properly by calling move()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue