From ef2985bb27d9a4557a2b85efb92141ab47c62ba1 Mon Sep 17 00:00:00 2001 From: LilyMakesThings <127533508+LilyMakesThings@users.noreply.github.com> Date: Tue, 5 Mar 2024 12:22:07 +0000 Subject: [PATCH] Add custom hats to procedures category --- core/procedures.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/procedures.js b/core/procedures.js index 2b4c838335..5461be6f65 100644 --- a/core/procedures.js +++ b/core/procedures.js @@ -250,8 +250,11 @@ Blockly.Procedures.flyoutCategory = function(workspace) { for (var i = 0; i < mutations.length; i++) { var mutation = mutations[i].cloneNode(false); var procCode = mutation.getAttribute('proccode'); + var hat = Blockly.Procedures.getProcedureHat(procCode, workspace); var returnType = Blockly.Procedures.getProcedureReturnType(procCode, workspace); - if (returnType !== Blockly.PROCEDURES_CALL_TYPE_STATEMENT) { + if (hat) { + mutation.setAttribute('hat', true); + } else if (returnType !== Blockly.PROCEDURES_CALL_TYPE_STATEMENT) { mutation.setAttribute('return', returnType); } // @@ -722,6 +725,7 @@ Blockly.Procedures.getBlockReturnType = function(block) { } } } + // to do: array and object types? if (hasSeenBooleanReturn) { return Blockly.PROCEDURES_CALL_TYPE_BOOLEAN; } else {