@@ -11,7 +11,7 @@ const GdxForConverter = {
1111 if ( ( this . _isSelf ( receiver ) || receiver === Opal . nil ) && ! rubyBlock ) {
1212 switch ( name ) {
1313 case 'gdx_for_acceleration' :
14- if ( args . length === 1 ) {
14+ if ( args . length === 1 && this . _isStringOrBlock ( args [ 0 ] ) ) {
1515 block = this . _createBlock ( 'gdxfor_getAcceleration' , 'value' ) ;
1616 this . _addInput (
1717 block ,
@@ -20,6 +20,81 @@ const GdxForConverter = {
2020 ) ;
2121 }
2222 break ;
23+ case 'gdx_for_force' :
24+ if ( args . length === 0 ) {
25+ block = this . _createBlock ( 'gdxfor_getForce' , 'value' ) ;
26+ }
27+ break ;
28+ case 'gdx_for_tilted?' :
29+ if ( args . length === 1 && this . _isStringOrBlock ( args [ 0 ] ) ) {
30+ block = this . _createBlock ( 'gdxfor_isTilted' , 'value' ) ;
31+ this . _addInput (
32+ block ,
33+ 'TILT' ,
34+ this . _createFieldBlock ( 'gdxfor_menu_tiltAnyOptions' , 'tiltAnyOptions' , args [ 0 ] )
35+ ) ;
36+ }
37+ break ;
38+ case 'gdx_for_tilt_angle' :
39+ if ( args . length === 1 && this . _isStringOrBlock ( args [ 0 ] ) ) {
40+ block = this . _createBlock ( 'gdxfor_getTilt' , 'value' ) ;
41+ this . _addInput (
42+ block ,
43+ 'TILT' ,
44+ this . _createFieldBlock ( 'gdxfor_menu_tiltOptions' , 'tiltOptions' , args [ 0 ] )
45+ ) ;
46+ }
47+ break ;
48+ case 'gdx_for_falling?' :
49+ if ( args . length === 0 ) {
50+ block = this . _createBlock ( 'gdxfor_isFreeFalling' , 'value' ) ;
51+ }
52+ break ;
53+ case 'gdx_for_spin_speed' :
54+ if ( args . length === 1 && this . _isStringOrBlock ( args [ 0 ] ) ) {
55+ block = this . _createBlock ( 'gdxfor_getSpinSpeed' , 'value' ) ;
56+ this . _addInput (
57+ block ,
58+ 'DIRECTION' ,
59+ this . _createFieldBlock ( 'gdxfor_menu_axisOptions' , 'axisOptions' , args [ 0 ] )
60+ ) ;
61+ }
62+ break ;
63+ }
64+ } else if ( ( this . _isSelf ( receiver ) || receiver === Opal . nil ) &&
65+ name === 'when' &&
66+ args . length === 2 && args [ 0 ] . type === 'sym' &&
67+ this . _isStringOrBlock ( args [ 1 ] ) &&
68+ rubyBlockArgs && rubyBlockArgs . length === 0 &&
69+ rubyBlock ) {
70+ switch ( args [ 0 ] . value ) {
71+ case 'gdx_for_gesture' :
72+ block = this . _createBlock ( 'gdxfor_whenGesture' , 'hat' ) ;
73+ this . _addInput (
74+ block ,
75+ 'GESTURE' ,
76+ this . _createFieldBlock ( 'gdxfor_menu_gestureOptions' , 'gestureOptions' , args [ 1 ] )
77+ ) ;
78+ this . _setParent ( rubyBlock , block ) ;
79+ break ;
80+ case 'gdx_force_sensor' :
81+ block = this . _createBlock ( 'gdxfor_whenForcePushedOrPulled' , 'hat' ) ;
82+ this . _addInput (
83+ block ,
84+ 'PUSH_PULL' ,
85+ this . _createFieldBlock ( 'gdxfor_menu_pushPullOptions' , 'pushPullOptions' , args [ 1 ] )
86+ ) ;
87+ this . _setParent ( rubyBlock , block ) ;
88+ break ;
89+ case 'gdx_for_tilted' :
90+ block = this . _createBlock ( 'gdxfor_whenTilted' , 'hat' ) ;
91+ this . _addInput (
92+ block ,
93+ 'TILT' ,
94+ this . _createFieldBlock ( 'gdxfor_menu_tiltAnyOptions' , 'tiltAnyOptions' , args [ 1 ] )
95+ ) ;
96+ this . _setParent ( rubyBlock , block ) ;
97+ break ;
2398 }
2499 }
25100 return block ;
0 commit comments