Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Commit

Permalink
fix(resource): Starchart missing
Browse files Browse the repository at this point in the history
  • Loading branch information
oliversalzburg committed Oct 19, 2022
1 parent 9bf54c9 commit b987609
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export class ResetResourcesSettings extends Setting {
ship: new ResetResourcesSettingsItem("ship", false, 0),
slab: new ResetResourcesSettingsItem("slab", false, 0),
spice: new ResetResourcesSettingsItem("spice", false, 0),
starchart: new ResetResourcesSettingsItem("starchart", false, 0),
steel: new ResetResourcesSettingsItem("steel", false, 0),
tanker: new ResetResourcesSettingsItem("tanker", false, 0),
tears: new ResetResourcesSettingsItem("tears", false, 0),
Expand Down
1 change: 1 addition & 0 deletions packages/userscript/source/settings/ResourcesSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export class ResourcesSettings extends Setting {
ship: new ResourcesSettingsItem("ship", false, 1, 0),
slab: new ResourcesSettingsItem("slab", false, 1, 0),
spice: new ResourcesSettingsItem("spice", false, 1, 0),
starchart: new ResourcesSettingsItem("starchart", true, 1, 500),
steel: new ResourcesSettingsItem("steel", false, 1, 0),
tanker: new ResourcesSettingsItem("tanker", false, 1, 0),
tears: new ResourcesSettingsItem("tears", false, 1, 0),
Expand Down
1 change: 1 addition & 0 deletions packages/userscript/source/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export type Resource =
| "science"
| "slab"
| "spice"
| "starchart"
| "tears"
| "temporalFlux"
| "timeCrystal"
Expand Down
12 changes: 6 additions & 6 deletions packages/userscript/source/ui/ResetResourcesSettingsUi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { SettingListItem } from "./components/SettingListItem";
import { StockButton } from "./components/StockButton";

export class ResetResourcesSettingsUi extends IconSettingsPanel<ResetResourcesSettings> {
private readonly _buildings: Array<SettingListItem>;
private readonly _resources: Array<SettingListItem>;

constructor(host: UserScript, settings: ResetResourcesSettings) {
const label = host.engine.i18n("ui.resources");
Expand All @@ -21,11 +21,11 @@ export class ResetResourcesSettingsUi extends IconSettingsPanel<ResetResourcesSe
);

this._list.addEventListener("enableAll", () => {
this._buildings.forEach(item => (item.setting.enabled = true));
this._resources.forEach(item => (item.setting.enabled = true));
this.refreshUi();
});
this._list.addEventListener("disableAll", () => {
this._buildings.forEach(item => (item.setting.enabled = false));
this._resources.forEach(item => (item.setting.enabled = false));
this.refreshUi();
});
this._list.addEventListener("reset", () => {
Expand All @@ -34,16 +34,16 @@ export class ResetResourcesSettingsUi extends IconSettingsPanel<ResetResourcesSe
});

// Add all the current resources
this._buildings = [];
this._resources = [];
for (const setting of Object.values(this.settings.items)) {
this._buildings.push(
this._resources.push(
this._addNewResourceOption(
ucfirst(this._host.engine.i18n(`$resources.${setting.resource}.title`)),
setting
)
);
}
this.addChildren(this._buildings);
this.addChildren(this._resources);
}

/**
Expand Down

0 comments on commit b987609

Please sign in to comment.