spaces->tab, equipper improvements, supertreefarm rewrite, follow improvements, sensor cleanup, milo multiple items allowed in recipes, remote canvas access
This commit is contained in:
@@ -8,66 +8,66 @@ local context = Milo:getContext()
|
||||
|
||||
local speakerNode = context.storage:getSingleNode('speaker')
|
||||
if speakerNode then
|
||||
Sound.setVolume(speakerNode.volume)
|
||||
Sound.setVolume(speakerNode.volume)
|
||||
end
|
||||
|
||||
local wizardPage = UI.WizardPage {
|
||||
title = 'Speaker',
|
||||
index = 2,
|
||||
backgroundColor = colors.cyan,
|
||||
[1] = UI.Text {
|
||||
x = 2, y = 2,
|
||||
textColor = colors.yellow,
|
||||
value = 'Set the volume for sound effects',
|
||||
},
|
||||
form = UI.Form {
|
||||
x = 2, ex = -2, y = 3, ey = -2,
|
||||
manualControls = true,
|
||||
volume = UI.TextEntry {
|
||||
formLabel = 'Volume', formKey = 'volume',
|
||||
width = 5, limit = 3,
|
||||
validate = 'numeric',
|
||||
help = 'A value from 0 (mute) to 1 (loud)',
|
||||
},
|
||||
testSound = UI.Button {
|
||||
x = 15, y = 2,
|
||||
text = 'Test', event = 'test_sound',
|
||||
help = 'Test sound volume',
|
||||
},
|
||||
},
|
||||
title = 'Speaker',
|
||||
index = 2,
|
||||
backgroundColor = colors.cyan,
|
||||
[1] = UI.Text {
|
||||
x = 2, y = 2,
|
||||
textColor = colors.yellow,
|
||||
value = 'Set the volume for sound effects',
|
||||
},
|
||||
form = UI.Form {
|
||||
x = 2, ex = -2, y = 3, ey = -2,
|
||||
manualControls = true,
|
||||
volume = UI.TextEntry {
|
||||
formLabel = 'Volume', formKey = 'volume',
|
||||
width = 5, limit = 3,
|
||||
validate = 'numeric',
|
||||
help = 'A value from 0 (mute) to 1 (loud)',
|
||||
},
|
||||
testSound = UI.Button {
|
||||
x = 15, y = 2,
|
||||
text = 'Test', event = 'test_sound',
|
||||
help = 'Test sound volume',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
function wizardPage:setNode(node)
|
||||
self.form:setValues(node)
|
||||
self.form:setValues(node)
|
||||
end
|
||||
|
||||
function wizardPage:saveNode(node)
|
||||
Sound.setVolume(node.volume)
|
||||
Sound.setVolume(node.volume)
|
||||
end
|
||||
|
||||
function wizardPage:validate()
|
||||
return self.form:save()
|
||||
return self.form:save()
|
||||
end
|
||||
|
||||
function wizardPage:isValidType(node)
|
||||
local m = device[node.name]
|
||||
return m and m.type == 'speaker' and {
|
||||
name = 'Speaker',
|
||||
value = 'speaker',
|
||||
category = 'custom',
|
||||
help = 'Sound effects',
|
||||
}
|
||||
local m = device[node.name]
|
||||
return m and m.type == 'speaker' and {
|
||||
name = 'Speaker',
|
||||
value = 'speaker',
|
||||
category = 'custom',
|
||||
help = 'Sound effects',
|
||||
}
|
||||
end
|
||||
|
||||
function wizardPage:isValidFor(node)
|
||||
return node.mtype == 'speaker'
|
||||
return node.mtype == 'speaker'
|
||||
end
|
||||
|
||||
function wizardPage:eventHandler(event)
|
||||
if event.type == 'test_sound' then
|
||||
local vol = tonumber(self.form.volume.value)
|
||||
Sound.play('entity.item.pickup', vol)
|
||||
end
|
||||
if event.type == 'test_sound' then
|
||||
local vol = tonumber(self.form.volume.value)
|
||||
Sound.play('entity.item.pickup', vol)
|
||||
end
|
||||
end
|
||||
|
||||
UI:getPage('nodeWizard').wizard:add({ speaker = wizardPage })
|
||||
|
||||
Reference in New Issue
Block a user