Skip to content

Commit

Permalink
Changing broadcast blocks to have input value fields, and field varia…
Browse files Browse the repository at this point in the history
…ble shadows. Flyout stuff needs to be fixed.
  • Loading branch information
kchadha committed Dec 7, 2017
1 parent 2c07854 commit 235142c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
6 changes: 6 additions & 0 deletions blocks_vertical/default_toolbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,14 @@ Blockly.Blocks.defaultToolbox = '<xml id="toolbox-categories" style="display: no
'<block type="event_whenbroadcastreceived" id="event_whenbroadcastreceived">'+
'</block>'+
'<block type="event_broadcast" id="event_broadcast">'+
'<value name="BROADCAST_INPUT">'+
'<shadow type="event_broadcast_menu"></shadow>'+
'</value>'+
'</block>'+
'<block type="event_broadcastandwait" id="event_broadcastandwait">'+
'<value name="BROADCAST_INPUT">'+
'<shadow type="event_broadcast_menu"></shadow>'+
'</value>'+
'</block>'+
'</category>'+
'<category name="Control" colour="#FFAB19" secondaryColour="#CF8B17">'+
Expand Down
12 changes: 4 additions & 8 deletions blocks_vertical/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,8 @@ Blockly.Blocks['event_broadcast'] = {
"message0": "broadcast %1",
"args0": [
{
"type": "field_variable",
"name": "BROADCAST_OPTION",
"variableTypes": [Blockly.BROADCAST_MESSAGE_VARIABLE_TYPE],
"variable": Blockly.Msg.DEFAULT_BROADCAST_MESSAGE_NAME
"type": "input_value",
"name": "BROADCAST_INPUT"
}
],
"category": Blockly.Categories.event,
Expand All @@ -197,10 +195,8 @@ Blockly.Blocks['event_broadcastandwait'] = {
"message0": "broadcast %1 and wait",
"args0": [
{
"type": "field_variable",
"name": "BROADCAST_OPTION",
"variableTypes": [Blockly.BROADCAST_MESSAGE_VARIABLE_TYPE],
"variable": Blockly.Msg.DEFAULT_BROADCAST_MESSAGE_NAME
"type":"input_value",
"name":"BROADCAST_INPUT"
}
],
"category": Blockly.Categories.event,
Expand Down
3 changes: 0 additions & 3 deletions core/xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -729,9 +729,6 @@ Blockly.Xml.domToBlockHeadless_ = function(xmlBlock, workspace) {
goog.asserts.assert(child.isShadow(),
'Shadow block not allowed non-shadow child.');
}
// Ensure this block doesn't have any variable inputs.
goog.asserts.assert(block.getVars().length == 0,
'Shadow blocks cannot have variable fields.');
block.setShadow(true);
}
return block;
Expand Down

0 comments on commit 235142c

Please sign in to comment.