- New 💥 Demolish button in the action bar - Red ghost highlights building footprint on hover - Refund: 100% within 3 min, decays linearly to 0% - Mine teardown unblocks passability tiles and removes status label - Nisse inside demolished mine are rescued and reset to idle - Floor/wall/chest tiles restored to GRASS on demolish - Build error now shows missing resources instead of generic message - BuildingState gains builtAt field; old saves default to 0 (no refund) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
78 lines
2.6 KiB
TypeScript
78 lines
2.6 KiB
TypeScript
import type { CropKind, ItemId, BuildingType } from './types'
|
|
|
|
export const TILE_SIZE = 32
|
|
export const CHUNK_SIZE = 16
|
|
export const WORLD_CHUNKS = 32
|
|
export const WORLD_TILES = WORLD_CHUNKS * CHUNK_SIZE
|
|
export const WORLD_PX = WORLD_TILES * TILE_SIZE
|
|
|
|
export const PLAYER_SPEED = 180
|
|
export const INTERACTION_RANGE = 60
|
|
export const CAMERA_LERP = 0.09
|
|
|
|
export const TREE_HEALTH = 3
|
|
export const ROCK_HEALTH = 5
|
|
|
|
export const BUILDING_COSTS: Record<BuildingType, Record<string, number>> = {
|
|
floor: { wood: 2 },
|
|
wall: { wood: 3, stone: 1 },
|
|
chest: { wood: 5, stone: 2 },
|
|
bed: { wood: 6 },
|
|
stockpile_zone:{ wood: 0 },
|
|
forester_hut: { wood: 50 },
|
|
mine: { stone: 50, wood: 200 },
|
|
}
|
|
|
|
/** Maximum number of Nisse that can work inside a mine simultaneously. */
|
|
export const MINE_CAPACITY = 3
|
|
|
|
/** Milliseconds a Nisse spends inside a mine per visit. */
|
|
export const MINE_WORK_MS = 15_000
|
|
|
|
/** Stone yielded per mine visit. */
|
|
export const MINE_STONE_YIELD = 2
|
|
|
|
/** Max Chebyshev radius (in tiles) that a forester hut's zone can extend. */
|
|
export const FORESTER_ZONE_RADIUS = 5
|
|
|
|
export interface CropConfig {
|
|
stages: number
|
|
stageTimeMs: number
|
|
rewards: Partial<Record<ItemId, number>>
|
|
}
|
|
|
|
export const CROP_CONFIGS: Record<CropKind, CropConfig> = {
|
|
wheat: { stages: 3, stageTimeMs: 20_000, rewards: { wheat: 3, wheat_seed: 2 } },
|
|
carrot: { stages: 3, stageTimeMs: 25_000, rewards: { carrot: 4, carrot_seed: 1 } },
|
|
}
|
|
|
|
// Villager config
|
|
export const VILLAGER_SPEED = 75 // px/s — slow and visible
|
|
export const VILLAGER_SPAWN_INTERVAL = 8_000 // ms between spawn checks
|
|
export const VILLAGER_WORK_TIMES: Record<string, number> = {
|
|
chop: 3000,
|
|
mine: 5000,
|
|
farm: 1200,
|
|
forester: 2000,
|
|
}
|
|
export const VILLAGER_NAMES = [
|
|
'Aldric','Brix','Cora','Dwyn','Edna','Finn','Greta',
|
|
'Holt','Iris','Jorn','Kira','Lars','Mira','Nox',
|
|
'Orla','Pike','Quinn','Rook','Sera','Tull','Uma','Vex',
|
|
]
|
|
|
|
/** Milliseconds after placement during which demolishing gives a full refund (linearly decays to 0%). */
|
|
export const DEMOLISH_REFUND_MS = 180_000 // 3 minutes
|
|
|
|
export const SAVE_KEY = 'tg_save_v5'
|
|
export const AUTOSAVE_INTERVAL = 30_000
|
|
|
|
/** localStorage key for UI settings (opacity etc.) — separate from the game save. */
|
|
export const UI_SETTINGS_KEY = 'tg_ui_settings'
|
|
|
|
/** Milliseconds for one tree-seedling stage to advance (two stages = full tree). */
|
|
export const TREE_SEEDLING_STAGE_MS = 60_000 // 1 min per stage → 2 min total
|
|
|
|
/** Milliseconds before a bare DARK_GRASS tile (after tree felling) reverts to GRASS. */
|
|
export const TILE_RECOVERY_MS = 300_000 // 5 minutes
|