UNPKG

cloud-blocks

Version:

Cloud Blocks is a library for building scratch computing interfaces with Luxrobo MODI.

935 lines (902 loc) 27.7 kB
/** * @license * Visual Blocks Editor * * Copyright 2016 Massachusetts Institute of Technology * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 'use strict'; goog.provide('Blockly.Blocks.modi'); goog.require('Blockly.Blocks'); goog.require('Blockly.Colours'); goog.require('Blockly.constants'); Blockly.Blocks['modi_micvolume'] = { /** * Mic volume * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_MIC_VOLUME, args0: [ { type: 'field_dropdown', name: 'FUNCTION', options: [ [Blockly.Msg.MODI_MENU_VOLUME, 'getVolume'], [Blockly.Msg.MODI_MENU_FREQUENCY, 'getFrequency'] ] } ], category: Blockly.Categories.modi, extensions: ['output_number'], colour: Blockly.Colours.input.primary, colourSecondary: Blockly.Colours.input.secondary, colourTertiary: Blockly.Colours.input.tertiary }); } }; Blockly.Blocks['modi_environmentsensor'] = { /** * Environment module status value block * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_ENVIRONMENT_SENSOR, args0: [ { type: 'field_dropdown', name: 'FUNCTION', options: [ [Blockly.Msg.MODI_MENU_TEMPERATURE, 'getTemperature'], [Blockly.Msg.MODI_MENU_HUMIDITY, 'getHumidity'], [Blockly.Msg.MODI_MENU_ILLUMINANCE, 'getIlluminance'], [Blockly.Msg.MODI_MENU_RED, 'getRed'], [Blockly.Msg.MODI_MENU_GREEN, 'getGreen'], [Blockly.Msg.MODI_MENU_BLUE, 'getBlue'] ] } ], category: Blockly.Categories.modi, extensions: ['output_number'], colour: Blockly.Colours.input.primary, colourSecondary: Blockly.Colours.input.secondary, colourTertiary: Blockly.Colours.input.tertiary }); } }; Blockly.Blocks['modi_dialposition'] = { /** * Get dial position value * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_DIAL_POSITION, args0: [ { type: 'field_dropdown', name: 'FUNCTION', options: [ [Blockly.Msg.MODI_MENU_TURN, 'getTurn'], [Blockly.Msg.MODI_MENU_TURNSPEED, 'getTurnSpeed'] ] } ], category: Blockly.Categories.modi, extensions: ['output_number'], colour: Blockly.Colours.input.primary, colourSecondary: Blockly.Colours.input.secondary, colourTertiary: Blockly.Colours.input.tertiary }); } }; Blockly.Blocks['modi_gyroscopestatus'] = { /** * Gyroscope status value block * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_GYROSCOPE_STATUS, args0: [ { type: 'field_dropdown', name: 'FUNCTION', options: [ [Blockly.Msg.MODI_MENU_ROLL, 'getRoll'], [Blockly.Msg.MODI_MENU_PITCH, 'getPitch'], [Blockly.Msg.MODI_MENU_YAW, 'getYaw'], [Blockly.Msg.MODI_MENU_X_ACCELERATION, 'getAcclerationX'], [Blockly.Msg.MODI_MENU_Y_ACCELERATION, 'getAcclerationY'], [Blockly.Msg.MODI_MENU_Z_ACCELERATION, 'getAcclerationZ'], [Blockly.Msg.MODI_MENU_X_VELOCITY, 'getVelocityX'], [Blockly.Msg.MODI_MENU_Y_VELOCITY, 'getVelocityY'], [Blockly.Msg.MODI_MENU_Z_VELOCITY, 'getVelocityZ'], [Blockly.Msg.MODI_MENU_VIBRATION, 'getVibration'] ] } ], category: Blockly.Categories.modi, extensions: ['output_number'], colour: Blockly.Colours.input.primary, colourSecondary: Blockly.Colours.input.secondary, colourTertiary: Blockly.Colours.input.tertiary }); } }; Blockly.Blocks['modi_buttonclicked'] = { /** * When button clicked * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_BUTTON_CLICKED, args0: [ { type: 'field_dropdown', name: 'FUNCTION', options: [ [Blockly.Msg.MODI_MENU_CLICKED, 'getClick'], [Blockly.Msg.MODI_MENU_DOUBLECLICKED, 'getDoubleClick'], [Blockly.Msg.MODI_MENU_PRESSING, 'getPressStatus'], [Blockly.Msg.MODI_MENU_SWITCH, 'getToggle'] ] } ], category: Blockly.Categories.modi, extensions: ['output_number'], colour: Blockly.Colours.input.primary, colourSecondary: Blockly.Colours.input.secondary, colourTertiary: Blockly.Colours.input.tertiary }); } }; Blockly.Blocks['modi_buttonpressed'] = { /** * When button pressed * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_BUTTON_PRESSED, args0: [ { type: 'field_dropdown', name: 'PARAM', options: [ [Blockly.Msg.MODI_MENU_PRESSED, 'TRUE'], [Blockly.Msg.MODI_MENU_NOTPRESSED, 'FALSE'] ] } ], category: Blockly.Categories.modi, extensions: ['output_number'], colour: Blockly.Colours.input.primary, colourSecondary: Blockly.Colours.input.secondary, colourTertiary: Blockly.Colours.input.tertiary }); } }; Blockly.Blocks['modi_buttonclickedpressed'] = { /** * When button clicked and pressed * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_BUTTON_CLICKED_PRESSED, args0: [ { type: 'field_dropdown', name: 'FUNCTION', options: [ [Blockly.Msg.MODI_MENU_CLICKED, 'getClick'], [Blockly.Msg.MODI_MENU_DOUBLECLICKED, 'getDoubleClick'], [Blockly.Msg.MODI_MENU_PRESSING, 'getPressStatus'], [Blockly.Msg.MODI_MENU_SWITCH, 'getToggle'] ] }, { type: 'field_dropdown', name: 'PARAM', options: [ [Blockly.Msg.MODI_MENU_PRESSED, 'TRUE'], [Blockly.Msg.MODI_MENU_NOTPRESSED, 'FALSE'] ] } ], category: Blockly.Categories.modi, extensions: ['output_boolean'], colour: Blockly.Colours.input.primary, colourSecondary: Blockly.Colours.input.secondary, colourTertiary: Blockly.Colours.input.tertiary }); } }; Blockly.Blocks['modi_infraredreflectance'] = { /** * Infrared reflectance * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_INFRARED_REFLECTANCE, category: Blockly.Categories.modi, extensions: ['output_number'], colour: Blockly.Colours.input.primary, colourSecondary: Blockly.Colours.input.secondary, colourTertiary: Blockly.Colours.input.tertiary }); } }; Blockly.Blocks['modi_ultrasonicdistance'] = { /** * Ultrasonic distance value * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_ULTRASONIC_DISTANCE, category: Blockly.Categories.modi, extensions: ['output_number'], colour: Blockly.Colours.input.primary, colourSecondary: Blockly.Colours.input.secondary, colourTertiary: Blockly.Colours.input.tertiary }); } }; Blockly.Blocks['modi_motorstatus'] = { /** * Motor angle and speed * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_MOTOR_STATUS, args0: [ { type: 'field_dropdown', name: 'FUNCTION', options: [ [Blockly.Msg.MODI_MENU_ANGLE, 'setAngle'], [Blockly.Msg.MODI_MENU_SPEED, 'setSpeed'], [Blockly.Msg.MODI_MENU_TORQUE, 'setTorque'] ] }, { type: 'input_value', name: 'PARAM1' }, { type: 'input_value', name: 'PARAM2' } ], category: Blockly.Categories.modi, extensions: ['shape_statement'], colour: Blockly.Colours.output.primary, colourSecondary: Blockly.Colours.output.secondary, colourTertiary: Blockly.Colours.output.tertiary }); } }; Blockly.Blocks['modi_LEDoff'] = { /** * LED Off * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_LED_OFF, category: Blockly.Categories.modi, extensions: ['shape_statement'], colour: Blockly.Colours.output.primary, colourSecondary: Blockly.Colours.output.secondary, colourTertiary: Blockly.Colours.output.tertiary }); } }; Blockly.Blocks['modi_LEDRGB'] = { /** * LED RGB on * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_LED_RGB, args0: [ { type: 'input_value', name: 'PARAM1' }, { type: 'input_value', name: 'PARAM2' }, { type: 'input_value', name: 'PARAM3' } ], category: Blockly.Categories.modi, extensions: ['shape_statement'], colour: Blockly.Colours.output.primary, colourSecondary: Blockly.Colours.output.secondary, colourTertiary: Blockly.Colours.output.tertiary }); } }; Blockly.Blocks['modi_LEDcolor'] = { /** * * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_LED_COLOR, args0: [ { type: 'input_value', name: 'COLOR' } ], category: Blockly.Categories.modi, extensions: ['shape_statement'], colour: Blockly.Colours.output.primary, colourSecondary: Blockly.Colours.output.secondary, colourTertiary: Blockly.Colours.output.tertiary }); } }; Blockly.Blocks['modi_speakeroff'] = { /** * Speaker volume off * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_SPEAKER_OFF, category: Blockly.Categories.modi, extensions: ['shape_statement'], colour: Blockly.Colours.output.primary, colourSecondary: Blockly.Colours.output.secondary, colourTertiary: Blockly.Colours.output.tertiary }); } }; Blockly.Blocks['modi_speakerscale'] = { /** * Scale output block * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_SPEAKER_SCALE, args0: [ { type: 'field_dropdown', name: 'PARAM1', options: [ [Blockly.Msg.MODI_MENU_DO, 'F_DO_6'], [Blockly.Msg.MODI_MENU_RE, 'F_RE_6'], [Blockly.Msg.MODI_MENU_MI, 'F_MI_6'], [Blockly.Msg.MODI_MENU_FA, 'F_FA_6'], [Blockly.Msg.MODI_MENU_SOL, 'F_SOL_6'], [Blockly.Msg.MODI_MENU_LA, 'F_LA_6'], [Blockly.Msg.MODI_MENU_SI, 'F_SI_6'], [Blockly.Msg.MODI_MENU_DDO, 'F_DO_7'] ] }, { type: 'input_value', name: 'PARAM2' } ], category: Blockly.Categories.modi, extensions: ['shape_statement'], colour: Blockly.Colours.output.primary, colourSecondary: Blockly.Colours.output.secondary, colourTertiary: Blockly.Colours.output.tertiary }); } }; Blockly.Blocks['modi_speakermelody'] = { /** * MELODY output block * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_SPEAKER_MELODY, args0: [ { type: 'field_dropdown', name: 'PARAM1', options: [ [Blockly.Msg.MODI_MENU_MELODY_01, 'melody01'], [Blockly.Msg.MODI_MENU_MELODY_02, 'melody02'], [Blockly.Msg.MODI_MENU_MELODY_03, 'melody03'], [Blockly.Msg.MODI_MENU_MELODY_04, 'melody04'], [Blockly.Msg.MODI_MENU_MELODY_05, 'melody05'], [Blockly.Msg.MODI_MENU_MELODY_06, 'melody06'], [Blockly.Msg.MODI_MENU_MELODY_07, 'melody07'], [Blockly.Msg.MODI_MENU_MELODY_08, 'melody08'], [Blockly.Msg.MODI_MENU_MELODY_09, 'melody09'], [Blockly.Msg.MODI_MENU_MELODY_10, 'melody10'], [Blockly.Msg.MODI_MENU_MELODY_11, 'melody11'], [Blockly.Msg.MODI_MENU_MELODY_12, 'melody12'], [Blockly.Msg.MODI_MENU_MELODY_13, 'melody13'], [Blockly.Msg.MODI_MENU_MELODY_14, 'melody14'], [Blockly.Msg.MODI_MENU_MELODY_15, 'melody15'], [Blockly.Msg.MODI_MENU_MELODY_16, 'melody16'], [Blockly.Msg.MODI_MENU_MELODY_17, 'melody17'], [Blockly.Msg.MODI_MENU_MELODY_18, 'melody18'], [Blockly.Msg.MODI_MENU_MELODY_19, 'melody19'], [Blockly.Msg.MODI_MENU_MELODY_20, 'melody20'], [Blockly.Msg.MODI_MENU_MELODY_21, 'melody21'], [Blockly.Msg.MODI_MENU_MELODY_22, 'melody22'], [Blockly.Msg.MODI_MENU_MELODY_23, 'melody23'], [Blockly.Msg.MODI_MENU_MELODY_24, 'melody24'], [Blockly.Msg.MODI_MENU_MELODY_25, 'melody25'] ] }, { type: 'input_value', name: 'PARAM2' } ], category: Blockly.Categories.modi, extensions: ['shape_statement'], colour: Blockly.Colours.output.primary, colourSecondary: Blockly.Colours.output.secondary, colourTertiary: Blockly.Colours.output.tertiary }); } }; Blockly.Blocks['modi_displaytext'] = { /** * Display block Text output block * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_DISPLAY_TEXT, args0: [ { type: 'input_value', name: 'PARAM' } ], category: Blockly.Categories.modi, extensions: ['shape_statement'], colour: Blockly.Colours.output.primary, colourSecondary: Blockly.Colours.output.secondary, colourTertiary: Blockly.Colours.output.tertiary }); } }; Blockly.Blocks['modi_displayline'] = { /** * Variable output block on selection line * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_DISPLAY_LINE, args0: [ { type: 'field_dropdown', name: 'PARAM1', options: [ [Blockly.Msg.MODI_MENU_LINE_1, '0'], [Blockly.Msg.MODI_MENU_LINE_2, '15'], [Blockly.Msg.MODI_MENU_LINE_3, '30'] ] }, { type: 'input_value', name: 'PARAM2' } ], category: Blockly.Categories.modi, extensions: ['shape_statement'], colour: Blockly.Colours.output.primary, colourSecondary: Blockly.Colours.output.secondary, colourTertiary: Blockly.Colours.output.tertiary }); } }; Blockly.Blocks['modi_displayimage'] = { /** * Image output block * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_DISPLAY_IMAGE, args0: [ { type: 'field_dropdown', name: 'PARAM', options: [ [Blockly.Msg.MODI_MENU_IMAGE_01, 'image01'], // [Blockly.Msg.MODI_MENU_IMAGE_02, 'image02'], [Blockly.Msg.MODI_MENU_IMAGE_03, 'image03'], [Blockly.Msg.MODI_MENU_IMAGE_04, 'image04'], [Blockly.Msg.MODI_MENU_IMAGE_05, 'image05'], [Blockly.Msg.MODI_MENU_IMAGE_06, 'image06'], [Blockly.Msg.MODI_MENU_IMAGE_07, 'image07'], [Blockly.Msg.MODI_MENU_IMAGE_08, 'image08'], [Blockly.Msg.MODI_MENU_IMAGE_09, 'image09'], [Blockly.Msg.MODI_MENU_IMAGE_10, 'image10'], [Blockly.Msg.MODI_MENU_IMAGE_11, 'image11'], [Blockly.Msg.MODI_MENU_IMAGE_12, 'image12'], [Blockly.Msg.MODI_MENU_IMAGE_13, 'image13'], [Blockly.Msg.MODI_MENU_IMAGE_14, 'image14'], [Blockly.Msg.MODI_MENU_IMAGE_15, 'image15'], [Blockly.Msg.MODI_MENU_IMAGE_16, 'image16'], [Blockly.Msg.MODI_MENU_IMAGE_17, 'image17'], [Blockly.Msg.MODI_MENU_IMAGE_18, 'image18'], [Blockly.Msg.MODI_MENU_IMAGE_19, 'image19'], [Blockly.Msg.MODI_MENU_IMAGE_20, 'image20'], [Blockly.Msg.MODI_MENU_IMAGE_21, 'image21'], [Blockly.Msg.MODI_MENU_IMAGE_22, 'image22'], [Blockly.Msg.MODI_MENU_IMAGE_23, 'image23'], [Blockly.Msg.MODI_MENU_IMAGE_24, 'image24'], [Blockly.Msg.MODI_MENU_IMAGE_25, 'image25'], [Blockly.Msg.MODI_MENU_IMAGE_26, 'image26'], [Blockly.Msg.MODI_MENU_IMAGE_27, 'image27'], [Blockly.Msg.MODI_MENU_IMAGE_28, 'image28'], [Blockly.Msg.MODI_MENU_IMAGE_29, 'image29'], [Blockly.Msg.MODI_MENU_IMAGE_30, 'image30'], [Blockly.Msg.MODI_MENU_IMAGE_31, 'image31'], [Blockly.Msg.MODI_MENU_IMAGE_32, 'image32'], [Blockly.Msg.MODI_MENU_IMAGE_33, 'image33'], [Blockly.Msg.MODI_MENU_IMAGE_34, 'image34'], [Blockly.Msg.MODI_MENU_IMAGE_35, 'image35'], [Blockly.Msg.MODI_MENU_IMAGE_36, 'image36'], [Blockly.Msg.MODI_MENU_IMAGE_37, 'image37'], [Blockly.Msg.MODI_MENU_IMAGE_38, 'image38'], [Blockly.Msg.MODI_MENU_IMAGE_39, 'image39'], [Blockly.Msg.MODI_MENU_IMAGE_40, 'image40'], [Blockly.Msg.MODI_MENU_IMAGE_41, 'image41'], [Blockly.Msg.MODI_MENU_IMAGE_42, 'image42'], [Blockly.Msg.MODI_MENU_IMAGE_43, 'image43'], [Blockly.Msg.MODI_MENU_IMAGE_44, 'image44'], [Blockly.Msg.MODI_MENU_IMAGE_45, 'image45'], [Blockly.Msg.MODI_MENU_IMAGE_46, 'image46'], [Blockly.Msg.MODI_MENU_IMAGE_47, 'image47'], [Blockly.Msg.MODI_MENU_IMAGE_48, 'image48'], [Blockly.Msg.MODI_MENU_IMAGE_49, 'image49'], [Blockly.Msg.MODI_MENU_IMAGE_50, 'image50'] ] } ], category: Blockly.Categories.modi, extensions: ['shape_statement'], colour: Blockly.Colours.output.primary, colourSecondary: Blockly.Colours.output.secondary, colourTertiary: Blockly.Colours.output.tertiary }); } }; Blockly.Blocks['modi_displayclear'] = { /** * Clear full display * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_DISPLAY_CLEAR, category: Blockly.Categories.modi, extensions: ['shape_statement'], colour: Blockly.Colours.output.primary, colourSecondary: Blockly.Colours.output.secondary, colourTertiary: Blockly.Colours.output.tertiary }); } }; Blockly.Blocks['modi_displaydirection'] = { /** * Move in the desired direction on the screen * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_DISPLAY_DIRECTION, args0: [ { type: 'field_dropdown', name: 'FUNCTION', options: [ [Blockly.Msg.MODI_MENU_RIGHT, 'right'], [Blockly.Msg.MODI_MENU_LEFT, 'left'], [Blockly.Msg.MODI_MENU_TOP, 'top'], [Blockly.Msg.MODI_MENU_BOTTOM, 'bottom'] ] }, { type: 'input_value', name: 'PARAM' } ], category: Blockly.Categories.modi, extensions: ['shape_statement'], colour: Blockly.Colours.output.primary, colourSecondary: Blockly.Colours.output.secondary, colourTertiary: Blockly.Colours.output.tertiary }); } }; /** * Network button click * @this Blockly.Block* */ Blockly.Blocks['modi_networkbuttonclicked'] = { init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_NETWORK_BUTTON_CLICKED, args0: [ { type: 'field_dropdown', name: 'FUNCTION', options: [ [Blockly.Msg.MODI_MENU_CLICKED, 'getButtonClick'], [Blockly.Msg.MODI_MENU_DOUBLECLICKED, 'getButtonDoubleClick'], [Blockly.Msg.MODI_MENU_PRESSING, 'getButtonPressed'], [Blockly.Msg.MODI_MENU_SWITCH, 'getButtonToggle'] ] } ], category: Blockly.Categories.modi, extensions: ['output_number'], colour: Blockly.Colours.network.primary, colourSecondary: Blockly.Colours.network.secondary, colourTertiary: Blockly.Colours.network.tertiary }); } }; Blockly.Blocks['modi_networkbuttonpressed'] = { /** * Press the network button * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_NETWORK_BUTTON_PRESSED, args0: [ { type: 'field_dropdown', name: 'PARAM', options: [ [Blockly.Msg.MODI_MENU_PRESSED, 'TRUE'], [Blockly.Msg.MODI_MENU_NOTPRESSED, 'FALSE'] ] } ], category: Blockly.Categories.modi, extensions: ['output_number'], colour: Blockly.Colours.network.primary, colourSecondary: Blockly.Colours.network.secondary, colourTertiary: Blockly.Colours.network.tertiary }); } }; Blockly.Blocks['modi_networkbuttonclickedpressed'] = { /** * Clicking and pressing the network button * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_NETWORK_BUTTON_CLICKED_PRESSED, args0: [ { type: 'field_dropdown', name: 'FUNCTION', options: [ [Blockly.Msg.MODI_MENU_CLICKED, 'getButtonClick'], [Blockly.Msg.MODI_MENU_DOUBLECLICKED, 'getButtonDoubleClick'], [Blockly.Msg.MODI_MENU_PRESSING, 'getButtonPressed'], [Blockly.Msg.MODI_MENU_SWITCH, 'getButtonToggle'] ] }, { type: 'field_dropdown', name: 'PARAM', options: [ [Blockly.Msg.MODI_MENU_PRESSED, 'TRUE'], [Blockly.Msg.MODI_MENU_NOTPRESSED, 'FALSE'] ] } ], category: Blockly.Categories.modi, extensions: ['output_boolean'], colour: Blockly.Colours.network.primary, colourSecondary: Blockly.Colours.network.secondary, colourTertiary: Blockly.Colours.network.tertiary }); } }; Blockly.Blocks['modi_networkjoystick'] = { /** * Network joystick value * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_NETWORK_JOYSTICK, category: Blockly.Categories.modi, extensions: ['output_number'], colour: Blockly.Colours.network.primary, colourSecondary: Blockly.Colours.network.secondary, colourTertiary: Blockly.Colours.network.tertiary }); } }; Blockly.Blocks['modi_networkjoystickdirection'] = { /** * Network joystick direction * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_NETWORK_JOYSTICK_DIRECTION, args0: [ { type: 'field_dropdown', name: 'PARAM', options: [ [Blockly.Msg.MODI_MENU_NOTPRESSED, 'FALSE'], [Blockly.Msg.MODI_MENU_TOP, 'JOYSTICK_UP'], [Blockly.Msg.MODI_MENU_BOTTOM, 'JOYSTICK_DOWN'], [Blockly.Msg.MODI_MENU_LEFT, 'JOYSTICK_LEFT'], [Blockly.Msg.MODI_MENU_RIGHT, 'JOYSTICK_RIGHT'] ] } ], category: Blockly.Categories.modi, extensions: ['output_boolean'], colour: Blockly.Colours.network.primary, colourSecondary: Blockly.Colours.network.secondary, colourTertiary: Blockly.Colours.network.tertiary }); } }; Blockly.Blocks['modi_networkslider'] = { /** * Network slider position * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_NETWORK_SLIDER, args0: [ { type: 'field_dropdown', name: 'FUNCTION', options: [ [Blockly.Msg.MODI_MENU_LEFT, 'getLeftSliderPosition'], [Blockly.Msg.MODI_MENU_RIGHT, 'getRightSliderPosition'] ] } ], category: Blockly.Categories.modi, extensions: ['output_number'], colour: Blockly.Colours.network.primary, colourSecondary: Blockly.Colours.network.secondary, colourTertiary: Blockly.Colours.network.tertiary }); } }; Blockly.Blocks['modi_networkdialposition'] = { /** * Network dial position value * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_NETWORK_DIAL_POSITION, category: Blockly.Categories.modi, extensions: ['output_number'], colour: Blockly.Colours.network.primary, colourSecondary: Blockly.Colours.network.secondary, colourTertiary: Blockly.Colours.network.tertiary }); } }; Blockly.Blocks['modi_networktimer'] = { /** * Network timer * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_NETWORK_TIMER, category: Blockly.Categories.modi, extensions: ['output_number'], colour: Blockly.Colours.network.primary, colourSecondary: Blockly.Colours.network.secondary, colourTertiary: Blockly.Colours.network.tertiary }); } }; Blockly.Blocks['modi_networktimerstatus'] = { init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_NETWORK_TIMER_STATUS, args0: [ { type: 'field_dropdown', name: 'PARAM', options: [ [Blockly.Msg.MODI_MENU_COMPLETE, '0'], [Blockly.Msg.MODI_MENU_INPROGRESS, '100'] ] } ], category: Blockly.Categories.modi, extensions: ['output_boolean'], colour: Blockly.Colours.network.primary, colourSecondary: Blockly.Colours.network.secondary, colourTertiary: Blockly.Colours.network.tertiary }); } }; Blockly.Blocks['modi_networksound'] = { /** * Network buzzer sound * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_NETWORK_SOUND, args0: [ { type: 'field_dropdown', name: 'PARAM', options: [ [Blockly.Msg.MODI_MENU_RING, 'BUZZER_ON'], [Blockly.Msg.MODI_MENU_NOTRING, 'BUZZER_OFF'] ] } ], category: Blockly.Categories.modi, extensions: ['shape_statement'], colour: Blockly.Colours.network.primary, colourSecondary: Blockly.Colours.network.secondary, colourTertiary: Blockly.Colours.network.tertiary }); } }; Blockly.Blocks['modi_networkcamera'] = { /** * Clear full display * @this Blockly.Block */ init: function () { this.jsonInit({ message0: Blockly.Msg.MODI_NETWORK_CAMERA, category: Blockly.Categories.modi, extensions: ['shape_statement'], colour: Blockly.Colours.network.primary, colourSecondary: Blockly.Colours.network.secondary, colourTertiary: Blockly.Colours.network.tertiary }); } };