From ba1e2b2f9a984eb9738f30618bada1ccd5f1a60e Mon Sep 17 00:00:00 2001 From: SharkPool <139097378+SharkPool-SP@users.noreply.github.com> Date: Thu, 26 Dec 2024 23:22:06 -0800 Subject: [PATCH] fix event issue --- extensions/Lily/ClonesPlus.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/extensions/Lily/ClonesPlus.js b/extensions/Lily/ClonesPlus.js index 186bab58e6..629aae5a6c 100644 --- a/extensions/Lily/ClonesPlus.js +++ b/extensions/Lily/ClonesPlus.js @@ -47,9 +47,13 @@ // 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]); @@ -57,7 +61,7 @@ runtime._pushThread(block.id, clone); } } - }); + }; }); } getInfo() {