Skip to content

Commit

Permalink
fix car tyre and wind sounds not plaing while going backwards
Browse files Browse the repository at this point in the history
  • Loading branch information
Elkien3 committed Sep 8, 2020
1 parent 1ab6ae3 commit 8a0167b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mods/cars/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -486,22 +486,22 @@ local function car_step(self, dtime)
end
self.timer2 = self.timer2 + dtime
if self.timer2 > 1.5-self.v/max_speed*1.1 then
if math.abs(self.v) > .2 then
if abs_v > .2 then
if math.abs(velocity.y) < .1 then
self.wheelsound = minetest.sound_play("tyresound", {
max_hear_distance = 48,
object = self.object,
pitch = 1 + (self.v/max_speed)*.6,
gain = .5 + (self.v/max_speed)*2
pitch = 1 + (abs_v/max_speed)*.6,
gain = .5 + (abs_v/max_speed)*2
})
elseif self.windsound then
minetest.sound_fade(self.windsound, 30, 0)
end
self.windsound = minetest.sound_play("wind", {
max_hear_distance = 10,
object = self.object,
pitch = 1 + (self.v/max_speed)*.6,
gain = 0 + (self.v/max_speed)*4
pitch = 1 + (abs_v/max_speed)*.6,
gain = 0 + (abs_v/max_speed)*4
})
end
self.timer2 = 0
Expand Down

0 comments on commit 8a0167b

Please sign in to comment.