Skip to content

Commit

Permalink
fix clone limit handling
Browse files Browse the repository at this point in the history
  • Loading branch information
GarboMuffin committed Dec 27, 2024
1 parent dfc8396 commit 8af53ce
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions extensions/Lily/ClonesPlus.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,22 +450,19 @@
try {
isCreatingCloneWithVariable = true;

// @ts-expect-error - ext_scratch3_control not typed yet
runtime.ext_scratch3_control._createClone(
'_myself_',
util.target
);

const clones = util.target.sprite.clones;
const cloneNum = clones.length - 1;
const clone = clones[cloneNum];

const cloneVariable = clone.lookupVariableById(args.INPUTA);
if (cloneVariable) {
cloneVariable.value = args.INPUTB;
const original = util.target;
const clone = util.target.makeClone();
if (clone) {
Scratch.vm.runtime.addTarget(clone);
clone.goBehindOther(original);

const cloneVariable = clone.lookupVariableById(args.INPUTA);
if (cloneVariable) {
cloneVariable.value = args.INPUTB;
}

Scratch.vm.runtime.startHats('lmsclonesplus_whenCloneStartsWithVar', null, clone);
}

Scratch.vm.runtime.startHats('lmsclonesplus_whenCloneStartsWithVar', null, clone);
} finally {
isCreatingCloneWithVariable = false;
}
Expand Down

0 comments on commit 8af53ce

Please sign in to comment.