bourgade/src/village.ts

45 lines
1.0 KiB
TypeScript
Raw Normal View History

import { writable } from "svelte/store";
import buildings from "./buildings";
import type { Building } from "./types";
export interface VillageState {
buildings: Building[];
resources: {
wood: number;
stone: number;
iron: number;
food: number;
culture: number;
}
}
let uid = 0;
const village = writable<VillageState>({
buildings: [
{ ...buildings.woodcutter, id: uid++ },
{ ...buildings.woodcutter, id: uid++ },
{ ...buildings.woodcutter, id: uid++ },
{ ...buildings.woodcutter, id: uid++ },
{ ...buildings.mine, id: uid++ },
{ ...buildings.mine, id: uid++ },
{ ...buildings.mine, id: uid++ },
{ ...buildings.mine, id: uid++ },
{ ...buildings.pit, id: uid++ },
{ ...buildings.pit, id: uid++ },
{ ...buildings.pit, id: uid++ },
{ ...buildings.pit, id: uid++ },
],
resources: {
wood: 100,
stone: 100,
iron: 100,
food: 0,
culture: 0,
},
});
export default village;