diff --git a/bubble.go b/bubble.go index 12f9280..53286f7 100644 --- a/bubble.go +++ b/bubble.go @@ -64,7 +64,7 @@ func (s *Simulator) applyBubbleColumns(state *MovementState) { } func (s *Simulator) attemptRiptide(state *MovementState, touchingWater bool) bool { - if s.Equipment == nil || state.RiptideTicks > 0 || !state.RiptideReady || (!touchingWater && !state.RiptideInRain) { + if s.Equipment == nil || state.InVehicle || state.RiptideTicks > 0 || !state.RiptideReady || (!touchingWater && !state.RiptideInRain) { return false } level := s.Equipment.EnchantmentLevel(EnchantmentRiptide) diff --git a/bubble_test.go b/bubble_test.go index b057f22..a2b72b1 100644 --- a/bubble_test.go +++ b/bubble_test.go @@ -125,6 +125,22 @@ func TestRiptideDoesNotLaunchWhileFlying(t *testing.T) { } } +func TestRiptideDoesNotLaunchWhileMounted(t *testing.T) { + w := environmentWorld{blocks: map[cube.Pos]world.Block{{0, 0, 0}: block.Water{Still: true, Depth: 8}}} + sim := &Simulator{World: w, Equipment: fixedEquipment{EnchantmentRiptide: 2}} + state := newBaseState() + state.Pos = mgl32.Vec3{0.5, 0, 0.5} + state.Gravity = NormalGravity + state.InVehicle = true + state.RiptideReady = true + + sim.Simulate(state, InputState{StartSpinAttack: true}) + + if state.RiptideTicks != 0 { + t.Fatalf("expected mounted player not to start riptide, got %d ticks", state.RiptideTicks) + } +} + func TestRiptideRequiresValidatedTridentRelease(t *testing.T) { w := environmentWorld{blocks: map[cube.Pos]world.Block{{0, 0, 0}: block.Water{Still: true, Depth: 8}}} sim := &Simulator{World: w, Equipment: fixedEquipment{EnchantmentRiptide: 2}} diff --git a/movement.go b/movement.go index 779ffa6..1237a82 100644 --- a/movement.go +++ b/movement.go @@ -114,6 +114,9 @@ type MovementState struct { // RiptideInRain is server-observed weather exposure that permits a // validated Riptide release without direct block-water contact. RiptideInRain bool + // InVehicle is server-authoritative mounted state. Riptide cannot start + // while the player is riding a vehicle. + InVehicle bool Flying, MayFly, TrustFlyStatus bool JustDisabledFlight bool