add velocity.js compatability, conflict warning and fix pause step bug

This commit is contained in:
redbirdly 2024-06-17 09:52:25 +08:00 committed by GitHub
parent ac83be0c48
commit 8307f9a095
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 25 additions and 4 deletions

View File

@ -349,8 +349,29 @@ tick = function() {
// Even after updating tick(), setInterval still uses the old tick(), reset setInterval
resetInterval(tps);
let originalDrawPixels = drawPixels;
drawPixels = function(forceTick = false) {
originalDrawPixels(forceTick);
renderLightmap();
// Add code to functions instead of replacing them
let originalDoFrame = doFrame;
doFrame = function() {
originalDoFrame();
propagateLightmap();
};
if (enabledMods.includes("mods/lightmap.js")) {
alert("Warning: both fast_lightmap.js and lightmap.js are active and it will not properly work");
}
if (enabledMods.includes("mods/velocity.js")) {
runAfterAutogen(()=>{
let originalDrawPixels = drawPixels;
drawPixels = function(forceTick = false) {
originalDrawPixels(forceTick);
renderLightmap();
};
});
} else {
let originalDrawPixels = drawPixels;
drawPixels = function(forceTick = false) {
originalDrawPixels(forceTick);
renderLightmap();
};
}