mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 15:02:52 -05:00
Merge pull request #1226 from towerofnix/costumename-vm
Implement "costume name" block
This commit is contained in:
commit
b4891bb0d5
3 changed files with 13 additions and 2 deletions
|
@ -954,6 +954,12 @@ const parseBlock = function (sb2block, addBroadcastMsg, getVariableId, extension
|
||||||
value: 'number'
|
value: 'number'
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
|
case 'costumeName':
|
||||||
|
activeBlock.fields.NUMBER_NAME = {
|
||||||
|
name: 'NUMBER_NAME',
|
||||||
|
value: 'name'
|
||||||
|
};
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special cases to generate mutations.
|
// Special cases to generate mutations.
|
||||||
|
|
|
@ -428,6 +428,11 @@ const specMap = {
|
||||||
argMap: [
|
argMap: [
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
'costumeName': {
|
||||||
|
opcode: 'looks_costumenumbername',
|
||||||
|
argMap: [
|
||||||
|
]
|
||||||
|
},
|
||||||
'sceneName': {
|
'sceneName': {
|
||||||
opcode: 'looks_backdropnumbername',
|
opcode: 'looks_backdropnumbername',
|
||||||
argMap: [
|
argMap: [
|
||||||
|
|
|
@ -34,8 +34,8 @@ test('getCostumeNumberName returns 1-indexed costume number', t => {
|
||||||
test('getCostumeNumberName can return costume name', t => {
|
test('getCostumeNumberName can return costume name', t => {
|
||||||
util.target.currentCostume = 0; // This is 0-indexed.
|
util.target.currentCostume = 0; // This is 0-indexed.
|
||||||
const args = {NUMBER_NAME: 'name'};
|
const args = {NUMBER_NAME: 'name'};
|
||||||
const number = blocks.getCostumeNumberName(args, util);
|
const name = blocks.getCostumeNumberName(args, util);
|
||||||
t.strictEqual(number, 'first name');
|
t.strictEqual(name, 'first name');
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue