Skip to content

Commit 2f7e6ef

Browse files
committed
Remove clickercookie param from Upgrade
1 parent 54453c8 commit 2f7e6ef

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

src/ts/clickercookie.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ export default class ClickerCookie extends Mod<ClickerCookieSaveData> {
520520
Handlers.BUILDING.register(new Identifier(this.NAMESPACE, "church"), this.church);
521521

522522
for (const uid in this.UPGRADES_DATA) {
523-
Handlers.UPGRADE.register(new Identifier(this.NAMESPACE, uid), new Upgrade(this, this.UPGRADES_DATA[uid]));
523+
Handlers.UPGRADE.register(new Identifier(this.NAMESPACE, uid), new Upgrade(this.UPGRADES_DATA[uid]));
524524
}
525525

526526
// Register personalization things (must be before save load because loading requires these to be registered to set them)

src/ts/exmod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class NewMod extends Mod<ModSave> {
5555
Handlers.BUILDING.register(new Identifier(this.NAMESPACE, "banana"), this.banana);
5656

5757
for (const uid in this.UPGRADES_DATA) {
58-
Handlers.UPGRADE.register(new Identifier(this.NAMESPACE, uid), new Upgrade(Game.getInstance().clickercookie, this.UPGRADES_DATA[uid]));
58+
Handlers.UPGRADE.register(new Identifier(this.NAMESPACE, uid), new Upgrade(this.UPGRADES_DATA[uid]));
5959
}
6060
}
6161

src/ts/upgrades.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ export function expandUpgradesHolder(retract: boolean=false) {
4848
}
4949

5050
export class Upgrade implements SaveProvider<UpgradeSave> {
51-
private clickercookie: ClickerCookie;
52-
5351
name: string;
5452
quote: string;
5553
price: number;
@@ -64,9 +62,7 @@ export class Upgrade implements SaveProvider<UpgradeSave> {
6462

6563
html: HTMLDivElement;
6664
statisticHTML: HTMLDivElement;
67-
constructor(clickercookie: ClickerCookie, data: UpgradeData) {
68-
this.clickercookie = clickercookie
69-
65+
constructor(data: UpgradeData) {
7066
this.name = data.name;
7167
this.quote = data.quote;
7268
this.price = data.price;
@@ -129,9 +125,11 @@ export class Upgrade implements SaveProvider<UpgradeSave> {
129125
}
130126

131127
clicked() {
132-
if (this.clickercookie.cookies < this.price) return;
128+
const clickercookie = Game.getInstance().clickercookie;
129+
130+
if (clickercookie.cookies < this.price) return;
133131

134-
this.clickercookie.cookies -= this.price;
132+
clickercookie.cookies -= this.price;
135133
this.bought = true;
136134
this.hovered(); //? i don't remember why this is here but i know it's important just trust me
137135
this.setVisibility(false);

0 commit comments

Comments
 (0)