From e8d07d1a12e458a9496f911ea0408946b9bd4cd7 Mon Sep 17 00:00:00 2001 From: awsms <48278661+awsms@users.noreply.github.com> Date: Thu, 1 Oct 2026 07:34:07 +0200 Subject: [PATCH] Allow fine controller sensitivity adjustments The controller sensitivity slider advanced in steps of 0.5 and displayed only whole numbers, hiding the selected fractional value. Use 0.1 steps, matching the granularity of the earlier local controller slider while retaining master's 1-10 sensitivity scale and speed mapping. Add an optional decimal precision field to menu sliders and display one decimal for controller look sensitivity. Other sliders retain their default integer formatting; the renderer caps requested precision at six places. Validation: the play build, targeted formatting and diff checks passed. Temporary probes verified the controller menu's inherited slider definition, its 1-10 bounds and 0.1 step, decimal precision, and preservation of fractional sensitivity through settings sanitization. No permanent tests were added. --- crates/asset_game/src/menu_catalog.rs | 2 ++ crates/hud/src/menus/mod.rs | 3 ++- crates/ui/menus/controller.json | 5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/asset_game/src/menu_catalog.rs b/crates/asset_game/src/menu_catalog.rs index e5461d9..d8774cb 100644 --- a/crates/asset_game/src/menu_catalog.rs +++ b/crates/asset_game/src/menu_catalog.rs @@ -99,6 +99,8 @@ pub struct MenuSlider { #[serde(default)] pub display_range: Option<[f32; 2]>, #[serde(default)] + pub decimals: u8, + #[serde(default)] pub suffix: String, } diff --git a/crates/hud/src/menus/mod.rs b/crates/hud/src/menus/mod.rs index 7b6037e..91641b0 100644 --- a/crates/hud/src/menus/mod.rs +++ b/crates/hud/src/menus/mod.rs @@ -440,7 +440,8 @@ pub(crate) fn update_script_menus( let displayed = slider .display_range .map_or(value, |[min, max]| min + fraction * (max - min)); - label.text_key = format!("{displayed:.0}{}", slider.suffix); + let decimals = usize::from(slider.decimals.min(6)); + label.text_key = format!("{displayed:.decimals$}{}", slider.suffix); label.rect.x += item.rect.w + 8.0; label.rect.w = 36.0; slider_parts.push(label); diff --git a/crates/ui/menus/controller.json b/crates/ui/menus/controller.json index cd9f7bb..ff4e9bc 100644 --- a/crates/ui/menus/controller.json +++ b/crates/ui/menus/controller.json @@ -307,9 +307,10 @@ "slider": { "min": 1, "max": 10, - "step": 0.5, + "step": 0.1, "display_range": null, - "suffix": "" + "suffix": "", + "decimals": 1 }, "name": "ui_pad_sensitivity" }