Move force-movement e2e check so that it doesn't confer immunity to arrows.

This commit is contained in:
Avi Weinstock 2021-06-13 20:38:03 -04:00
parent d02ff2db20
commit 1af9ac568f

View File

@ -333,21 +333,6 @@ 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
@ -440,16 +425,21 @@ impl<'a> PhysicsData<'a> {
entity_entity_collisions += 1; entity_entity_collisions += 1;
} }
// Don't apply repulsive force to projectiles or if // Don't apply e2e pushback to entities that are in a forced movement state
// we're // (e.g. roll, leapmelee). This allows leaps to work properly (since you won't
// colliding // get pushed away before delivering the hit), and allows rolling through an
// with a terrain-like entity, or if we are a // enemy when trapped (e.g. with minotaur). This allows using e2e pushback to
// terrain-like // gain speed by jumping out of a roll while in the middle of a collider, this
// entity // is an intentional combat mechanic.
let forced_movement = matches!(char_state_maybe, Some(cs) if cs.is_forced_movement());
// Don't apply repulsive force to projectiles or if we're colliding with a
// terrain-like entity, or if we are a terrain-like entity
// //
// Don't apply force when entity is a sticky which is on the // Don't apply force when entity is a sticky which is on the
// ground (or on the wall) // ground (or on the wall)
if !(is_sticky && !is_mid_air) if !forced_movement &&
!(is_sticky && !is_mid_air)
&& diff.magnitude_squared() > 0.0 && diff.magnitude_squared() > 0.0
&& !is_projectile && !is_projectile
&& !matches!( && !matches!(