Skip to content

Commit 4eb4117

Browse files
authored
My-Blocks-Plus.js -- Fix type check connections for PenguinMod
1 parent 2de060b commit 4eb4117

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

extension-code/My-Blocks-Plus.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// By: 0znzw <https://scratch.mit.edu/users/0znzw/>
77
// License: MIT
88

9-
// Version V.1.2.4
9+
// Version V.1.2.41
1010

1111
(function(Scratch) {
1212
"use strict";
@@ -919,6 +919,7 @@
919919
let connection, newInput;
920920
if (type === "brc") {
921921
connection = this.makeConnection_(SB.NEXT_STATEMENT);
922+
if (isPM) connection.setCheck("normal");
922923
newInput = new SB.Input(SB.NEXT_STATEMENT, input.name, this, connection);
923924
} else {
924925
const imageURL = getStoredImage(store.inputs[input.name].src);
@@ -958,14 +959,19 @@
958959
// ScratchBlocks ways of getting the next block won't work while the blocks are being created
959960
const actualNextBlock = this.getNextBlock() || vm?.editingTarget?.blocks?.getBlock(this.id)?.next || (domToBlockXml && domToBlockXml.querySelector("next"));
960961
const isReturner = isPM ? this.output_ : this.return_;
961-
if (!store.isTerminal !== undefined && !isReturner && !actualNextBlock) this.setNextStatement(!store.isTerminal, this.type === "procedures_prototype" ? true : undefined);
962+
if (!store.isTerminal !== undefined && !isReturner && !actualNextBlock) {
963+
this.setNextStatement(
964+
!store.isTerminal,
965+
this.type === "procedures_prototype" ? true : isPM ? "normal" : undefined
966+
);
967+
}
962968
} else {
963969
// The insertion marker should copy the terminal-ness of the source block,
964970
// otherwise Blockly will throw an error
965971
const targetBlock = this.workspace?.currentGesture_?.targetBlock_;
966972
// targetBlock doesn't exist when dragging to the start of a stack
967973
// In this case, it should always be a stack block
968-
this.setNextStatement(targetBlock ? !!targetBlock?.nextConnection : true);
974+
this.setNextStatement(targetBlock ? !!targetBlock?.nextConnection : true, isPM ? "normal" : undefined);
969975
}
970976
}
971977
for (const opcode of ["procedures_call", "procedures_prototype", "procedures_declaration"]) {
@@ -1086,10 +1092,10 @@
10861092
if (!block.isInsertionMarker()) {
10871093
const store = storeGet(block.procCode_);
10881094
if (store && store.isTerminal && block.nextConnection && !block.getNextBlock())
1089-
block.setNextStatement(!store.isTerminal);
1095+
block.setNextStatement(!store.isTerminal, isPM ? "normal" : undefined);
10901096
} else {
10911097
// The insertion marker should copy the next connection of the source block
1092-
block.setNextStatement(Boolean(block.getNextBlock()));
1098+
block.setNextStatement(Boolean(block.getNextBlock()), isPM ? "normal" : undefined);
10931099
}
10941100
}
10951101
// For the previous block when starting a drag of the current block

0 commit comments

Comments
 (0)