66 lines
2.0 KiB
Plaintext
66 lines
2.0 KiB
Plaintext
--@name Abarth 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/b05fhpa6llc4sjj/ext_fa01_on_1500.ogg",
|
|
rootPitch = 1500,
|
|
fadeOut = Vector(1400, 1800)
|
|
},
|
|
{
|
|
link = "https://dl.dropboxusercontent.com/s/cus2007qr25nlqg/ext_fa01_on_4250.ogg",
|
|
rootPitch = 4250,
|
|
fadeIn = Vector(1400, 1800),
|
|
fadeOut = Vector(3400, 3800)
|
|
},
|
|
{
|
|
link = "https://dl.dropboxusercontent.com/s/ug9n6dtac1ayioi/ext_fa01_on_5250.ogg",
|
|
rootPitch = 5250,
|
|
fadeIn = Vector(3400, 3800),
|
|
fadeOut = Vector(4800, 5200)
|
|
},
|
|
{
|
|
link = "https://dl.dropboxusercontent.com/s/ihdefqw30pwd059/ext_fa01_on_6000.ogg",
|
|
rootPitch = 6000,
|
|
fadeIn = Vector(4800, 5200),
|
|
fadeOut = Vector(5600, 6000)
|
|
},
|
|
{
|
|
link = "https://dl.dropboxusercontent.com/s/7m98qruc8bhopyn/ext_fa01_on_6500.ogg",
|
|
rootPitch = 6500,
|
|
fadeIn = Vector(5600, 6000)
|
|
}
|
|
})
|
|
|
|
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 |