mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Don't apply e2e pushback during a forced movement character state.
This commit is contained in:
parent
cf2bdb20f1
commit
d02ff2db20
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Added
|
### Added
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
- Entity-entity pushback is no longer applied in forced movement states like rolling and leaping.
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
@ -58,6 +58,7 @@
|
|||||||
"You can toggle showing your amount of health on the healthbar in the settings.",
|
"You can toggle showing your amount of health on the healthbar in the settings.",
|
||||||
"Sit near a campfire (with the 'K' key) to slowly recover from your injuries.",
|
"Sit near a campfire (with the 'K' key) to slowly recover from your injuries.",
|
||||||
"Need more bags or better armor to continue your journey? Press 'C' to open the crafting menu!",
|
"Need more bags or better armor to continue your journey? Press 'C' to open the crafting menu!",
|
||||||
|
"Try jumping when rolling through creatures.",
|
||||||
],
|
],
|
||||||
"npc.speech.villager": [
|
"npc.speech.villager": [
|
||||||
"Isn't it such a lovely day?",
|
"Isn't it such a lovely day?",
|
||||||
|
@ -2,7 +2,7 @@ use crate::{
|
|||||||
combat::Attack,
|
combat::Attack,
|
||||||
comp::{tool::ToolKind, Density, Energy, InputAttr, InputKind, Ori, Pos, Vel},
|
comp::{tool::ToolKind, Density, Energy, InputAttr, InputKind, Ori, Pos, Vel},
|
||||||
event::{LocalEvent, ServerEvent},
|
event::{LocalEvent, ServerEvent},
|
||||||
states::{behavior::JoinData, *},
|
states::{behavior::JoinData, utils::StageSection, *},
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use specs::{Component, DerefFlaggedStorage, VecStorage};
|
use specs::{Component, DerefFlaggedStorage, VecStorage};
|
||||||
@ -196,6 +196,15 @@ impl CharacterState {
|
|||||||
|
|
||||||
pub fn is_stunned(&self) -> bool { matches!(self, CharacterState::Stunned(_)) }
|
pub fn is_stunned(&self) -> bool { matches!(self, CharacterState::Stunned(_)) }
|
||||||
|
|
||||||
|
pub fn is_forced_movement(&self) -> bool {
|
||||||
|
matches!(self,
|
||||||
|
CharacterState::ComboMelee(s) if s.stage_section == StageSection::Swing)
|
||||||
|
|| matches!(self, CharacterState::DashMelee(s) if s.stage_section == StageSection::Charge)
|
||||||
|
|| matches!(self, CharacterState::LeapMelee(s) if s.stage_section == StageSection::Movement)
|
||||||
|
|| matches!(self, CharacterState::SpinMelee(s) if s.stage_section == StageSection::Swing)
|
||||||
|
|| matches!(self, CharacterState::Roll(s) if s.stage_section == StageSection::Movement)
|
||||||
|
}
|
||||||
|
|
||||||
/// Compares for shallow equality (does not check internal struct equality)
|
/// Compares for shallow equality (does not check internal struct equality)
|
||||||
pub fn same_variant(&self, other: &Self) -> bool {
|
pub fn same_variant(&self, other: &Self) -> bool {
|
||||||
// Check if state is the same without looking at the inner data
|
// Check if state is the same without looking at the inner data
|
||||||
|
@ -333,6 +333,21 @@ impl<'a> PhysicsData<'a> {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't apply e2e pushback to entities that are in a forced movement state
|
||||||
|
// (e.g. roll, leapmelee). This allows leaps to work properly (since you won't
|
||||||
|
// get pushed away before delivering the hit), and allows rolling through an
|
||||||
|
// enemy when trapped (e.g. with minotaur). This allows using e2e pushback to
|
||||||
|
// gain speed by jumping out of a roll while in the middle of a collider, this
|
||||||
|
// is an intentional combat mechanic.
|
||||||
|
if let Some(cs) = char_state_maybe {
|
||||||
|
if cs.is_forced_movement() {
|
||||||
|
return PhysicsMetrics {
|
||||||
|
entity_entity_collision_checks,
|
||||||
|
entity_entity_collisions,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let z_limits = calc_z_limit(char_state_maybe, collider);
|
let z_limits = calc_z_limit(char_state_maybe, collider);
|
||||||
|
|
||||||
// Resets touch_entities in physics
|
// Resets touch_entities in physics
|
||||||
|
Loading…
Reference in New Issue
Block a user