mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Removed mounted combat edge cases
This commit is contained in:
parent
ed9de26f27
commit
20509a7818
@ -243,6 +243,32 @@ impl CharacterState {
|
|||||||
|| matches!(self, CharacterState::Roll(s) if s.stage_section == StageSection::Movement)
|
|| matches!(self, CharacterState::Roll(s) if s.stage_section == StageSection::Movement)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn can_perform_mounted(&self) -> bool {
|
||||||
|
matches!(
|
||||||
|
self,
|
||||||
|
CharacterState::Idle(_)
|
||||||
|
| CharacterState::Sit
|
||||||
|
| CharacterState::Talk
|
||||||
|
| CharacterState::GlideWield(_)
|
||||||
|
| CharacterState::Stunned(_)
|
||||||
|
| CharacterState::BasicBlock(_)
|
||||||
|
| CharacterState::Equipping(_)
|
||||||
|
| CharacterState::Wielding(_)
|
||||||
|
| CharacterState::BasicMelee(_)
|
||||||
|
| CharacterState::BasicRanged(_)
|
||||||
|
| CharacterState::ComboMelee(_)
|
||||||
|
| CharacterState::ChargedRanged(_)
|
||||||
|
| CharacterState::RepeaterRanged(_)
|
||||||
|
| CharacterState::BasicBeam(_)
|
||||||
|
| CharacterState::BasicAura(_)
|
||||||
|
| CharacterState::BasicSummon(_)
|
||||||
|
| CharacterState::SelfBuff(_)
|
||||||
|
| CharacterState::SpriteSummon(_)
|
||||||
|
| CharacterState::UseItem(_)
|
||||||
|
| CharacterState::SpriteInteract(_)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn is_sitting(&self) -> bool {
|
pub fn is_sitting(&self) -> bool {
|
||||||
use use_item::{Data, ItemUseKind, StaticData};
|
use use_item::{Data, ItemUseKind, StaticData};
|
||||||
matches!(
|
matches!(
|
||||||
|
@ -210,13 +210,10 @@ impl<'a> System<'a> for Sys {
|
|||||||
|
|
||||||
// Mounted occurs after control actions have been handled
|
// Mounted occurs after control actions have been handled
|
||||||
// If mounted, character state is controlled by mount
|
// If mounted, character state is controlled by mount
|
||||||
if is_rider.is_some() {
|
if is_rider.is_some() && !join_struct.char_state.can_perform_mounted() {
|
||||||
let idle_state = CharacterState::Idle(idle::Data { is_sneaking: false });
|
// TODO: A better way to swap between mount inputs and rider inputs
|
||||||
// TODO: A better way to swap between mount inputs and rider
|
*join_struct.char_state = CharacterState::Idle(idle::Data { is_sneaking: false });
|
||||||
// inputs if *join_struct.char_state !=
|
continue;
|
||||||
// idle_state { *join_struct.char_state =
|
|
||||||
// idle_state; }
|
|
||||||
// continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let j = JoinData::new(
|
let j = JoinData::new(
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#![feature(bool_to_option, let_else)]
|
#![feature(bool_to_option, let_else, btree_drain_filter)]
|
||||||
#![allow(clippy::option_map_unit_fn)]
|
#![allow(clippy::option_map_unit_fn)]
|
||||||
|
|
||||||
mod aura;
|
mod aura;
|
||||||
|
@ -51,8 +51,14 @@ impl<'a> System<'a> for Sys {
|
|||||||
.retrieve_entity_internal(is_mount.rider.id())
|
.retrieve_entity_internal(is_mount.rider.id())
|
||||||
.and_then(|rider| {
|
.and_then(|rider| {
|
||||||
controllers
|
controllers
|
||||||
.get(rider)
|
.get_mut(rider)
|
||||||
.map(|c| (c.inputs.clone(), c.queued_inputs.clone(), rider))
|
.map(|c| {
|
||||||
|
let queued_inputs = c.queued_inputs
|
||||||
|
// TODO: Formalise ways to pass inputs to mounts
|
||||||
|
.drain_filter(|i, _| matches!(i, InputKind::Jump | InputKind::Fly | InputKind::Roll))
|
||||||
|
.collect();
|
||||||
|
(c.inputs.clone(), queued_inputs, rider)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
else { continue };
|
else { continue };
|
||||||
|
|
||||||
@ -72,11 +78,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
if let Some(controller) = controllers.get_mut(entity) {
|
if let Some(controller) = controllers.get_mut(entity) {
|
||||||
*controller = Controller {
|
*controller = Controller {
|
||||||
inputs,
|
inputs,
|
||||||
queued_inputs: queued_inputs
|
queued_inputs,
|
||||||
.into_iter()
|
|
||||||
// TODO: Formalise ways to pass inputs to mounts
|
|
||||||
.filter(|(i, _)| matches!(i, InputKind::Jump | InputKind::Fly | InputKind::Roll))
|
|
||||||
.collect(),
|
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user