import const currencies as object properly
This commit is contained in:
parent
14c83b56b9
commit
57caa75b99
|
@ -1,12 +1,10 @@
|
||||||
export default {
|
export const currencies = {
|
||||||
currencies: {
|
energy: 'energy',
|
||||||
energy: 'energy',
|
seasons: 'seasons',
|
||||||
seasons: 'seasons',
|
months: 'months',
|
||||||
months: 'months',
|
days: 'days',
|
||||||
days: 'days',
|
hours: 'hours',
|
||||||
hours: 'hours',
|
seconds: 'seconds',
|
||||||
seconds: 'seconds',
|
nanoseconds: 'nanoseconds',
|
||||||
nanoseconds: 'nanoseconds',
|
plancktime: 'plancktime',
|
||||||
plancktime: 'plancktime',
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,57 +1,60 @@
|
||||||
import Decimal from "break_infinity.js"
|
import Decimal from 'break_infinity.js'
|
||||||
import currencies from "./const.js"
|
import { currencies } from './const.js'
|
||||||
|
|
||||||
export const state = () => ({
|
export const state = () => ({
|
||||||
// use currencies from const as keys; initialize all values to zero
|
// use currencies from const as keys; initialize all values to zero
|
||||||
currency: currencies.reduce(function(obj, x) {
|
currency: Object.keys(currencies).reduce(function (obj, x) {
|
||||||
obj[x] = new Decimal(0);
|
obj[x] = new Decimal(0)
|
||||||
return obj;
|
return obj
|
||||||
}, {}),
|
}, {}),
|
||||||
|
|
||||||
processes: [
|
processes: [
|
||||||
{ device: "Star Chart",
|
{
|
||||||
worker: "Shaman",
|
device: 'Star Chart',
|
||||||
boughtWith: null,
|
worker: 'Shaman',
|
||||||
produces: currencies.seasons,
|
boughtWith: null,
|
||||||
deviceCount: new Decimal(0),
|
produces: currencies.seasons,
|
||||||
workerCount: new Decimal(0),
|
deviceCount: new Decimal(0),
|
||||||
unlockThreshold: {[currencies.seasons]: 0, tech: null}
|
workerCount: new Decimal(0),
|
||||||
},
|
unlockThreshold: { [currencies.seasons]: 0, tech: null },
|
||||||
{ device: "Stone Calendar",
|
},
|
||||||
worker: "Stonecarver",
|
{
|
||||||
boughtWith: currencies.seasons,
|
device: 'Stone Calendar',
|
||||||
produces: currencies.months,
|
worker: 'Stonecarver',
|
||||||
deviceCount: new Decimal(0),
|
boughtWith: currencies.seasons,
|
||||||
workerCount: new Decimal(0),
|
produces: currencies.months,
|
||||||
unlockThreshold: {[currencies.seasons]: 1, tech: null}
|
deviceCount: new Decimal(0),
|
||||||
},
|
workerCount: new Decimal(0),
|
||||||
{ device: "Astrolabes",
|
unlockThreshold: { [currencies.seasons]: 1, tech: null },
|
||||||
worker: "Mathematician",
|
},
|
||||||
boughtWith: currencies.months,
|
{
|
||||||
produces: currencies.days,
|
device: 'Astrolabes',
|
||||||
deviceCount: new Decimal(0),
|
worker: 'Mathematician',
|
||||||
workerCount: new Decimal(0),
|
boughtWith: currencies.months,
|
||||||
unlockThreshold: {[currencies.days]: 10, tech: 0}
|
produces: currencies.days,
|
||||||
}
|
deviceCount: new Decimal(0),
|
||||||
],
|
workerCount: new Decimal(0),
|
||||||
|
unlockThreshold: { [currencies.days]: 10, tech: 0 },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
upgrades: [
|
upgrades: [
|
||||||
{ name: "Mathematics",
|
{
|
||||||
boughtWith: currencies.seasons,
|
name: 'Mathematics',
|
||||||
price: 100,
|
boughtWith: currencies.seasons,
|
||||||
purchased: false
|
price: 100,
|
||||||
},
|
purchased: false,
|
||||||
]
|
},
|
||||||
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
export const mutations = {
|
export const mutations = {
|
||||||
add(state, { key, value }) {
|
add(state, { key, value }) {
|
||||||
console.log(state.currency.keys())
|
console.log(state.currency.keys())
|
||||||
state.currency[key] = Decimal.add(state.currency[key], value)
|
state.currency[key] = Decimal.add(state.currency[key], value)
|
||||||
},
|
},
|
||||||
|
|
||||||
set(state, { key, value }) {
|
set(state, { key, value }) {
|
||||||
state.currency[key] = value
|
state.currency[key] = value
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue