mirror of
https://github.com/kepler155c/opus
synced 2024-12-28 17:40:26 +00:00
sounds
This commit is contained in:
parent
a0d47a5f1a
commit
eb799004f8
@ -81,7 +81,8 @@ local function loopback(port, sport, msg)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function newSocket(isLoopback)
|
local function newSocket(isLoopback)
|
||||||
for i = 16384, 32767 do
|
for _ = 16384, 32767 do
|
||||||
|
local i = math.random(16384, 32767)
|
||||||
if not device.wireless_modem.isOpen(i) then
|
if not device.wireless_modem.isOpen(i) then
|
||||||
local socket = {
|
local socket = {
|
||||||
shost = os.getComputerID(),
|
shost = os.getComputerID(),
|
||||||
|
12
sys/apis/sound.lua
Normal file
12
sys/apis/sound.lua
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
local peripheral = _G.peripheral
|
||||||
|
local speaker = peripheral.find('speaker')
|
||||||
|
|
||||||
|
local Sound = { }
|
||||||
|
|
||||||
|
function Sound.play(sound, vol)
|
||||||
|
if speaker then
|
||||||
|
speaker.playSound('minecraft:' .. sound, vol or 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return Sound
|
@ -3,6 +3,7 @@ local class = require('class')
|
|||||||
local Event = require('event')
|
local Event = require('event')
|
||||||
local Input = require('input')
|
local Input = require('input')
|
||||||
local Peripheral = require('peripheral')
|
local Peripheral = require('peripheral')
|
||||||
|
local Sound = require('sound')
|
||||||
local Transition = require('ui.transition')
|
local Transition = require('ui.transition')
|
||||||
local Util = require('util')
|
local Util = require('util')
|
||||||
|
|
||||||
@ -2542,6 +2543,7 @@ end
|
|||||||
|
|
||||||
function UI.Notification:error(value, timeout)
|
function UI.Notification:error(value, timeout)
|
||||||
self.backgroundColor = colors.red
|
self.backgroundColor = colors.red
|
||||||
|
Sound.play('entity.villager.no', .5)
|
||||||
self:display(value, timeout)
|
self:display(value, timeout)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user