mirror of
				https://github.com/kepler155c/opus
				synced 2025-10-31 07:33:00 +00:00 
			
		
		
		
	sounds
This commit is contained in:
		| @@ -81,7 +81,8 @@ local function loopback(port, sport, msg) | ||||
| end | ||||
|  | ||||
| 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 | ||||
| 			local socket = { | ||||
| 				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 Input      = require('input') | ||||
| local Peripheral = require('peripheral') | ||||
| local Sound      = require('sound') | ||||
| local Transition = require('ui.transition') | ||||
| local Util       = require('util') | ||||
|  | ||||
| @@ -2542,6 +2543,7 @@ end | ||||
|  | ||||
| function UI.Notification:error(value, timeout) | ||||
| 	self.backgroundColor = colors.red | ||||
| 	Sound.play('entity.villager.no', .5) | ||||
| 	self:display(value, timeout) | ||||
| end | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 kepler155c@gmail.com
					kepler155c@gmail.com