Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/lib/Toolbox/Toolbox.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,31 @@
</value>
</block>
</category>
<category name="Sprites" colour="#18f">
<block type="sprites_stage"/>
<block type="sprites_getSpriteFromName"/>
<block type="sprites_getSpriteThatRanBlock"/>
<sep gap="48"></sep>
<block type="sprites_getListOfSprites"/>
<block type="sprites_getClonesOfSprite"/>
<sep gap="48"></sep>
<block type="sprites_getNameOfSprite"/>
<block type="sprites_getIdOfSprite"/>
<sep gap="48"></sep>
<block type="sprites_getXposOfSprite"/>
<block type="sprites_getYposOfSprite"/>
<block type="sprites_getDirectionOfSprite"/>
<sep gap="48"></sep>
<block type="sprites_setXposOfSprite"/>
<block type="sprites_setYposOfSprite"/>
<block type="sprites_setDirectionOfSprite"/>
<sep gap="48"></sep>
<block type="sprites_hasSpriteBeenDeleted"/>
<block type="sprites_isSpriteAClone"/>
<sep gap="48"></sep>
<block type="sprites_getVarOfSprite"/>
<block type="sprites_setVarOfSprite"/>
</category>
<category name="Blocks" colour="#b6f" custom="blocks">
<!-- resources/categories/blocks.js -->
</category>
Expand Down
43 changes: 43 additions & 0 deletions src/patches/blockly/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,47 @@ class CustomConstantProvider extends Blockly.zelos.ConstantProvider {
this.ADD_START_HATS = true

this.PLUS = this.makePlus()
this.ARROW = this.makeArrow();
}

/** @returns {import("blockly/core/renderers/common/constants").Shape} */
makeArrow() {
const maxWidth = this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH;
// try to get rid of the VERY noticeable gap
function makeLeftPath(height, up) {
const halfHeight = height / 2;
const width = halfHeight > maxWidth ? maxWidth : halfHeight;
const forward = up ? -1 : 1;
const direction = 1;
const dy = (forward * height) / 2;
return (
svgPaths.lineOnAxis("h", -width) +
svgPaths.lineOnAxis("v", dy * 2)
//svgPaths.lineTo(-width, up ? (forward * height) : 0) +
//svgPaths.lineOnAxis("v", dy)
);
}
return {
type: this.SHAPES.HEXAGONAL,
isDynamic: true,
width(height) {
const halfHeight = height / 2;
return halfHeight > maxWidth ? maxWidth : halfHeight
},
height(height) {
return height;
},
connectionOffsetY(connectionHeight) {
return connectionHeight / 2;
},
connectionOffsetX(connectionWidth) {
return -connectionWidth;
},
pathDown: (height) => makeLeftPath(height, false), //this.SQUARED.pathDown,
pathUp: (height) => makeLeftPath(height, true), //this.SQUARED.pathUp,
pathRightDown: this.HEXAGONAL.pathRightDown,
pathRightUp: this.HEXAGONAL.pathRightUp
}
}

/** @returns {import("blockly/core/renderers/common/constants").Shape} */
Expand Down Expand Up @@ -103,6 +144,8 @@ class CustomConstantProvider extends Blockly.zelos.ConstantProvider {
if (connection.type == Blockly.ConnectionType.INPUT_VALUE || connection.type == Blockly.ConnectionType.OUTPUT_VALUE) {
if (checks && checks.length > 1) {
return this.ROUNDED;
} else if (checks && checks.includes('Sprite')) {
return this.ARROW;
} else if (checks && checks.includes('List')) {
return this.PLUS;
} else if (checks && checks.includes('String')) {
Expand Down
2 changes: 2 additions & 0 deletions src/resources/blocks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import registerStrings from "./strings";
import registerInputs from "./inputs";
import registerVariables from "./variables";
import registerLists from "./lists";
import registerSprites from "./sprites";
import registerBlocks from "./blocks";

import registerRuntime from "./runtime";
Expand All @@ -20,6 +21,7 @@ export default () => {
registerInputs();
registerVariables();
registerLists();
registerSprites();
registerBlocks();

registerRuntime();
Expand Down
2 changes: 1 addition & 1 deletion src/resources/blocks/lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function register() {
}, (block) => {
const INDEX = javascriptGenerator.valueToCode(block, 'INDEX')
const INPUT = javascriptGenerator.valueToCode(block, 'INPUT')
const VALUE = javascriptGenerator.valueToCode(block, 'VALUE')
const VALUE = javascriptGenerator.valueToCode(block, 'TEXT')
const code = `ExtForge.Utils.setList(${INPUT}, ${INDEX}, ${VALUE})`;
return [`${code}`, 0];
})
Expand Down
Loading