don't show red text when walking

This commit is contained in:
Isse 2023-11-26 12:56:54 +01:00
parent 2097a499c7
commit b60ebd4131
3 changed files with 12 additions and 48 deletions

View File

@ -36,7 +36,6 @@ hud-diary = Diary
hud-free_look_indicator = Free look active. Press { $key } to disable.
hud-camera_clamp_indicator = Camera vertical clamp active. Press { $key } to disable.
hud-auto_walk_indicator = Auto walk/swim active
hud-walking_speed_indicator = Walking speed active
hud-zoom_lock_indicator-remind = Zoom locked
hud-zoom_lock_indicator-enable = Camera zoom locked
hud-zoom_lock_indicator-disable = Camera zoom unlocked

View File

@ -913,7 +913,6 @@ pub struct Show {
stats: bool,
free_look: bool,
auto_walk: bool,
walking_speed: bool,
zoom_lock: ChangeNotification,
camera_clamp: bool,
prompt_dialog: Option<PromptDialogSettings>,
@ -1421,7 +1420,6 @@ impl Hud {
stats: false,
free_look: false,
auto_walk: false,
walking_speed: false,
zoom_lock: ChangeNotification::default(),
camera_clamp: false,
prompt_dialog: None,
@ -3822,23 +3820,6 @@ impl Hud {
.set(self.ids.auto_walk_txt, ui_widgets);
}
// Walking speed indicator
if self.show.walking_speed {
Text::new(&i18n.get_msg("hud-walking_speed_indicator"))
.color(TEXT_BG)
.mid_top_with_margin_on(ui_widgets.window, indicator_offset)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(20))
.set(self.ids.walking_speed_bg, ui_widgets);
indicator_offset += 30.0;
Text::new(&i18n.get_msg("hud-walking_speed_indicator"))
.color(KILL_COLOR)
.top_left_with_margins_on(self.ids.walking_speed_bg, -1.0, -1.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(20))
.set(self.ids.walking_speed_txt, ui_widgets);
}
// Camera zoom lock
self.show.zoom_lock.update(dt);
@ -4939,10 +4920,6 @@ impl Hud {
pub fn auto_walk(&mut self, auto_walk: bool) { self.show.auto_walk = auto_walk; }
pub fn walking_speed(&mut self, walking_speed: bool) {
self.show.walking_speed = walking_speed;
}
pub fn camera_clamp(&mut self, camera_clamp: bool) { self.show.camera_clamp = camera_clamp; }
/// Remind the player camera zoom is currently locked, for example if they

View File

@ -686,8 +686,6 @@ impl PlayState for SessionState {
// Throw out distance info, it will be useful in the future
self.target_entity = entity_target.map(|t| t.kind.0);
let mut stop_walk = false;
// Handle window events.
for event in events {
// Pass all events to the ui first.
@ -714,7 +712,7 @@ impl PlayState for SessionState {
}
match input {
GameInput::Primary => {
stop_walk = true;
self.walking_speed = false;
let mut client = self.client.borrow_mut();
// Mine and build targets can be the same block. make building
// take precedence.
@ -733,7 +731,7 @@ impl PlayState for SessionState {
}
},
GameInput::Secondary => {
stop_walk = true;
self.walking_speed = false;
let mut client = self.client.borrow_mut();
if let Some(build_target) = build_target.filter(|bt| {
state && can_build && nearest_block_dist == Some(bt.distance)
@ -753,7 +751,7 @@ impl PlayState for SessionState {
}
},
GameInput::Block => {
stop_walk = true;
self.walking_speed = false;
self.client.borrow_mut().handle_input(
InputKind::Block,
state,
@ -762,7 +760,7 @@ impl PlayState for SessionState {
);
},
GameInput::Roll => {
stop_walk = true;
self.walking_speed = false;
let mut client = self.client.borrow_mut();
if can_build {
if state {
@ -787,14 +785,14 @@ impl PlayState for SessionState {
}
},
GameInput::Respawn => {
stop_walk = true;
self.walking_speed = false;
self.stop_auto_walk();
if state {
self.client.borrow_mut().respawn();
}
},
GameInput::Jump => {
stop_walk = true;
self.walking_speed = false;
self.client.borrow_mut().handle_input(
InputKind::Jump,
state,
@ -857,7 +855,7 @@ impl PlayState for SessionState {
self.key_state.right = state
},
GameInput::Glide => {
stop_walk = true;
self.walking_speed = false;
let is_trading = self.client.borrow().is_trading();
if state && !is_trading {
if global_state.settings.gameplay.stop_auto_walk_on_input {
@ -890,7 +888,7 @@ impl PlayState for SessionState {
if state {
let mut client = self.client.borrow_mut();
if client.is_wielding().is_some_and(|b| !b) {
stop_walk = true;
self.walking_speed = false;
}
client.toggle_wield();
}
@ -1230,20 +1228,11 @@ impl PlayState for SessionState {
}
},
GameInput::ToggleWalk if state => {
let hud = &mut self.hud;
global_state
.settings
.gameplay
.walking_speed_behavior
.update(state, &mut self.walking_speed, |b| {
hud.walking_speed(b)
});
self.key_state.speed_mul = if self.walking_speed {
global_state.settings.gameplay.walking_speed
} else {
1.0
};
.update(state, &mut self.walking_speed, |_| {});
},
_ => {},
}
@ -1454,10 +1443,9 @@ impl PlayState for SessionState {
}
}
if stop_walk && self.walking_speed {
self.walking_speed = false;
self.hud.walking_speed(false);
if self.walking_speed {
self.key_state.speed_mul = global_state.settings.gameplay.walking_speed;
} else {
self.key_state.speed_mul = 1.0;
}