From 864366c51b40c1a7be2570cad74999050b64e140 Mon Sep 17 00:00:00 2001 From: JeremyGamer13 <69337718+JeremyGamer13@users.noreply.github.com> Date: Tue, 9 Jan 2024 21:15:58 -0700 Subject: [PATCH] per block colors --- src/engine/runtime.js | 11 +++++++---- src/extensions/jg_dev/index.js | 13 +++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/engine/runtime.js b/src/engine/runtime.js index 225ef4a9c14..a2147397c50 100644 --- a/src/engine/runtime.js +++ b/src/engine/runtime.js @@ -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. @@ -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', diff --git a/src/extensions/jg_dev/index.js b/src/extensions/jg_dev/index.js index 0c7bc9dfa68..afd8a833ed6 100644 --- a/src/extensions/jg_dev/index.js +++ b/src/extensions/jg_dev/index.js @@ -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", @@ -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);