66 lines
2.0 KiB
Plaintext
66 lines
2.0 KiB
Plaintext
--@name BMW E30 exterior engine sound
|
|
--@shared
|
|
--@include /koptilnya/engine_sound.txt
|
|
|
|
require("/koptilnya/engine_sound.txt")
|
|
|
|
if SERVER then
|
|
wire.adjustInputs({"RPM"}, {"NORMAL"})
|
|
|
|
hook.add("input", "wireinput", function(name, value)
|
|
if name == "RPM" then
|
|
net.start("rpm")
|
|
net.writeFloat(value)
|
|
net.send()
|
|
end
|
|
end)
|
|
else
|
|
function init()
|
|
local engineSound = EngineSound:new({
|
|
{
|
|
link = "https://dl.dropboxusercontent.com/s/5lk7xkrrgozbgl2/ext_e30_idle.ogg",
|
|
rootPitch = 1000,
|
|
fadeOut = Vector(1000, 1500)
|
|
},
|
|
{
|
|
link = "https://dl.dropboxusercontent.com/s/oiz3ccf6cenul8t/ext_e30_on_2500.ogg",
|
|
rootPitch = 2500,
|
|
fadeIn = Vector(1000, 1500),
|
|
fadeOut = Vector(2500, 3000)
|
|
},
|
|
{
|
|
link = "https://dl.dropboxusercontent.com/s/346ly2b0ete839f/ext_e30_on_4500.ogg",
|
|
rootPitch = 4500,
|
|
fadeIn = Vector(2500, 3000),
|
|
fadeOut = Vector(4500, 5000)
|
|
},
|
|
{
|
|
link = "https://dl.dropboxusercontent.com/s/wlyeqqwhaqe8oo5/ext_e30_on_6000.ogg",
|
|
rootPitch = 6000,
|
|
fadeIn = Vector(4500, 5000),
|
|
fadeOut = Vector(6500, 7000)
|
|
},
|
|
{
|
|
link = "https://dl.dropboxusercontent.com/s/vijeiwwsgthlxzn/ext_e30_on_8500.ogg",
|
|
rootPitch = 8500,
|
|
fadeIn = Vector(6500, 7000)
|
|
}
|
|
})
|
|
|
|
net.receive("rpm", function(len)
|
|
engineSound:setRPM(net.readFloat())
|
|
end)
|
|
end
|
|
|
|
if hasPermission("bass.loadURL") then
|
|
init()
|
|
else
|
|
setupPermissionRequest({"bass.loadURL"}, "", true)
|
|
|
|
hook.add("permissionrequest", "permission", function()
|
|
if hasPermission("bass.loadURL") then
|
|
init()
|
|
end
|
|
end)
|
|
end
|
|
end |