Skip to content

Commit b9bcd77

Browse files
committed
1 parent 607a46e commit b9bcd77

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

tests/test-scratch-vm-extension-tw.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,25 @@ Scratch.gui.getBlocklyEagerly().then((ScratchBlocks) => {
152152
Scratch.vm.runtime.fontManager.on('change', () => {
153153

154154
});
155+
156+
Scratch.extensions.register({
157+
getInfo() {
158+
return {
159+
id: 'AshimeeShapeTestThing',
160+
name: 'AshimeeShapeTestThing',
161+
blocks: [{
162+
blockType: Scratch.BlockType.REPORTER,
163+
blockShape: Scratch.BlockShape.HEXAGONAL,
164+
opcode: 'hexagonal', text: 'im a reporter',
165+
}, {
166+
blockType: Scratch.BlockType.BOOLEAN,
167+
blockShape: Scratch.BlockShape.ROUND,
168+
opcode: 'round', text: 'im a boolean',
169+
}, {
170+
blockType: Scratch.BlockType.REPORTER,
171+
blockShape: Scratch.BlockShape.SQUARE,
172+
opcode: 'square', text: 'im a reporter (but square)',
173+
}],
174+
};
175+
}
176+
});

types/scratch-vm-extension.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ declare namespace Scratch {
101101
*/
102102
function getBlocklyEagerly(): Promise<ScratchBlocks.RealBlockly>;
103103
}
104+
namespace BlockShape {
105+
const HEXAGONAL: 1;
106+
const ROUND: 2;
107+
const SQUARE: 3;
108+
}
104109

105110
// Note that the 'B' in the BOOLEAN enums are capitalized in Scratch. It is not a typo in this file.
106111

@@ -233,6 +238,7 @@ declare namespace Scratch {
233238
filter?: Array<'target' | 'sprite'>;
234239
}
235240
interface ExecutableBlock extends AbstractBlock {
241+
blockShape?: 1 | 2 | 3; // TW
236242
opcode: string;
237243
func?: string;
238244
arguments?: Record<string, Argument>;

0 commit comments

Comments
 (0)