Show culture in the HUD and make philosophers produce it.
This commit is contained in:
parent
6c18870b6b
commit
04a37732d9
BIN
public/img/icons/culture.png
Normal file
BIN
public/img/icons/culture.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 873 B |
@ -28,6 +28,10 @@
|
|||||||
{ Math.floor($village.resources.food) } / { capacity.food }
|
{ Math.floor($village.resources.food) } / { capacity.food }
|
||||||
({ production.food >= 0 ? '+' : '' }{ production.food })
|
({ production.food >= 0 ? '+' : '' }{ production.food })
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<img src="/img/icons/culture.png" alt="Culture" />
|
||||||
|
{ Math.floor($village.resources.culture) }
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -15,6 +15,11 @@ export interface CostType {
|
|||||||
export type ProductionType = CostType;
|
export type ProductionType = CostType;
|
||||||
|
|
||||||
|
|
||||||
|
export interface ResourcesType extends CostType {
|
||||||
|
culture: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export interface BuildingSource {
|
export interface BuildingSource {
|
||||||
name: string;
|
name: string;
|
||||||
type: string;
|
type: string;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { produce } from 'immer';
|
import { produce } from 'immer';
|
||||||
|
|
||||||
import { getBuilding, getProduction, getStorage } from './utils';
|
import { getBuilding, getProduction, getStorage, getUnitSource } from './utils';
|
||||||
import village, { type VillageState } from "./village";
|
import village, { type VillageState } from "./village";
|
||||||
import type { ProductionType } from './types';
|
import type { ProductionType } from './types';
|
||||||
|
|
||||||
@ -67,6 +67,12 @@ export default function update(timestamp: number) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Make philosophers produce culture.
|
||||||
|
const philosopher = getUnitSource('philosopher');
|
||||||
|
const outputPerMinute = philosopher.behavior.culturePerMinute;
|
||||||
|
const outputPerMilisecond = outputPerMinute / 60.0 / 1000.0;
|
||||||
|
V.resources.culture += outputPerMilisecond * delta * V.units.philosopher;
|
||||||
|
|
||||||
return V;
|
return V;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -2,7 +2,7 @@ import { writable } from "svelte/store";
|
|||||||
|
|
||||||
import { createBuilding } from "./create";
|
import { createBuilding } from "./create";
|
||||||
import { getTilesAtDistance, Hex } from "./hexgrid";
|
import { getTilesAtDistance, Hex } from "./hexgrid";
|
||||||
import type { BuildingType } from "./types";
|
import type { BuildingType, ResourcesType } from "./types";
|
||||||
import { getKeysAsNumbers, shuffle } from "./utils";
|
import { getKeysAsNumbers, shuffle } from "./utils";
|
||||||
|
|
||||||
|
|
||||||
@ -24,13 +24,7 @@ export interface VillageState {
|
|||||||
units: {
|
units: {
|
||||||
[key: string]: number;
|
[key: string]: number;
|
||||||
},
|
},
|
||||||
resources: {
|
resources: ResourcesType;
|
||||||
wood: number;
|
|
||||||
stone: number;
|
|
||||||
iron: number;
|
|
||||||
food: number;
|
|
||||||
culture: number;
|
|
||||||
};
|
|
||||||
villageTiles: Board;
|
villageTiles: Board;
|
||||||
outsideTiles: Board;
|
outsideTiles: Board;
|
||||||
queue: QueuedBuilding[];
|
queue: QueuedBuilding[];
|
||||||
|
Loading…
Reference in New Issue
Block a user