1
0
mirror of https://github.com/kepler155c/opus synced 2024-06-14 09:26:54 +00:00
opus/sys/modules/opus/sound.lua
2019-06-28 13:50:02 -04:00

18 lines
314 B
Lua

local peripheral = _G.peripheral
local Sound = {
_volume = 1,
}
function Sound.play(sound, vol)
peripheral.find('speaker', function(_, s)
s.playSound('minecraft:' .. sound, vol or Sound._volume)
end)
end
function Sound.setVolume(volume)
Sound._volume = math.max(0, math.min(volume, 1))
end
return Sound