import { SpawnKind } from './LevelTypes'; import { CELL_PIXEL } from '../core/GridConstants'; import { getEntityCellBox } from '../visual/EntityDisplayRefs'; /** spawns[].scale 为相对默认值的比例,1 = 默认大小 */ export function resolveEntityScaleMul(kind: SpawnKind, spawnScale?: number): number { const mul = spawnScale !== undefined && spawnScale !== null && !Number.isNaN(spawnScale) ? spawnScale : 1; return Math.max(0.1, Math.min(4, mul)); } export function resolveEntityHeight(kind: 'player' | 'vehicle', spawnScale?: number, theme?: string): number { const box = getEntityCellBox(theme)[kind]; return CELL_PIXEL * box.h * resolveEntityScaleMul(kind, spawnScale); } /** 可拾取物等基准缩放(spawn scale 倍率用,显示尺寸见 themes-database entityDisplay) */ export const ENTITY_BASE_SCALE: Record = { player: 1, vehicle: 1, prop: 1, prop_decor: 0.87, enemy: 1, };