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)
|
||||
}
|
||||
|
||||
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 {
|
||||
use use_item::{Data, ItemUseKind, StaticData};
|
||||
matches!(
|
||||
|
@ -210,13 +210,10 @@ impl<'a> System<'a> for Sys {
|
||||
|
||||
// Mounted occurs after control actions have been handled
|
||||
// If mounted, character state is controlled by mount
|
||||
if is_rider.is_some() {
|
||||
let idle_state = CharacterState::Idle(idle::Data { is_sneaking: false });
|
||||
// TODO: A better way to swap between mount inputs and rider
|
||||
// inputs if *join_struct.char_state !=
|
||||
// idle_state { *join_struct.char_state =
|
||||
// idle_state; }
|
||||
// continue;
|
||||
if is_rider.is_some() && !join_struct.char_state.can_perform_mounted() {
|
||||
// TODO: A better way to swap between mount inputs and rider inputs
|
||||
*join_struct.char_state = CharacterState::Idle(idle::Data { is_sneaking: false });
|
||||
continue;
|
||||
}
|
||||
|
||||
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)]
|
||||
|
||||
mod aura;
|
||||
|
@ -51,8 +51,14 @@ impl<'a> System<'a> for Sys {
|
||||
.retrieve_entity_internal(is_mount.rider.id())
|
||||
.and_then(|rider| {
|
||||
controllers
|
||||
.get(rider)
|
||||
.map(|c| (c.inputs.clone(), c.queued_inputs.clone(), rider))
|
||||
.get_mut(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 };
|
||||
|
||||
@ -72,11 +78,7 @@ impl<'a> System<'a> for Sys {
|
||||
if let Some(controller) = controllers.get_mut(entity) {
|
||||
*controller = Controller {
|
||||
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(),
|
||||
queued_inputs,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user