diff options
author | Florrie <towerofnix@gmail.com> | 2019-12-20 17:53:50 -0400 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2019-12-20 17:54:44 -0400 |
commit | 54906d097f518b95e9301606fa7807a777474bda (patch) | |
tree | 1e9110ea117c13c7f65d97d06cbc81f34e2cc1eb | |
parent | d43497f1f65749ad48868cf906b13a0b57d34bad (diff) |
support empty C blocks
-rw-r--r-- | src/js/sb3-gen.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/js/sb3-gen.js b/src/js/sb3-gen.js index 615d73a..6a42f0a 100644 --- a/src/js/sb3-gen.js +++ b/src/js/sb3-gen.js @@ -216,17 +216,17 @@ function blockToScratchblocks(block, target) { case 'control_wait': return `wait ${i('DURATION')} seconds`; case 'control_repeat': - return `repeat ${i('TIMES')}` + i('SUBSTACK', true) + 'end'; + return `repeat ${i('TIMES')}` + (i('SUBSTACK', true) || '\n') + 'end'; case 'control_forever': - return 'forever' + i('SUBSTACK', true) + 'end'; + return 'forever' + (i('SUBSTACK', true) || '\n') + 'end'; case 'control_if': - return `if ${i('CONDITION') || '<>'} then` + i('SUBSTACK', true) + 'end'; + return `if ${i('CONDITION') || '<>'} then` + (i('SUBSTACK', true) || '\n') + 'end'; case 'control_if_else': - return `if ${i('CONDITION') || '<>'} then` + i('SUBSTACK', true) + 'else' + i('SUBSTACK2', true) + 'end'; + return `if ${i('CONDITION') || '<>'} then` + (i('SUBSTACK', true) || '\n') + 'else' + (i('SUBSTACK2', true) || '\n') + 'end'; case 'control_wait_until': return `wait until ${i('CONDITION') || '<>'}`; case 'control_repeat_until': - return `repeat until ${i('CONDITION') || '<>'}` + i('SUBSTACK', true) + 'end'; + return `repeat until ${i('CONDITION') || '<>'}` + (i('SUBSTACK', true) || '\n') + 'end'; case 'control_stop': return `stop ${i('STOP_OPTION')}`; case 'control_start_as_clone': |