Automatic patches for the custom lobby version

main
peshomir 2025-12-30 21:34:41 +02:00
parent dff5a9ad57
commit 1607255948
2 changed files with 17 additions and 6 deletions

View File

@ -1,4 +1,5 @@
import { definePatch, insert } from "../modUtils.js"
import { styleText } from "node:util";
export default definePatch(({ insertCode, modifyCode }) => {
@ -13,4 +14,13 @@ export default definePatch(({ insertCode, modifyCode }) => {
return;
} ${insert(`if (!__fx.settings.hidePropagandaPopup && !__fx.customLobby.isActive())`)} a.g.h(5);`)
// for the custom lobby version
try {
modifyCode(`new a("⚔️<br>" + __L(), function() {
${insert(`if (__fx.isCustomLobbyVersion) alert("This version is for use with custom lobbies only. For normal multiplayer, use the version at https://fxclient.github.io/FXclient/")
else`)} b(0);
}, ${insert(`__fx.isCustomLobbyVersion ? "rgba(50, 50, 50, 0.6)" : `)} c.d)`)
} catch (error) {
console.warn(styleText("yellow", `Warning: failed to apply patches specific to the custom lobby version`))
}
})

View File

@ -14,15 +14,16 @@ import customLobby from './customLobby.js';
import { displayChangelog } from './changelog.js';
import { reportError } from './debugging.js';
const savedVersion = localStorage.getItem("fx_version");
if (savedVersion !== version) {
localStorage.setItem("fx_version", version);
if (savedVersion !== null) displayChangelog();
}
window.__fx = window.__fx || {};
const __fx = window.__fx;
__fx.version = version + " " + lastUpdated;
__fx.isCustomLobbyVersion = window.location.href.startsWith("https://fxclient.github.io/custom-lobbies")
const savedVersion = localStorage.getItem("fx_version");
if (savedVersion !== version && !__fx.isCustomLobbyVersion) {
localStorage.setItem("fx_version", version);
if (savedVersion !== null) displayChangelog();
}
__fx.settingsManager = settingsManager;
__fx.leaderboardFilter = leaderboardFilter;