Skip to content

Commit

Permalink
per block colors
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyGamer13 committed Jan 10, 2024
1 parent cb98f45 commit 864366c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/engine/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -1513,9 +1513,10 @@ class Runtime extends EventEmitter {
type: extendedOpcode,
inputsInline: true,
category: categoryInfo.name,
colour: categoryInfo.color1,
colourSecondary: categoryInfo.color2,
colourTertiary: categoryInfo.color3
extensions: blockInfo.extensions ?? [],
colour: blockInfo.color1 ?? categoryInfo.color1,
colourSecondary: blockInfo.color2 ?? categoryInfo.color2,
colourTertiary: blockInfo.color3 ?? categoryInfo.color3
};
const context = {
// TODO: store this somewhere so that we can map args appropriately after translation.
Expand All @@ -1535,7 +1536,9 @@ class Runtime extends EventEmitter {
const iconURI = blockInfo.blockIconURI || categoryInfo.blockIconURI;

if (iconURI) {
blockJSON.extensions = ['scratch_extension'];
if (!blockJSON.extensions.includes('scratch_extension')) {
blockJSON.extensions.push('scratch_extension');
}
blockJSON.message0 = '%1 %2';
const iconJSON = {
type: 'field_image',
Expand Down
13 changes: 13 additions & 0 deletions src/extensions/jg_dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,15 @@ class JgDevBlocks {
forceOutputType: 'Boolean',
disableMonitor: true
},
{
opcode: 'green',
text: 'im literally just green',
blockType: BlockType.REPORTER,
color1: '#00ff00',
color2: '#000000',
color3: '#000000',
disableMonitor: true
},
],
menus: {
variable: "getVariablesMenu",
Expand Down Expand Up @@ -468,6 +477,10 @@ class JgDevBlocks {
soundBank.soundPlayers[soundId].stopFadeDecay = Cast.toNumber(args.SEX);
}

green() {
return 'g';
}

logArgs1(args) {
console.log(args);
return JSON.stringify(args);
Expand Down

0 comments on commit 864366c

Please sign in to comment.