milo: sounds
This commit is contained in:
@@ -9,7 +9,9 @@ local os = _G.os
|
|||||||
local turtle = _G.turtle
|
local turtle = _G.turtle
|
||||||
|
|
||||||
local args = { ... }
|
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 = {
|
local Runners = {
|
||||||
Cow = true,
|
Cow = true,
|
||||||
@@ -94,7 +96,7 @@ end
|
|||||||
while true do
|
while true do
|
||||||
local blocks = sensor.sense()
|
local blocks = sensor.sense()
|
||||||
local mobs = Util.filterInplace(blocks, function(b)
|
local mobs = Util.filterInplace(blocks, function(b)
|
||||||
if b.name == mobType then
|
if mobTypes[b.name] then
|
||||||
normalize(b)
|
normalize(b)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ local fs = _G.fs
|
|||||||
local os = _G.os
|
local os = _G.os
|
||||||
local socket
|
local socket
|
||||||
|
|
||||||
|
local speaker = device.speaker
|
||||||
|
|
||||||
local SHIELD_SLOT = 2
|
local SHIELD_SLOT = 2
|
||||||
local STARTUP_FILE = 'usr/autorun/miloRemote.lua'
|
local STARTUP_FILE = 'usr/autorun/miloRemote.lua'
|
||||||
|
|
||||||
@@ -161,6 +163,12 @@ local page = UI.Page {
|
|||||||
items = { },
|
items = { },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local function playSound(sound)
|
||||||
|
if speaker then
|
||||||
|
speaker.playSound('minecraft:' .. sound)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function getPlayerName()
|
local function getPlayerName()
|
||||||
local neural = device.neuralInterface
|
local neural = device.neuralInterface
|
||||||
|
|
||||||
@@ -271,6 +279,7 @@ function page.grid:getDisplayValues(row)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function page:transfer(item, count, msg)
|
function page:transfer(item, count, msg)
|
||||||
|
playSound('block.metal.fall')
|
||||||
local response = self:sendRequest({ request = 'transfer', item = item, count = count }, msg)
|
local response = self:sendRequest({ request = 'transfer', item = item, count = count }, msg)
|
||||||
if response then
|
if response then
|
||||||
item.count = response.current - response.count
|
item.count = response.current - response.count
|
||||||
@@ -465,6 +474,7 @@ Event.addRoutine(function()
|
|||||||
key = table.concat({ item.name, item.damage, item.nbtHash }, ':')
|
key = table.concat({ item.name, item.damage, item.nbtHash }, ':')
|
||||||
})
|
})
|
||||||
if response then
|
if response then
|
||||||
|
playSound('block.lava.pop')
|
||||||
local ritem = page.items[response.key]
|
local ritem = page.items[response.key]
|
||||||
if ritem then
|
if ritem then
|
||||||
ritem.count = response.current + item.count
|
ritem.count = response.current + item.count
|
||||||
|
|||||||
Reference in New Issue
Block a user