mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
add debug settings
This commit is contained in:
parent
209fc76fc7
commit
d0663dc1f0
@ -93,7 +93,7 @@ export const globalConfig = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
rendering: {},
|
rendering: {},
|
||||||
debug: require("./config.local").default,
|
debug: G_IS_DEV ? require("./config.local").default : {},
|
||||||
|
|
||||||
// Secret vars
|
// Secret vars
|
||||||
info: {
|
info: {
|
||||||
|
@ -2,98 +2,98 @@ export default {
|
|||||||
// You can set any debug options here!
|
// You can set any debug options here!
|
||||||
/* dev:start */
|
/* dev:start */
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Quickly enters the game and skips the main menu - good for fast iterating
|
_fastGameEnter: "Quickly enters the game and skips the main menu - good for fast iterating",
|
||||||
// fastGameEnter: true,
|
fastGameEnter: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Skips any delays like transitions between states and such
|
_noArtificialDelays: "Skips any delays like transitions between states and such",
|
||||||
// noArtificialDelays: true,
|
noArtificialDelays: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Disables writing of savegames, useful for testing the same savegame over and over
|
_disableSavegameWrite: "Disables writing of savegames, useful for testing the same savegame over and over",
|
||||||
// disableSavegameWrite: true,
|
disableSavegameWrite: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Shows bounds of all entities
|
_showEntityBounds: "Shows bounds of all entities",
|
||||||
// showEntityBounds: true,
|
showEntityBounds: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Shows arrows for every ejector / acceptor
|
_showAcceptorEjectors: "Shows arrows for every ejector / acceptor",
|
||||||
// showAcceptorEjectors: true,
|
showAcceptorEjectors: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Disables the music (Overrides any setting, can cause weird behaviour)
|
_disableMusic: "Disables the music (Overrides any setting, can cause weird behaviour)",
|
||||||
// disableMusic: true,
|
disableMusic: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Do not render static map entities (=most buildings)
|
_doNotRenderStatics: "Do not render static map entities (=most buildings)",
|
||||||
// doNotRenderStatics: true,
|
doNotRenderStatics: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Allow to zoom freely without limits
|
_disableZoomLimits: "Allow to zoom freely without limits",
|
||||||
// disableZoomLimits: true,
|
disableZoomLimits: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Shows a border arround every chunk
|
_showChunkBorders: "Shows a border arround every chunk",
|
||||||
// showChunkBorders: true,
|
showChunkBorders: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// All rewards can be unlocked by passing just 1 of any shape
|
_rewardsInstant: "All rewards can be unlocked by passing just 1 of any shape",
|
||||||
// rewardsInstant: true,
|
rewardsInstant: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Unlocks all buildings
|
_allBuildingsUnlocked: "Unlocks all buildings",
|
||||||
// allBuildingsUnlocked: true,
|
allBuildingsUnlocked: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Disables cost of blueprints
|
_blueprintsNoCost: "Disables cost of blueprints",
|
||||||
// blueprintsNoCost: true,
|
blueprintsNoCost: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Disables cost of upgrades
|
_upgradesNoCost: "Disables cost of upgrades",
|
||||||
// upgradesNoCost: true,
|
upgradesNoCost: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Disables the dialog when completing a level
|
_disableUnlockDialog: "Disables the dialog when completing a level",
|
||||||
// disableUnlockDialog: true,
|
disableUnlockDialog: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Disables the simulation - This effectively pauses the game.
|
_disableLogicTicks: "Disables the simulation - This effectively pauses the game.",
|
||||||
// disableLogicTicks: true,
|
disableLogicTicks: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Test the rendering if everything is clipped out properly
|
_testClipping: "Test the rendering if everything is clipped out properly",
|
||||||
// testClipping: true,
|
testClipping: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Allows to render slower, useful for recording at half speed to avoid stuttering
|
// Allows to render slower, useful for recording at half speed to avoid stuttering
|
||||||
// framePausesBetweenTicks: 1,
|
// framePausesBetweenTicks: 1,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Replace all translations with emojis to see which texts are translateable
|
_testTranslations: "Replace all translations with emojis to see which texts are translateable",
|
||||||
// testTranslations: true,
|
testTranslations: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Enables an inspector which shows information about the entity below the curosr
|
_enableEntityInspector: "Enables an inspector which shows information about the entity below the curosr",
|
||||||
// enableEntityInspector: true,
|
enableEntityInspector: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Enables ads in the local build (normally they are deactivated there)
|
_testAds: "Enables ads in the local build (normally they are deactivated there)",
|
||||||
// testAds: true,
|
testAds: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Disables the automatic switch to an overview when zooming out
|
_disableMapOverview: "Disables the automatic switch to an overview when zooming out",
|
||||||
// disableMapOverview: true,
|
disableMapOverview: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Disables the notification when there are new entries in the changelog since last played
|
_disableUpgradeNotification: "Disables the notification when there are new entries in the changelog since last played",
|
||||||
// disableUpgradeNotification: true,
|
disableUpgradeNotification: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Makes belts almost infinitely fast
|
_instantBelts: "Makes belts almost infinitely fast",
|
||||||
// instantBelts: true,
|
instantBelts: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Makes item processors almost infinitely fast
|
_instantProcessors: "Makes item processors almost infinitely fast",
|
||||||
// instantProcessors: true,
|
instantProcessors: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Makes miners almost infinitely fast
|
_instantMiners: "Makes miners almost infinitely fast",
|
||||||
// instantMiners: true,
|
instantMiners: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// When using fastGameEnter, controls whether a new game is started or the last one is resumed
|
_resumeGameOnFastEnter: "When using fastGameEnter, controls whether a new game is started or the last one is resumed",
|
||||||
// resumeGameOnFastEnter: true,
|
resumeGameOnFastEnter: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Special option used to render the trailer
|
_renderForTrailer: "Special option used to render the trailer",
|
||||||
// renderForTrailer: true,
|
renderForTrailer: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Whether to render changes
|
_renderChanges: "Whether to render changes",
|
||||||
// renderChanges: true,
|
renderChanges: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Whether to render belt paths
|
_renderBeltPaths: "Whether to render belt paths",
|
||||||
// renderBeltPaths: true,
|
renderBeltPaths: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Whether to check belt paths
|
_checkBeltPaths: "Whether to check belt paths",
|
||||||
// checkBeltPaths: true,
|
checkBeltPaths: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
// Whether to items / s instead of items / m in stats
|
_detailedStatistics: "Whether to items / s instead of items / m in stats",
|
||||||
// detailedStatistics: true,
|
detailedStatistics: false,
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
/* dev:end */
|
/* dev:end */
|
||||||
};
|
};
|
||||||
|
@ -10,6 +10,7 @@ import { THEMES, THEME, applyGameTheme } from "../game/theme";
|
|||||||
import { IS_DEMO } from "../core/config";
|
import { IS_DEMO } from "../core/config";
|
||||||
import { T } from "../translations";
|
import { T } from "../translations";
|
||||||
import { LANGUAGES } from "../languages";
|
import { LANGUAGES } from "../languages";
|
||||||
|
import { globalConfig, IS_DEBUG } from "../core/config";
|
||||||
|
|
||||||
const logger = createLogger("application_settings");
|
const logger = createLogger("application_settings");
|
||||||
|
|
||||||
@ -20,6 +21,7 @@ export const enumCategories = {
|
|||||||
general: "general",
|
general: "general",
|
||||||
userInterface: "userInterface",
|
userInterface: "userInterface",
|
||||||
advanced: "advanced",
|
advanced: "advanced",
|
||||||
|
debug: "debug",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const uiScales = [
|
export const uiScales = [
|
||||||
@ -260,6 +262,21 @@ export const allApplicationSettings = [
|
|||||||
new BoolSetting("rotationByBuilding", enumCategories.advanced, (app, value) => {}),
|
new BoolSetting("rotationByBuilding", enumCategories.advanced, (app, value) => {}),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (IS_DEBUG) {
|
||||||
|
for (let k in globalConfig.debug) {
|
||||||
|
if (k.startsWith('_')) continue;
|
||||||
|
const setting = new BoolSetting(`debug_${ k }`, enumCategories.debug, (app, value) => {
|
||||||
|
globalConfig.debug[k] = value;
|
||||||
|
});
|
||||||
|
setting.validate = () => true;
|
||||||
|
T.settings.labels[`debug_${ k }`] = {
|
||||||
|
title: k.replace(/(?!^)([A-Z])/g, " $1"),
|
||||||
|
description: globalConfig.debug[`_${ k }`],
|
||||||
|
};
|
||||||
|
allApplicationSettings.push(setting);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function getApplicationSettingById(id) {
|
export function getApplicationSettingById(id) {
|
||||||
return allApplicationSettings.find(setting => setting.id === id);
|
return allApplicationSettings.find(setting => setting.id === id);
|
||||||
}
|
}
|
||||||
@ -332,7 +349,9 @@ export class ApplicationSettings extends ReadWriteProxy {
|
|||||||
* @param {string} key
|
* @param {string} key
|
||||||
*/
|
*/
|
||||||
getSetting(key) {
|
getSetting(key) {
|
||||||
assert(this.getAllSettings().hasOwnProperty(key), "Setting not known: " + key);
|
if (!key.startsWith('debug_')) {
|
||||||
|
assert(this.getAllSettings().hasOwnProperty(key), "Setting not known: " + key);
|
||||||
|
}
|
||||||
return this.getAllSettings()[key];
|
return this.getAllSettings()[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,6 +185,10 @@ export class BoolSetting extends BaseSetting {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getHtml() {
|
getHtml() {
|
||||||
|
if (!T.settings.labels[this.id].description) {
|
||||||
|
let a = T;
|
||||||
|
let b = a;
|
||||||
|
}
|
||||||
return `
|
return `
|
||||||
<div class="setting cardbox ${this.enabled ? "enabled" : "disabled"}">
|
<div class="setting cardbox ${this.enabled ? "enabled" : "disabled"}">
|
||||||
${this.enabled ? "" : `<span class="standaloneOnlyHint">${T.demo.settingNotAvailable}</span>`}
|
${this.enabled ? "" : `<span class="standaloneOnlyHint">${T.demo.settingNotAvailable}</span>`}
|
||||||
|
@ -650,6 +650,7 @@ settings:
|
|||||||
general: General
|
general: General
|
||||||
userInterface: User Interface
|
userInterface: User Interface
|
||||||
advanced: Advanced
|
advanced: Advanced
|
||||||
|
debug: Debug
|
||||||
|
|
||||||
versionBadges:
|
versionBadges:
|
||||||
dev: Development
|
dev: Development
|
||||||
|
Loading…
Reference in New Issue
Block a user