diff --git a/LICENSE b/LICENSE index 851aa23..4c262d0 100644 --- a/LICENSE +++ b/LICENSE @@ -15,3 +15,6 @@ All other colours are edits of motorbike_blue.png by Melkor motorbike_wheel_inv.png motorbike_(colour)_imv.png (Render of Melkors bike) motorbike_biker.b3d (Edited version of minetest player model from 3d_armor) + +Alexander (CC BY-NC 4.0) +Harley Davidson Motorcycle Slow Pass By > motoengine.ogg \ No newline at end of file diff --git a/functions.lua b/functions.lua index b846309..3aded47 100644 --- a/functions.lua +++ b/functions.lua @@ -391,6 +391,49 @@ function biker.drive(entity, dtime) entity.object:setvelocity(new_velo) entity.object:setacceleration(new_acce) entity.lastv = entity.object:getvelocity() + + --sound + if entity.v > 0 and entity.driver ~= nil then + entity.timer1 = entity.timer1 + dtime + if entity.timer1 > .1 then + local rpm = 1 + if entity.v > 7 then + rpm = entity.v/7+.4 + elseif entity.v > 3 then + rpm = entity.v/3+.3 + else + rpm = entity.v/3+.2 + end + minetest.sound_play("motoengine", { + max_hear_distance = 48, + pitch = rpm+.1, + object = entity.object + }) + entity.timer1 = 0 + end + end + entity.timer2 = entity.timer2 + dtime + if entity.timer2 > 1.5-entity.v/max_spd*1.1 then + if math.abs(entity.v) > .2 then + if math.abs(velo.y) < .1 then + entity.wheelsound = minetest.sound_play("tyresound", { + max_hear_distance = 48, + object = entity.object, + pitch = 1.1 + (entity.v/max_spd)*.6, + gain = .5 + (entity.v/max_spd)*2 + }) + elseif entity.windsound then + minetest.sound_fade(entity.windsound, 30, 0) + end + entity.windsound = minetest.sound_play("wind", { + max_hear_distance = 10, + object = entity.object, + pitch = 1 + (entity.v/max_spd)*.6, + gain = 0 + (entity.v/max_spd)*4 + }) + end + entity.timer2 = 0 + end end minetest.register_on_leaveplayer(function(player) diff --git a/sounds/motoengine.ogg b/sounds/motoengine.ogg new file mode 100644 index 0000000..0524876 Binary files /dev/null and b/sounds/motoengine.ogg differ diff --git a/sounds/tyresound.ogg b/sounds/tyresound.ogg new file mode 100644 index 0000000..d35534f Binary files /dev/null and b/sounds/tyresound.ogg differ diff --git a/sounds/wind.ogg b/sounds/wind.ogg new file mode 100644 index 0000000..51f7a33 Binary files /dev/null and b/sounds/wind.ogg differ