
import * as Blockly from 'blockly';

// variables
const HUE =  '#ffab2f';
const VariableGet = Blockly.Blocks['variables_get'];

const VariableSet = Blockly.Blocks['variables_set'];
Blockly.Blocks.variables_get = {
    init: function () {
        VariableGet.init.call(this);
        this.setColour(HUE);
    }
};
Blockly.Blocks.variables_set = {
    init: function () {
        VariableSet.init.call(this);
        this.setColour(HUE);
    }
};


Blockly.Blocks.math_change = {
    init: function () {
        this.jsonInit({
            message0: Blockly.Msg.MATH_CHANGE_TITLE,
            args0: [{
                type: 'field_variable',
                name: 'VAR',
                variable: Blockly.Msg.MATH_CHANGE_TITLE_ITEM
            }, {
                type: 'input_value',
                name: 'DELTA',
                check: 'Number'
            }],
            previousStatement: null,
            nextStatement: null,
            colour: HUE,
            helpUrl: Blockly.Msg.MATH_CHANGE_HELPURL
        });
        var a = this;
        this.setTooltip(function () {
            return Blockly.Msg.MATH_CHANGE_TOOLTIP.replace('%1', a.getField('VAR').variable.name);
        });
    }
};


export default Blockly;