From 231402fc534854893ebb54390d48270947538463 Mon Sep 17 00:00:00 2001 From: Florrie Date: Mon, 30 Apr 2018 21:03:35 -0300 Subject: [PATCH 1/4] Implement 'hide all sprites' and 'user id' blocks --- src/blocks/scratch3_looks.js | 3 +++ src/blocks/scratch3_sensing.js | 5 ++++- src/serialization/sb2_specmap.js | 10 ++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/blocks/scratch3_looks.js b/src/blocks/scratch3_looks.js index c676aaa5c..1fd6f588a 100644 --- a/src/blocks/scratch3_looks.js +++ b/src/blocks/scratch3_looks.js @@ -244,6 +244,7 @@ class Scratch3LooksBlocks { looks_thinkforsecs: this.thinkforsecs, looks_show: this.show, looks_hide: this.hide, + looks_hideallsprites: this.doNothing, looks_switchcostumeto: this.switchCostume, looks_switchbackdropto: this.switchBackdrop, looks_switchbackdroptoandwait: this.switchBackdropAndWait, @@ -479,6 +480,8 @@ class Scratch3LooksBlocks { // Else return name return util.target.getCostumes()[util.target.currentCostume].name; } + + doNothing() {} } module.exports = Scratch3LooksBlocks; diff --git a/src/blocks/scratch3_sensing.js b/src/blocks/scratch3_sensing.js index bb3145971..08e30cdc8 100644 --- a/src/blocks/scratch3_sensing.js +++ b/src/blocks/scratch3_sensing.js @@ -66,7 +66,8 @@ class Scratch3SensingBlocks { sensing_dayssince2000: this.daysSince2000, sensing_loudness: this.getLoudness, sensing_askandwait: this.askAndWait, - sensing_answer: this.getAnswer + sensing_answer: this.getAnswer, + sensing_userid: this.doNothing }; } @@ -293,6 +294,8 @@ class Scratch3SensingBlocks { // Otherwise, 0 return 0; } + + doNothing() {} } module.exports = Scratch3SensingBlocks; diff --git a/src/serialization/sb2_specmap.js b/src/serialization/sb2_specmap.js index ff5ddd812..24f5d8618 100644 --- a/src/serialization/sb2_specmap.js +++ b/src/serialization/sb2_specmap.js @@ -266,6 +266,11 @@ const specMap = { argMap: [ ] }, + 'hideAll': { + opcode: 'looks_hideallsprites', + argMap: [ + ] + }, 'lookLike:': { opcode: 'looks_switchcostumeto', argMap: [ @@ -1043,6 +1048,11 @@ const specMap = { argMap: [ ] }, + 'getUserId': { + opcode: 'sensing_userid', + argMap: [ + ] + }, '+': { opcode: 'operator_add', argMap: [ From fe13f30037808ee8dcfb9374abdb8f6c86edf98e Mon Sep 17 00:00:00 2001 From: Florrie Date: Mon, 30 Apr 2018 21:04:50 -0300 Subject: [PATCH 2/4] Lint --- src/blocks/scratch3_looks.js | 2 +- src/blocks/scratch3_sensing.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/blocks/scratch3_looks.js b/src/blocks/scratch3_looks.js index 1fd6f588a..37542aaf3 100644 --- a/src/blocks/scratch3_looks.js +++ b/src/blocks/scratch3_looks.js @@ -481,7 +481,7 @@ class Scratch3LooksBlocks { return util.target.getCostumes()[util.target.currentCostume].name; } - doNothing() {} + doNothing () {} } module.exports = Scratch3LooksBlocks; diff --git a/src/blocks/scratch3_sensing.js b/src/blocks/scratch3_sensing.js index 08e30cdc8..73e4ea7a9 100644 --- a/src/blocks/scratch3_sensing.js +++ b/src/blocks/scratch3_sensing.js @@ -295,7 +295,7 @@ class Scratch3SensingBlocks { return 0; } - doNothing() {} + doNothing () {} } module.exports = Scratch3SensingBlocks; From 8c2d023925730ac00779a4a6a31c2684a757790f Mon Sep 17 00:00:00 2001 From: Florrie Date: Mon, 30 Apr 2018 21:29:34 -0300 Subject: [PATCH 3/4] Implement set/change stretch blocks --- src/blocks/scratch3_looks.js | 2 ++ src/serialization/sb2_specmap.js | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/blocks/scratch3_looks.js b/src/blocks/scratch3_looks.js index 37542aaf3..93226aee1 100644 --- a/src/blocks/scratch3_looks.js +++ b/src/blocks/scratch3_looks.js @@ -255,6 +255,8 @@ class Scratch3LooksBlocks { looks_cleargraphiceffects: this.clearEffects, looks_changesizeby: this.changeSize, looks_setsizeto: this.setSize, + looks_changestretchby: this.doNothing, + looks_setstretchto: this.doNothing, looks_gotofrontback: this.goToFrontBack, looks_goforwardbackwardlayers: this.goForwardBackwardLayers, looks_size: this.getSize, diff --git a/src/serialization/sb2_specmap.js b/src/serialization/sb2_specmap.js index 24f5d8618..b0c004273 100644 --- a/src/serialization/sb2_specmap.js +++ b/src/serialization/sb2_specmap.js @@ -349,6 +349,26 @@ const specMap = { } ] }, + 'changeStretchBy:': { + opcode: 'looks_changestretchby', + argMap: [ + { + type: 'input', + inputOp: 'math_number', + inputName: 'CHANGE' + } + ] + }, + 'setStretchTo:': { + opcode: 'looks_setstretchto', + argMap: [ + { + type: 'input', + inputOp: 'math_number', + inputName: 'STRETCH' + } + ] + }, 'comeToFront': { opcode: 'looks_gotofrontback', argMap: [ From 97a9b378438eb1fb9d1d9feed3dad353c3f2aca2 Mon Sep 17 00:00:00 2001 From: Florrie Date: Tue, 1 May 2018 13:58:09 -0300 Subject: [PATCH 4/4] Remove doNothing methods --- src/blocks/scratch3_looks.js | 8 +++----- src/blocks/scratch3_sensing.js | 4 +--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/blocks/scratch3_looks.js b/src/blocks/scratch3_looks.js index 93226aee1..aaaad388d 100644 --- a/src/blocks/scratch3_looks.js +++ b/src/blocks/scratch3_looks.js @@ -244,7 +244,7 @@ class Scratch3LooksBlocks { looks_thinkforsecs: this.thinkforsecs, looks_show: this.show, looks_hide: this.hide, - looks_hideallsprites: this.doNothing, + looks_hideallsprites: () => {}, // legacy no-op block looks_switchcostumeto: this.switchCostume, looks_switchbackdropto: this.switchBackdrop, looks_switchbackdroptoandwait: this.switchBackdropAndWait, @@ -255,8 +255,8 @@ class Scratch3LooksBlocks { looks_cleargraphiceffects: this.clearEffects, looks_changesizeby: this.changeSize, looks_setsizeto: this.setSize, - looks_changestretchby: this.doNothing, - looks_setstretchto: this.doNothing, + looks_changestretchby: () => {}, // legacy no-op blocks + looks_setstretchto: () => {}, looks_gotofrontback: this.goToFrontBack, looks_goforwardbackwardlayers: this.goForwardBackwardLayers, looks_size: this.getSize, @@ -482,8 +482,6 @@ class Scratch3LooksBlocks { // Else return name return util.target.getCostumes()[util.target.currentCostume].name; } - - doNothing () {} } module.exports = Scratch3LooksBlocks; diff --git a/src/blocks/scratch3_sensing.js b/src/blocks/scratch3_sensing.js index 73e4ea7a9..927dff967 100644 --- a/src/blocks/scratch3_sensing.js +++ b/src/blocks/scratch3_sensing.js @@ -67,7 +67,7 @@ class Scratch3SensingBlocks { sensing_loudness: this.getLoudness, sensing_askandwait: this.askAndWait, sensing_answer: this.getAnswer, - sensing_userid: this.doNothing + sensing_userid: () => {} // legacy no-op block }; } @@ -294,8 +294,6 @@ class Scratch3SensingBlocks { // Otherwise, 0 return 0; } - - doNothing () {} } module.exports = Scratch3SensingBlocks;