Open w1ngedshadow opened 2 years ago
I did it for 2 PoweredUp trains. What You need to do: 1) copy scratch-gui/src/lib/libraries/extensions/poweredup to scratch-gui/src/lib/libraries/extensions/poweredup2 2) rename all poweredup- to poweredup2- files 3) edit index.jsx and replace all "poweredup" strings to "poweredup2" 4)copy scratch-vm/src/extensions/scratch3_poweredup to scratch-vm/src/extensions/scratch3_poweredup2 5) edit index.js and replace string return "'poweredup2';" to "return 'poweredup2';" 6) optional:in index.js constanst blockIconURI contain base64 encoded icon in png format. You can decode, edit, encode and replace It. 7)edit package.json in the root folder insert lines
"register:poweredup2": "node ./scripts/register.js --link -C --id=\"poweredup2\" --block=\"./scratch-vm/src/extensions/scratch3_poweredup2\" --entry=\"./scratch-gui/src/lib/libraries/extensions/poweredup2\" --gui=\"../scratch-gui\"",
"build:poweredup2": "npx xcratch-build --module=\"poweredup\" --block=\"scratch-vm/src/extensions/scratch3_poweredup2\" --entry=\"scratch-gui/src/lib/libraries/extensions/poweredup2\" --gui=\"../scratch-gui\"",
and change "register" and "build" to
"register": "npm run register:legoble && npm run register:spikeessential && npm run register:legoremote && npm run register:controlplus && npm run register:poweredup && npm run register:poweredup2 && npm run register:duplotrain && npm run register:legopeach && npm run register:legoluigi && npm run register:legomario",
"build": "npm run build:legoble && npm run build:spikeessential && npm run build:legoremote && npm run build:controlplus && npm run build:poweredup && npm run build:poweredup2 && npm run build:duplotrain && npm run build:legopeach && npm run build:legoluigi && npm run build:legomario",
8) If you do this after building and installing the extension, you need to do it (7) manually: edit file scratch-gui/src/lib/libraries/extensions/index.jsx and add after extensions.unshift(poweredup);
// Injected for extra extension poweredup
import poweredup2 from './poweredup2/index.jsx';
extensions.unshift(poweredup2);
edit file scratch-vm/src/extensions/virtual-machine.js and add after CORE_EXTENSIONS.push('poweredup');
CORE_EXTENSIONS.push('poweredup2');
edit file scratch-vm/src/extensions/extension-support/extension-manager.js and add after builtinExtensions.poweredup = () => require('../extensions/scratch3_poweredup');
builtinExtensions.poweredup2 = () => require('../extensions/scratch3_poweredup2');
This is an example. I hid a couple of extensions that are not relevant to me.
Hello, is there any way to connect two spike essential hubs (or any other two devices at one time) to scratch link? previously it was possible by using s2bot with scratch 2.0