From 255c9b4fc676d0d082d9358dd2474bc3ea55fd11 Mon Sep 17 00:00:00 2001 From: redbirdly <155550833+redbirdly@users.noreply.github.com> Date: Sun, 16 Jun 2024 17:24:12 +0800 Subject: [PATCH] fix loading --- mods/fast_lightmap.js | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/mods/fast_lightmap.js b/mods/fast_lightmap.js index f572cb1d..20e3c060 100644 --- a/mods/fast_lightmap.js +++ b/mods/fast_lightmap.js @@ -265,20 +265,9 @@ elements.plasma.tick = function(pixel) { lightmap[y][x] = { color: plasmaColor }; }; -// Wait for loading -let i = 0; -let interval = setInterval(() => { - if (typeof width !== 'undefined') { - clearInterval(interval); - initializeLightmap(width, height); - } - i += 1; - // if width is not defined for 3 seconds or longer, it's probably broken, so it will just try run the function anyways to see the error - if (i >= 30) { - clearInterval(interval); - initializeLightmap(width, height); - } -}, 100); +window.addEventListener('load', function() { + initializeLightmap(width, height); +}); // Add code to functions instead of replacing them let originalTick = tick;