use mount key

This commit is contained in:
Isse 2023-02-08 21:35:49 +01:00
parent 2928eb8d15
commit 7eba16a2d7
3 changed files with 14 additions and 5 deletions

View File

@ -1539,7 +1539,7 @@ impl Client {
}
}
pub fn stand_if_mounted(&mut self) {
pub fn stand_if_mounted(&mut self) -> bool {
let is_sitting = self
.state
.ecs()
@ -1552,6 +1552,7 @@ impl Client {
Some(false) => {},
None => warn!("Can't stand, client entity doesn't have a `CharacterState`"),
}
is_sitting.unwrap_or(false)
}
pub fn toggle_dance(&mut self) {

View File

@ -2128,7 +2128,7 @@ impl Hud {
overitem_properties,
self.pulse,
&global_state.window.key_layout,
vec![(Some(GameInput::Interact), i18n.get_msg("hud-sit").to_string())],
vec![(Some(GameInput::Mount), i18n.get_msg("hud-sit").to_string())],
)
.x_y(0.0, 100.0)
.position_ingame(over_pos)

View File

@ -887,7 +887,17 @@ impl PlayState for SessionState {
let mut client = self.client.borrow_mut();
if client.is_riding() {
client.unmount();
} else {
} else if client.stand_if_mounted() { } else {
if let Some(interactable) = &self.interactable {
match interactable {
Interactable::Block(_, pos, interaction) => {
if matches!(interaction, BlockInteraction::Mount(_)) {
client.mount_sprite(*pos)
}
}
Interactable::Entity(entity) => client.mount(*entity),
}
}
let player_pos = client
.state()
.read_storage::<Pos>()
@ -969,8 +979,6 @@ impl PlayState for SessionState {
}
},
}
} else {
client.stand_if_mounted()
}
}
},