refactor: remove setup command from host creation
This commit is contained in:
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user