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 }
|
||||
({ production.food >= 0 ? '+' : '' }{ production.food })
|
||||
</div>
|
||||
<div>
|
||||
<img src="/img/icons/culture.png" alt="Culture" />
|
||||
{ Math.floor($village.resources.culture) }
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
|
@ -15,6 +15,11 @@ export interface CostType {
|
||||
export type ProductionType = CostType;
|
||||
|
||||
|
||||
export interface ResourcesType extends CostType {
|
||||
culture: number;
|
||||
}
|
||||
|
||||
|
||||
export interface BuildingSource {
|
||||
name: string;
|
||||
type: string;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { produce } from 'immer';
|
||||
|
||||
import { getBuilding, getProduction, getStorage } from './utils';
|
||||
import { getBuilding, getProduction, getStorage, getUnitSource } from './utils';
|
||||
import village, { type VillageState } from "./village";
|
||||
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;
|
||||
});
|
||||
});
|
||||
|
@ -2,7 +2,7 @@ import { writable } from "svelte/store";
|
||||
|
||||
import { createBuilding } from "./create";
|
||||
import { getTilesAtDistance, Hex } from "./hexgrid";
|
||||
import type { BuildingType } from "./types";
|
||||
import type { BuildingType, ResourcesType } from "./types";
|
||||
import { getKeysAsNumbers, shuffle } from "./utils";
|
||||
|
||||
|
||||
@ -24,13 +24,7 @@ export interface VillageState {
|
||||
units: {
|
||||
[key: string]: number;
|
||||
},
|
||||
resources: {
|
||||
wood: number;
|
||||
stone: number;
|
||||
iron: number;
|
||||
food: number;
|
||||
culture: number;
|
||||
};
|
||||
resources: ResourcesType;
|
||||
villageTiles: Board;
|
||||
outsideTiles: Board;
|
||||
queue: QueuedBuilding[];
|
||||
|
Loading…
Reference in New Issue
Block a user