Automatic patches for the custom lobby version
parent
dff5a9ad57
commit
1607255948
|
|
@ -1,4 +1,5 @@
|
||||||
import { definePatch, insert } from "../modUtils.js"
|
import { definePatch, insert } from "../modUtils.js"
|
||||||
|
import { styleText } from "node:util";
|
||||||
|
|
||||||
export default definePatch(({ insertCode, modifyCode }) => {
|
export default definePatch(({ insertCode, modifyCode }) => {
|
||||||
|
|
||||||
|
|
@ -13,4 +14,13 @@ export default definePatch(({ insertCode, modifyCode }) => {
|
||||||
return;
|
return;
|
||||||
} ${insert(`if (!__fx.settings.hidePropagandaPopup && !__fx.customLobby.isActive())`)} a.g.h(5);`)
|
} ${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`))
|
||||||
|
}
|
||||||
})
|
})
|
||||||
13
src/main.js
13
src/main.js
|
|
@ -14,15 +14,16 @@ import customLobby from './customLobby.js';
|
||||||
import { displayChangelog } from './changelog.js';
|
import { displayChangelog } from './changelog.js';
|
||||||
import { reportError } from './debugging.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 || {};
|
window.__fx = window.__fx || {};
|
||||||
const __fx = window.__fx;
|
const __fx = window.__fx;
|
||||||
__fx.version = version + " " + lastUpdated;
|
__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.settingsManager = settingsManager;
|
||||||
__fx.leaderboardFilter = leaderboardFilter;
|
__fx.leaderboardFilter = leaderboardFilter;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue