mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -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'
|
||||
};
|
||||
break;
|
||||
case 'costumeName':
|
||||
activeBlock.fields.NUMBER_NAME = {
|
||||
name: 'NUMBER_NAME',
|
||||
value: 'name'
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
||||
// Special cases to generate mutations.
|
||||
|
|
|
@ -428,6 +428,11 @@ const specMap = {
|
|||
argMap: [
|
||||
]
|
||||
},
|
||||
'costumeName': {
|
||||
opcode: 'looks_costumenumbername',
|
||||
argMap: [
|
||||
]
|
||||
},
|
||||
'sceneName': {
|
||||
opcode: 'looks_backdropnumbername',
|
||||
argMap: [
|
||||
|
|
|
@ -34,8 +34,8 @@ test('getCostumeNumberName returns 1-indexed costume number', t => {
|
|||
test('getCostumeNumberName can return costume name', t => {
|
||||
util.target.currentCostume = 0; // This is 0-indexed.
|
||||
const args = {NUMBER_NAME: 'name'};
|
||||
const number = blocks.getCostumeNumberName(args, util);
|
||||
t.strictEqual(number, 'first name');
|
||||
const name = blocks.getCostumeNumberName(args, util);
|
||||
t.strictEqual(name, 'first name');
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue