Automatically reset game setting's value if it has the same value as global's

This commit is contained in:
redphx
2025-01-30 16:10:51 +07:00
parent 96de61c301
commit fe418e6918
8 changed files with 83 additions and 53 deletions

View File

@@ -63,7 +63,7 @@ export class BaseSettingsStorage<T extends AnyPref> {
return this.definitions[key];
}
hasSetting<K extends keyof PrefTypeMap<K>>(key: K): boolean {
hasSetting(key: T): boolean {
return key in this.settings;
}
@@ -196,4 +196,15 @@ export class BaseSettingsStorage<T extends AnyPref> {
return value.toString();
}
deleteSetting(pref: T) {
if (this.hasSetting(pref)) {
delete this.settings[pref];
this.saveSettings();
return true;
}
return false;
}
}