refactor: remove setup command from host creation

This commit is contained in:
2026-04-04 12:48:51 +08:00
parent ae98e0735a
commit 22d40fdc50
2 changed files with 1 additions and 7 deletions
-5
View File
@@ -26,18 +26,15 @@ export class GameHost<TState extends Record<string, unknown>> {
private _activePromptSchema: Signal<CommandSchema | null>;
private _activePromptPlayer: Signal<string | null>;
private _createInitialState: () => TState;
private _setupCommand: string;
private _eventListeners: Map<'setup' | 'dispose', Set<() => void>>;
private _isDisposed = false;
constructor(
registry: CommandRegistry<MutableSignal<TState>>,
createInitialState: () => TState,
setupCommand: string,
options?: GameHostOptions
) {
this._createInitialState = createInitialState;
this._setupCommand = setupCommand;
this._eventListeners = new Map();
const initialState = createInitialState();
@@ -148,13 +145,11 @@ export class GameHost<TState extends Record<string, unknown>> {
export function createGameHost<TState extends Record<string, unknown>>(
module: GameModule<TState>,
setupCommand: string,
options?: GameHostOptions
): GameHost<TState> {
return new GameHost(
module.registry,
module.createInitialState,
setupCommand,
options
);
}