File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ class Scratch3ControlBlocks {
3232 control_wait_until : this . waitUntil ,
3333 control_if : this . if ,
3434 control_if_else : this . ifElse ,
35+ control_if_extendable : this . ifExtendable ,
36+ control_if_else_extendable : this . ifElseExtendable ,
3537 control_stop : this . stop ,
3638 control_create_clone_of : this . createClone ,
3739 control_delete_this_clone : this . deleteClone ,
@@ -137,6 +139,27 @@ class Scratch3ControlBlocks {
137139 }
138140 }
139141
142+ ifExtendable ( args , util ) {
143+ const argCount = args . BRANCHES ;
144+ for ( let i = 0 ; i < argCount ; i ++ ) {
145+ if ( Cast . toBoolean ( args [ `BRANCHES_${ i } _CONDITION` ] ) ) {
146+ util . startBranch ( `BRANCHES_${ i } _BRANCH` ) ;
147+ return ;
148+ }
149+ }
150+ }
151+
152+ ifElseExtendable ( args , util ) {
153+ const argCount = args . BRANCHES ;
154+ for ( let i = 0 ; i < argCount ; i ++ ) {
155+ if ( Cast . toBoolean ( args [ `BRANCHES_${ i } _CONDITION` ] ) ) {
156+ util . startBranch ( `BRANCHES_${ i } _BRANCH` ) ;
157+ return ;
158+ }
159+ }
160+ util . startBranch ( 'ELSE' ) ;
161+ }
162+
140163 stop ( args , util ) {
141164 const option = args . STOP_OPTION ;
142165 if ( option === 'all' ) {
You can’t perform that action at this time.
0 commit comments