Use videoSensing extension for sb2 senseVideoMotion

This commit is contained in:
Michael "Z" Goddard 2018-03-26 15:32:05 -04:00
parent c206dc3241
commit f3d19dc1a1
No known key found for this signature in database
GPG key ID: 762CD40DD5349872
2 changed files with 46 additions and 15 deletions

View file

@ -562,6 +562,22 @@ const parseBlock = function (sb2block, addBroadcastMsg, getVariableId, extension
if (shadowObscured) { if (shadowObscured) {
fieldValue = 1; fieldValue = 1;
} }
} else if (expectedArg.inputOp === 'videoSensing.menu.MOTION_DIRECTION') {
if (shadowObscured) {
fieldValue = 1;
} else if (fieldValue === 'motion') {
fieldValue = 1;
} else if (fieldValue === 'direction') {
fieldValue = 2;
}
} else if (expectedArg.inputOp === 'videoSensing.menu.STAGE_SPRITE') {
if (shadowObscured) {
fieldValue = 2;
} else if (fieldValue === 'Stage') {
fieldValue = 1;
} else if (fieldValue === 'this sprite') {
fieldValue = 2;
}
} else if (shadowObscured) { } else if (shadowObscured) {
// Filled drop-down menu. // Filled drop-down menu.
fieldValue = ''; fieldValue = '';

View file

@ -609,6 +609,21 @@ const specMap = {
} }
] ]
}, },
'senseVideoMotion': {
opcode: 'videoSensing.videoOn',
argMap: [
{
type: 'input',
inputOp: 'videoSensing.menu.MOTION_DIRECTION',
inputName: 'MOTION_DIRECTION'
},
{
type: 'input',
inputOp: 'videoSensing.menu.STAGE_SPRITE',
inputName: 'STAGE_SPRITE'
}
]
},
'whenGreenFlag': { 'whenGreenFlag': {
opcode: 'event_whenflagclicked', opcode: 'event_whenflagclicked',
argMap: [ argMap: [
@ -905,21 +920,21 @@ const specMap = {
argMap: [ argMap: [
] ]
}, },
'senseVideoMotion': { // 'senseVideoMotion': {
opcode: 'sensing_videoon', // opcode: 'sensing_videoon',
argMap: [ // argMap: [
{ // {
type: 'input', // type: 'input',
inputOp: 'sensing_videoonmenuone', // inputOp: 'sensing_videoonmenuone',
inputName: 'VIDEOONMENU1' // inputName: 'VIDEOONMENU1'
}, // },
{ // {
type: 'input', // type: 'input',
inputOp: 'sensing_videoonmenutwo', // inputOp: 'sensing_videoonmenutwo',
inputName: 'VIDEOONMENU2' // inputName: 'VIDEOONMENU2'
} // }
] // ]
}, // },
'setVideoState': { 'setVideoState': {
opcode: 'sensing_videotoggle', opcode: 'sensing_videotoggle',
argMap: [ argMap: [