milo: sounds

This commit is contained in:
kepler155c
2018-11-26 17:10:39 -05:00
parent 427006d2cb
commit 4833f7f12b
2 changed files with 14 additions and 2 deletions

View File

@@ -13,6 +13,8 @@ local fs = _G.fs
local os = _G.os
local socket
local speaker = device.speaker
local SHIELD_SLOT = 2
local STARTUP_FILE = 'usr/autorun/miloRemote.lua'
@@ -161,6 +163,12 @@ local page = UI.Page {
items = { },
}
local function playSound(sound)
if speaker then
speaker.playSound('minecraft:' .. sound)
end
end
local function getPlayerName()
local neural = device.neuralInterface
@@ -271,6 +279,7 @@ function page.grid:getDisplayValues(row)
end
function page:transfer(item, count, msg)
playSound('block.metal.fall')
local response = self:sendRequest({ request = 'transfer', item = item, count = count }, msg)
if response then
item.count = response.current - response.count
@@ -465,6 +474,7 @@ Event.addRoutine(function()
key = table.concat({ item.name, item.damage, item.nbtHash }, ':')
})
if response then
playSound('block.lava.pop')
local ritem = page.items[response.key]
if ritem then
ritem.count = response.current + item.count