milo: sounds
This commit is contained in:
@@ -9,7 +9,9 @@ local os = _G.os
|
||||
local turtle = _G.turtle
|
||||
|
||||
local args = { ... }
|
||||
local mobType = args[1] or error('Syntax: attack <mob name>')
|
||||
local mobType = args[1] or error('Syntax: attack <mob names>')
|
||||
|
||||
local mobTypes = Util.transpose(args)
|
||||
|
||||
local Runners = {
|
||||
Cow = true,
|
||||
@@ -94,7 +96,7 @@ end
|
||||
while true do
|
||||
local blocks = sensor.sense()
|
||||
local mobs = Util.filterInplace(blocks, function(b)
|
||||
if b.name == mobType then
|
||||
if mobTypes[b.name] then
|
||||
normalize(b)
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user