Skip to content

Commit 6a16aaf

Browse files
committed
detect if block is a hat instead of calling it a "Stack"
1 parent ee890db commit 6a16aaf

1 file changed

Lines changed: 11 additions & 13 deletions

File tree

‎src/addons/addons/ai-integration/helpers.js‎

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -195,21 +195,19 @@ export default class helpers {
195195
static returnSterilizedToolbox(Gaddon) {
196196
if (Gaddon == null) return;
197197
function extractBlockReturnType(block) {
198-
if (block) {
199-
var returnType = "Stack";
200-
if (block.outputConnection) {
201-
// Check if the block is a boolean
202-
if (block.outputConnection.check_ && block.outputConnection.check_.includes("Boolean")) {
203-
returnType = "Reporter";
204-
} else {
205-
returnType = "Boolean";
206-
}
198+
if (!block) return null;
199+
var returnType = "Stack";
200+
if (block.outputConnection) {
201+
if (block.outputConnection.check_ && block.outputConnection.check_.includes("Boolean")) {
202+
returnType = "Reporter";
203+
} else {
204+
returnType = "Boolean";
207205
}
208-
return returnType;
209-
} else {
210-
return null;
206+
} else if (!block.previousConnection && block.nextConnection) {
207+
returnType = "Hat";
211208
}
212-
}
209+
return returnType;
210+
}
213211
var workspace = new Blockly.Workspace();
214212

215213
var toolbox = Gaddon.tab.redux.state.scratchGui.toolbox.toolboxXML;

0 commit comments

Comments
 (0)