For some reason when I try to call this.effect()
, it causes error:
Uncaught TypeError: this.effect is not a function
Trying to use layers.C.effect()
causes error:
Uncaught TypeError: Cannot read properties of undefined (reading 'effect')
And I know this isn’t how effect()
is used, but using player.C.effect()
causes error:
Uncaught TypeError: Cannot read properties of undefined (reading 'C')
The entire layer is:
addLayer('C', {
name: "hyper-cash",
resource: "Hyper Cash",
startData() {
return {
unlocked: true,
points: new Decimal(0)
}
},
update(diff) {
if(hasMilestone('HC', 0)) player.C.points = player.C.points.add(new Decimal(0.1).times(diff))
},
effect() {
return player.C.points.times(0.01).add(1)
},
effectDescription: "placeholder " + format(this.effect()),
color: "#34eb67"
})
(I’m using layer proxy to render the layer)
layers.C.effect()
works perfectly fine in mod.js
when implementing the effect (doesn’t seem to work in other layers)