fix(0.1.22): 姓氏选择假功能修复——文档化传递链贯通
根因:GameEngine 构造硬编码 surname:'林'/familyName:'林氏', NewGame 输入的姓氏从未传入引擎(startNewGame 只传 seed) 修复:GameEngineOptions 增加 surname/familyName/motto/difficulty 透传; store.startNewGame 全参传递;createWorldState 按 opts 建档(缺省林氏兜底) 验证:慕容家/慕容临渊 贯通(tsx 实证)+ 新增 2 例防回归测试 测试:1020 全绿(43+1 套件);build 通过
This commit is contained in:
@@ -13,6 +13,11 @@ export interface GameEngineOptions {
|
||||
seed?: string
|
||||
datapack?: Partial<DataPack>
|
||||
noAutoCreate?: boolean
|
||||
/** 建档参数(NewGame 透传;缺省林氏兜底) */
|
||||
surname?: string
|
||||
familyName?: string
|
||||
motto?: string
|
||||
difficulty?: 'easy' | 'normal' | 'hard'
|
||||
}
|
||||
|
||||
export type EngineStatus = 'idle' | 'running' | 'gameover'
|
||||
@@ -39,10 +44,10 @@ export class GameEngine {
|
||||
// 组装World(内核注入→时钟/随机/总线单源)
|
||||
const state = opts.seed ? createWorldState({
|
||||
seed: this._seed,
|
||||
surname: '林',
|
||||
familyName: '林氏',
|
||||
motto: '耕读传家,术法继世',
|
||||
difficulty: 'normal'
|
||||
surname: opts.surname?.trim() || '林',
|
||||
familyName: opts.familyName?.trim() || `${opts.surname?.trim() || '林'}氏`,
|
||||
motto: opts.motto?.trim() || '耕读传家,术法继世',
|
||||
difficulty: opts.difficulty ?? 'normal'
|
||||
}) : (globalThis as never as { __state?: GameState }).__state
|
||||
this.world = new World(state!, [], this.kernel)
|
||||
this.facade = new ApiFacade(this.world, 1)
|
||||
|
||||
Reference in New Issue
Block a user