Skip to content

Commit

Permalink
fix event issue
Browse files Browse the repository at this point in the history
  • Loading branch information
SharkPool-SP authored Dec 27, 2024
1 parent 0f2674e commit ba1e2b2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions extensions/Lily/ClonesPlus.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,21 @@
// isEdgeActivated is also slow, so this implements it with the behaviour of an event
runtime.on("targetWasCreated", (clone, originalTarget) => {
if (clone.isOriginal) return;
const container = originalTarget.blocks;
if (!container) return;
runtime.once("AFTER_EXECUTE", () => {
const ogInitDraw = clone.initDrawable;
clone.initDrawable = function (layerGroup) {
// let the sprite initialize first
ogInitDraw.call(this, layerGroup);

const container = originalTarget.blocks;
if (!container) return;
const scripts = container.getScripts();
for (let i = 0; i < scripts.length; i++) {
const block = container.getBlock(scripts[i]);
if (block.opcode === "lmsclonesplus_whenCloneStartsWithVar") {
runtime._pushThread(block.id, clone);
}
}
});
};
});
}
getInfo() {
Expand Down

0 comments on commit ba1e2b2

Please sign in to comment.