-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
integrate blockly dev tools and codegen previewing
- Loading branch information
1 parent
7b723f3
commit a3bb4e0
Showing
5 changed files
with
601 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const entity_set_position = { | ||
init: function () { | ||
this.appendValueInput('ENTITY') | ||
.setAlign(Blockly.inputs.Align.RIGHT) | ||
.appendField('set position of entity'); | ||
this.appendValueInput('POS') | ||
.setAlign(Blockly.inputs.Align.RIGHT) | ||
.appendField('to Vec3'); | ||
this.setInputsInline(true) | ||
this.setPreviousStatement(true, null); | ||
this.setNextStatement(true, null); | ||
this.setTooltip('Sets the position of the entity to a vector, and sends a packet.'); | ||
this.setHelpUrl(''); | ||
this.setColour(195); | ||
} | ||
}; | ||
Blockly.common.defineBlocks({ entity_set_position: entity_set_position }); | ||
|
||
javascript.javascriptGenerator.forBlock['entity_set_position'] = function () { | ||
const value_entity = javascript.javascriptGenerator.valueToCode(this, 'ENTITY', javascript.Order.ATOMIC); | ||
const value_pos = javascript.javascriptGenerator.valueToCode(this, 'POS', javascript.Order.ATOMIC); | ||
const code = `(${value_entity}).$setPositionAndUpdate((${value_pos}).$xCoord,(${value_pos}).$yCoord,(${value_pos}).$zCoord)`; | ||
return code; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.