68 lines
2.1 KiB
Plaintext
68 lines
2.1 KiB
Plaintext
--@name BMW E30 interior 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/wwda7cpdsrlsotb/e30_idle.ogg",
|
|
rootPitch = 1000,
|
|
fadeIn = Vector(0, 1),
|
|
fadeOut = Vector(1000, 1500)
|
|
},
|
|
{
|
|
link = "https://dl.dropboxusercontent.com/s/5e9x082jdjgm2ym/e30_on_3500.ogg",
|
|
rootPitch = 3500,
|
|
fadeIn = Vector(1000, 1500),
|
|
fadeOut = Vector(3500, 4000)
|
|
},
|
|
{
|
|
link = "https://dl.dropboxusercontent.com/s/83c3v08sjut5a9o/e30_on_5000.ogg",
|
|
rootPitch = 5000,
|
|
fadeIn = Vector(3500, 4000),
|
|
fadeOut = Vector(5000, 5500)
|
|
},
|
|
{
|
|
link = "https://dl.dropboxusercontent.com/s/a6d3356uc7xstf1/e30_on_7000.ogg",
|
|
rootPitch = 7000,
|
|
fadeIn = Vector(5000, 5500),
|
|
fadeOut = Vector(7000, 7500)
|
|
},
|
|
{
|
|
link = "https://dl.dropboxusercontent.com/s/pwpuldfs6w93ezb/e30_on_8500.ogg",
|
|
rootPitch = 8500,
|
|
fadeIn = Vector(7000, 7500)
|
|
}
|
|
})
|
|
engineSound:setMasterVolume(0.8)
|
|
|
|
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 |