breakout71/src/options.ts

111 lines
2.8 KiB
TypeScript
Raw Normal View History

2025-03-16 17:45:29 +01:00
import { t } from "./i18n/i18n";
2025-03-16 17:45:29 +01:00
import { OptionDef, OptionId } from "./types";
import { getSettingValue, setSettingValue } from "./settings";
import { hoursSpentPlaying } from "./pure_functions";
2025-03-07 11:34:11 +01:00
export const options = {
2025-03-16 17:45:29 +01:00
sound: {
default: true,
2025-04-11 09:36:31 +02:00
name: t("settings.sounds"),
help: t("settings.sounds_help"),
2025-03-16 17:45:29 +01:00
},
"mobile-mode": {
default: window.innerHeight > window.innerWidth,
2025-04-11 09:36:31 +02:00
name: t("settings.mobile"),
help: t("settings.mobile_help"),
2025-03-16 17:45:29 +01:00
},
basic: {
default: false,
2025-04-11 09:36:31 +02:00
name: t("settings.basic"),
help: t("settings.basic_help"),
2025-03-16 17:45:29 +01:00
},
colorful_coins: {
default: false,
2025-04-11 09:36:31 +02:00
name: t("settings.colorful_coins"),
help: t("settings.colorful_coins_help"),
},
2025-04-03 16:10:51 +02:00
extra_bright: {
default: true,
2025-04-11 09:36:31 +02:00
name: t("settings.extra_bright"),
help: t("settings.extra_bright_help"),
2025-04-03 16:10:51 +02:00
},
2025-04-18 21:17:32 +02:00
smooth_lighting: {
default: true,
name: t("settings.smooth_lighting"),
help: t("settings.smooth_lighting_help"),
},
precise_lighting: {
default: true,
name: t("settings.precise_lighting"),
help: t("settings.precise_lighting_help"),
},
2025-04-20 09:33:12 +02:00
probabilistic_lighting: {
default: false,
name: t("settings.probabilistic_lighting"),
help: t("settings.probabilistic_lighting_help"),
},
contrast: {
default: false,
2025-04-11 09:36:31 +02:00
name: t("settings.contrast"),
help: t("settings.contrast_help"),
},
show_fps: {
default: false,
2025-04-11 09:36:31 +02:00
name: t("settings.show_fps"),
help: t("settings.show_fps_help"),
},
show_stats: {
default: false,
2025-04-11 09:36:31 +02:00
name: t("settings.show_stats"),
help: t("settings.show_stats_help"),
},
2025-03-16 17:45:29 +01:00
pointerLock: {
default: false,
2025-04-11 09:36:31 +02:00
name: t("settings.pointer_lock"),
help: t("settings.pointer_lock_help"),
2025-03-16 17:45:29 +01:00
},
easy: {
default: false,
2025-04-11 09:36:31 +02:00
name: t("settings.kid"),
help: t("settings.kid_help"),
2025-03-16 17:45:29 +01:00
},
// Could not get the sharing to work without loading androidx and all the modern android things so for now I'll just disable sharing in the android app
record: {
default: false,
2025-04-11 09:36:31 +02:00
name: t("settings.record"),
help: t("settings.record_help"),
2025-03-16 17:45:29 +01:00
},
fullscreen: {
default: false,
2025-04-11 09:36:31 +02:00
name: t("settings.fullscreen"),
help: t("settings.fullscreen_help"),
},
donation_reminder: {
default: hoursSpentPlaying() > 5,
2025-04-11 09:36:31 +02:00
name: t("settings.donation_reminder"),
help: t("settings.donation_reminder_help"),
},
2025-04-01 21:43:36 +02:00
red_miss: {
default: true,
2025-04-11 09:36:31 +02:00
name: t("settings.red_miss"),
help: t("settings.red_miss_help"),
2025-04-01 21:43:36 +02:00
},
2025-04-02 19:50:05 +02:00
comboIncreaseTexts: {
default: true,
2025-04-11 09:36:31 +02:00
name: t("settings.comboIncreaseTexts"),
help: t("settings.comboIncreaseTexts_help"),
2025-04-02 19:50:05 +02:00
},
2025-03-11 13:56:42 +01:00
} as const satisfies { [k: string]: OptionDef };
2025-03-07 11:34:11 +01:00
2025-03-15 21:29:38 +01:00
export function isOptionOn(key: OptionId) {
2025-03-16 17:45:29 +01:00
return getSettingValue(
"breakout-settings-enable-" + key,
options[key]?.default,
);
2025-03-15 21:29:38 +01:00
}
export function toggleOption(key: OptionId) {
2025-03-16 17:45:29 +01:00
setSettingValue("breakout-settings-enable-" + key, !isOptionOn(key));
}