mirror of
https://github.com/horizon-rust/horizon.git
synced 2026-11-07 11:06:11 -10:00
A camel's pending dash waits for the ground instead of being dropped
AbstractHorse keeps a pending jump until the mount is on the ground (and not still jumping); only Camel.onPlayerJump refuses it at the start (cooling down or off the ground). Horizon cleared the rider's pending jump on every tick, dash or not, so a release on a tick the camel was not on the ground (a bounce after landing, a slope) dashed sometimes and not other times. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
1 parent
975c07d915
commit
5fe9fc298f
2 files changed
+14
-6
No files matched your search
@@ -399,10 +399,16 @@ fn animation_states(m: &mut Mob, pose_time: i64, sitting: bool) {
|
||||
st[2].animate_when(transition, age);
|
||||
}
|
||||
}
|
||||
/// `Camel.executeRidersJump`: the dash along the look, once cooled down.
|
||||
pub fn dash(m: &mut Mob, amount: f32, events: &mut Vec<MobEvent>) {
|
||||
if m.extra.anim_ticks > 0 || !m.on_ground || refuse_to_move(m) {
|
||||
return;
|
||||
/// `Camel.executeRidersJump`: the dash along the look, once cooled down. Returns whether the
|
||||
/// jump is used up: it is, by a dash or when the camel cannot dash at all (cooling down,
|
||||
/// refusing to move: `onPlayerJump` would not have taken it); it waits while the camel is off
|
||||
/// the ground (`AbstractHorse.tickRidden` runs a pending jump when it lands).
|
||||
pub fn dash(m: &mut Mob, amount: f32, events: &mut Vec<MobEvent>) -> bool {
|
||||
if m.extra.anim_ticks > 0 || refuse_to_move(m) {
|
||||
return true;
|
||||
}
|
||||
if !m.on_ground {
|
||||
return false;
|
||||
}
|
||||
let yaw = m.yaw.to_radians();
|
||||
let (dx, dz) = (f64::from(-yaw.msin()), f64::from(yaw.mcos()));
|
||||
@@ -414,6 +420,7 @@ pub fn dash(m: &mut Mob, amount: f32, events: &mut Vec<MobEvent>) {
|
||||
m.extra.anim_ticks = DASH_COOLDOWN;
|
||||
m.extra.flag2 = true;
|
||||
sound(m, voice(m, 3), events);
|
||||
true
|
||||
}
|
||||
/// `CamelModel.setupAnim`.
|
||||
pub fn anim(
|
||||
|
||||
@@ -643,8 +643,9 @@ pub fn ridden_step(m: &mut Mob) {
|
||||
m.ai.zza = forward;
|
||||
if r.jump > 0.0 {
|
||||
let mut ev = Vec::new();
|
||||
super::camel::dash(m, r.jump, &mut ev);
|
||||
if let Some(rider) = m.rider.as_mut() {
|
||||
if super::camel::dash(m, r.jump, &mut ev)
|
||||
&& let Some(rider) = m.rider.as_mut()
|
||||
{
|
||||
rider.jump = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user