From 173446fdd588b61faef7204817d0586af9579512 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Mon, 26 Oct 2020 17:35:33 +0100 Subject: [PATCH] added test for the existence of generic hat blocks --- HISTORY.md | 3 +++ snap.html | 2 +- src/objects.js | 11 ++++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 63bfa892..d884315b 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -17,6 +17,9 @@ * Russian, thanks, Pavel! * German +### 2020-10-26 +* objects: added test for the existence of generic WHEN hat blocks + ### 2020-10-23 * pushed dev version to v6.3.0 because of new features * objects: don't show some development-only blocks as search results diff --git a/snap.html b/snap.html index cc91f915..744305be 100755 --- a/snap.html +++ b/snap.html @@ -10,7 +10,7 @@ - + diff --git a/src/objects.js b/src/objects.js index 06c1520d..bf43efca 100644 --- a/src/objects.js +++ b/src/objects.js @@ -84,7 +84,7 @@ BlockEditorMorph, BlockDialogMorph, PrototypeHatBlockMorph, BooleanSlotMorph, localize, TableMorph, TableFrameMorph, normalizeCanvas, VectorPaintEditorMorph, AlignmentMorph, Process, WorldMap, copyCanvas, useBlurredShadows*/ -modules.objects = '2020-October-23'; +modules.objects = '2020-October-26'; var SpriteMorph; var StageMorph; @@ -5825,6 +5825,12 @@ SpriteMorph.prototype.allHatBlocksForInteraction = function (interaction) { }); }; +SpriteMorph.prototype.hasGenericHatBlocks = function () { + return this.scripts.children.some(morph => + morph.selector === 'receiveCondition' + ); +}; + SpriteMorph.prototype.allGenericHatBlocks = function () { return this.scripts.children.filter(morph => { if (morph.selector) { @@ -9195,6 +9201,9 @@ StageMorph.prototype.allHatBlocksForKey StageMorph.prototype.allHatBlocksForInteraction = SpriteMorph.prototype.allHatBlocksForInteraction; +StageMorph.prototype.hasGenericHatBlocks + = SpriteMorph.prototype.hasGenericHatBlocks; + StageMorph.prototype.allGenericHatBlocks = SpriteMorph.prototype.allGenericHatBlocks;