mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-07-29 15:39:39 -04:00
Code cleanup and refactoring, and getting scratch3_event broadcast functionality to look up the variable name instead of getting it ad-hoc.
This commit is contained in:
parent
0a15190b85
commit
b674a0c047
4 changed files with 30 additions and 31 deletions
src/engine
|
@ -169,17 +169,8 @@ const execute = function (sequencer, thread) {
|
|||
// Add all fields on this block to the argValues.
|
||||
for (const fieldName in fields) {
|
||||
if (!fields.hasOwnProperty(fieldName)) continue;
|
||||
if (fieldName === 'VARIABLE' || fieldName === 'LIST') {
|
||||
argValues[fieldName] = fields[fieldName].id;
|
||||
} else if (fieldName === 'BROADCAST_OPTION') {
|
||||
// TODO KARISHMA (scratch-blocks #1258) this will change when we
|
||||
// upstream blockly issue #1395 is fixed.
|
||||
|
||||
// we need both the id and the name here, because
|
||||
// this object eventually gets passed to scratch3_event.broadcast
|
||||
// which will create the message for the first time if one with the
|
||||
// given id doesn't exist
|
||||
// (e.g. default broadcast message, 'message1')
|
||||
if (fieldName === 'VARIABLE' || fieldName === 'LIST' ||
|
||||
fieldName === 'BROADCAST_OPTION') {
|
||||
argValues[fieldName] = {
|
||||
id: fields[fieldName].id,
|
||||
name: fields[fieldName].value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue